- Install also the source code of the examples together with a minimal Makefile.
- Installed examples are now buildable on hosts with glite-lb-client installed.
THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la
TOOLS:=${LB_PERF_TOOLS}
-EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl stresslog flood_proxy dagids stress_context parse_eventsfile
+EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c notify.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c
+EXAMPLES:=${EXAMPLES_SRC:.c=}
# TODO: migrate them here from branch_RC31_3
-# EXAMPLES_PLUS:=indexed_attrs_plus job_status_plus query_events_plus listener user_jobs_plus job_log_plus notify_plus
+# EXAMPLES_PLUS_SRC:=indexed_attrs_plus.cpp job_status_plus.cpp query_events_plus.cpp listener.cpp user_jobs_plus.cpp job_log_plus.cpp notify_plus.cpp
+# EXAMPLES_PLUS:=${EXAMPLES_PLUS_SRC:.cpp=}
+
+EXAMPLES_CL_SRC:=user_jobs.c job_status.c
+EXAMPLES_CL:=${EXAMPLES_CL_SRC:.c=}
+
+EXAMPLES_CL_THR_SRC:=user_jobs_threaded.c
+EXAMPLES_CL_THR:=${EXAMPLES_CL_THR_SRC:.c=}
-EXAMPLES_CL:=user_jobs job_status
-EXAMPLES_CL_THR:=user_jobs_threaded
FAKE_EXAMPLES:=job_log_fake
MAN_GZ:=glite-lb-logevent.1.gz
mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix}
mkdir -p ${PREFIX}/lib
mkdir -p ${PREFIX}/share/doc/${package}-${version}/api
+ mkdir -p ${PREFIX}/share/doc/${package}-${version}/examples
mkdir -p ${PREFIX}/share/man/man1
+ mkdir -p ${PREFIX}/examples
ifdef LB_STANDALONE
${INSTALL} -m 644 ${LIB} ${THRLIB} ${PREFIX}/lib
else
cp -r C CPP ${PREFIX}/share/doc/${package}-${version}
# cp -r ${top_srcdir}/doc/api/{Makefile,api.tex,fig} ${PREFIX}/share/doc/${package}-${version}/api
endif
- mkdir -p ${PREFIX}/examples
for p in logevent; do \
${INSTALL} -m 755 "$$p" "${PREFIX}/bin/glite-lb-$$p"; \
done
for p in ${TOOLS} ; do \
${INSTALL} -m 755 "$$p" "${PREFIX}/sbin/glite-lb-$$p"; \
done
-# TODO: restructuring - install also source code of examples together with some good Makefile
- for p in ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS} ; do \
+# TODO: restructuring - do we really need binaries of the examples to be installed?
+ for p in ${EXAMPLES} ${EXAMPLES_PLUS} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS} ; do \
${INSTALL} -m 755 "$$p" "${PREFIX}/examples/glite-lb-$$p"; \
done
+ for p in ${EXAMPLES_SRC} ${EXAMPLES_PLUS_SRC} ${EXAMPLES_CL_SRC} ${EXAMPLES_CL_THR_SRC} ; do \
+ ${INSTALL} -m 644 "${top_srcdir}/examples/$$p" "${PREFIX}/share/doc/${package}-${version}/examples/"; \
+ done
+ ${INSTALL} -m 644 ${top_srcdir}/examples/Makefile "${PREFIX}/share/doc/${package}-${version}/examples/"
+ ${INSTALL} -m 644 ${top_srcdir}/examples/README.examples "${PREFIX}/share/doc/${package}-${version}/examples/"
${INSTALL} -m 755 ${top_srcdir}/src/export.sh "${PREFIX}/sbin/glite-lb-export.sh"
${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1
--- /dev/null
+glite_location:=${GLITE_LOCATION}
+glite_prefix:=${glite_location}
+
+nothrflavour=gcc32dbg
+thrflavour=gcc32dbgpthr
+
+CC:=gcc
+CXX:=g++
+
+COMMON_LIB:=-lglite_lb_common_${nothrflavour}
+COMMON_LIB_THR:=-lglite_lb_common_${thrflavour}
+CLIENT_LIB:=-lglite_lb_client_${nothrflavour}
+CLIENT_LIB_THR:=-lglite_lb_client_${thrflavour}
+JOBID_LIB:=-lglite_jobid
+
+LIB:=${COMMON_LIB} ${CLIENT_LIB} ${JOBID_LIB}
+LIB_THR:=${COMMON_LIB_THR} ${CLIENT_LIB_THR} ${JOBID_LIB}
+PLUSLIB:=
+PLUSLIB_THR:=
+
+CFLAGS:=${DEBUG} \
+ -I${glite_prefix}/include \
+ -D_GNU_SOURCE
+
+CXXFLAGS:=${CFLAGS}
+
+host_cpu:=${shell uname -m}
+ifeq (${host_cpu},x86_64)
+ LDFLAGS:=-L${glite_prefix}/lib64
+else
+ LDFLAGS:=-L${glite_prefix}/lib
+endif
+
+COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
+CXXCOMPILE:=libtool --mode=compile ${CXX} ${CXXFLAGS}
+LINK:=libtool --mode=link ${CC} ${LDFLAGS}
+LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
+INSTALL:=libtool --mode=install install
+
+EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c notify.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c user_jobs.c job_status.c
+EXAMPLES:=${EXAMPLES_SRC:.c=}
+
+# TODO: migrate them here from branch_RC31_3
+# EXAMPLES_PLUS_SRC:=indexed_attrs_plus.cpp job_status_plus.cpp query_events_plus.cpp listener.cpp user_jobs_plus.cpp job_log_plus.cpp notify_plus.cpp
+# EXAMPLES_PLUS:=${EXAMPLES_PLUS_SRC:.cpp=}
+# EXAMPLES_PLUS_THR_SRC:=
+# EXAMPLES_PLUS_THR:=${EXAMPLES_PLUS_THR_SRC:.cpp=}
+
+EXAMPLES_THR_SRC:=user_jobs_threaded.c
+EXAMPLES_THR:=${EXAMPLES_CL_THR_SRC:.c=}
+
+default all: examples
+
+examples: ${EXAMPLES} ${EXAMPLES_THR} ${EXAMPLES_PLUS} ${EXAMPLES_PLUS_THR}
+
+${EXAMPLES}: %: %.o
+ ${LINK} -o $@ $< ${LIB}
+
+${EXAMPLES_THR}: %: %.o
+ ${LINK} -o $@ $< ${LIB_THR}
+
+${EXAMPLES_PLUS}: %: %.o
+ ${LINKXX} -o $@ $< ${PLUSLIB}
+
+${EXAMPLES_PLUS_THR}: %: %.o
+ ${LINKXX} -o $@ $< ${PLUSLIB_THR}
+
+# catches $TOOLS and logevent compilation
+%.o: %.c
+ ${CC} ${CFLAGS} -c $<
+
+%.o: %.cpp
+ ${CXX} ${CXXFLAGS} -c $<
+
+clean:
+ rm -rvf ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR}
+ rm -rvf *.o .libs/
+
--- /dev/null
+These are examples demonsrtating the usage of LB client API:
+
+abort_job.c - Manual abort of a job
+change_acl.c - Change ACL
+dagids.c - (sub)JobIds of a DAG job
+feed_shark.c - Notifications "Shark"
+flood_proxy.c - Log User Tag to LB Proxy from multiple processes
+job_log.c - Return all events for given JobId
+job_reg.c - Register a job in LB
+job_status.c - Return a job status of given job
+log_usertag_proxy.c - Log User Tag to LB Proxy
+notify.c - Notifications handling tool (new, bind, change, refresh, receive, test, drop)
+parse_eventsfile.c - Check parsing of dglogd* and notif-dglogd* files
+query_ext.c - Complex querying tool
+query_seq_code.c - How to query the sequence code of a job
+stats.c - Return CE rank statistics from LB
+stress_context.c - Stress test for working with LB context (Init, SetLoggingJob, Free - multiple processes)
+stresslog.c - Stress test for logging (RegisterJOb, LogEvent)
+user_jobs.c - Return jobs owned by given user
+user_jobs_threaded.c - Return jobs owned by given user (threaded version)
+
+
+The following RPMs must be installed in order to be able to build all the examples:
+
+glite-lb-client
+
+(and all its dependencies).
+
+
+To build these examples, just set the GLITE_LOCATION environment variable and run make, e.g.
+
+$ GLITE_LOCATION=/opt/glite make
#include <errno.h>
#include "glite/lb/events_parse.h"
-#include "consumer.h"
-#include "producer.h"
+#include "glite/lb/consumer.h"
+#include "glite/lb/producer.h"
#include "glite/jobid/cjobid.h"
#include "glite/lb/context-int.h"
#include <unistd.h>
#include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/authz.h"
void
#include <stddef.h>
#include <string.h>
-#include "consumer.h"
+#include "glite/lb/consumer.h"
#include "glite/lb/context-int.h"
#include "consumer_fake.h"
#include <fcntl.h>
#include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/events.h"
extern char *optarg;
#include <errno.h>
#include <sysexits.h>
-#include "notification.h"
+#include "glite/lb/notification.h"
static void usage(const char *);
static void printstat(edg_wll_JobStat, int);
#include <sys/types.h>
#include <sys/wait.h>
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/jobid/cjobid.h"
static void slave();
#include <errno.h>
#include "glite/lb/events_parse.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
#include "glite/jobid/cjobid.h"
#ifdef USE_CALLBACKS
#include "glite/lb/consumer_fake.h"
#include <fcntl.h>
#include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/events.h"
extern char *optarg;
#include <expat.h>
#include "glite/lb/context-int.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
#include "glite/lb/xml_conversions.h"
static void dgerr(edg_wll_Context,char *);
#include "glite/lb/notifid.h"
#include "glite/lb/events.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
static struct option opts[] = {
{"help", 0, NULL, 'h'},
#include "glite/security/glite_gss.h"
#include "glite/lb/context.h"
-#include "notification.h"
+#include "glite/lb/notification.h"
static char *me;
#include <errno.h>
#include <fcntl.h>
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/events.h"
#include "glite/lb/events_parse.h"
* fake implementation of the producer API
*/
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/context-int.h"
#include "producer_fake.h"
#include <time.h>
#include "glite/jobid/cjobid.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
#define BUFF_LEN 1024
#define MAX_AND_CONDS 20
#include <errno.h>
#include "glite/jobid/cjobid.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
static struct option opts[] = {
#include <time.h>
#include <string.h>
-#include "statistics.h"
+#include "glite/lb/statistics.h"
int main(int argc,char **argv)
#include <limits.h>
#include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/events.h"
char *outfile = "context_errors";
#include <fcntl.h>
#include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
#include "glite/lb/events.h"
#define MAXMSGSIZE 10240
#include "glite/lb/context.h"
#include "glite/lb/xml_conversions.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
int use_proxy = 0;
#include "glite/lb/context.h"
#include "glite/lb/xml_conversions.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
int use_proxy = 0;