*/
int edg_wll_NotifIdSetUnique(edg_wll_NotifId *notifid, const char *unique);
+/**
+ * Duplicate a NotifId
+ * \param[in] src a notifid to duplicate
+ * \retval pointer to allocated memory containg the duplicated notifid
+ * \retval NULL if memory allocation fails or notifid is invalid
+ */
+edg_wll_NotifId *edg_wll_NotifIdDup(const edg_wll_NotifId src);
+
/*
*@} end of group
*/
#Fri Sep 02 14:16:31 CEST 2005
# glite-lb-client-interface_branch_3_0_0_RC15 tag is taken!
-module.version=2.3.0
+module.version=2.2.1
module.age=0
globus_prefix=/opt/globus
nothrflavour=gcc32
thrflavour=gcc32pthr
-expat_prefix=/opt/expat
CC:=gcc
CXX:=g++
-I${top_srcdir}/src -I${top_srcdir}/interface \
-I${stagedir}/include \
-I${glite_location}/include \
- -I${expat_prefix}/include \
- -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \
${COVERAGE_FLAGS} \
-D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS}
CXXFLAGS:=${CFLAGS}
-ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- mysqlib := -L${mysql_prefix}/lib/mysql
- else
- mysqlib := -L${mysql_prefix}/lib
- endif
-endif
-
-ifneq (${expat_prefix},/usr)
- EXPAT_LIBS:=-L${expat_prefix}/lib
-endif
-EXPAT_LIBS := ${EXPAT_LIBS} -lexpat
-
-EXT_LIB:= ${mysqlib} -lmysqlclient -lz\
- ${EXPAT_LIBS}
+EXT_LIB:=
TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit
TEST_INC:=-I${cppunit_prefix}/include
TOOLS:=dump load purge lb_dump_exporter ${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
+EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl stresslog lbmon flood_proxy dagids stress_context
-EXAMPLES_CL=user_jobs job_status
+EXAMPLES_CL=user_jobs job_status
FAKE_EXAMPLES:=job_log_fake
MAN_GZ:=glite-lb-logevent.1.gz
ifdef LB_STANDALONE
compile all: ${LIB} ${THRLIB} ${TOOLS} logevent examples ${MAN_GZ}
else
-compile all: ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB} examples ${MAN_GZ}
+compile all: check_version ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB} examples ${MAN_GZ}
endif
examples: ${EXAMPLES} ${EXAMPLES_CL} ${sh_PROGS}
${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
${INSTALL} -m 644 ${top_srcdir}/doc/README-fake ${top_srcdir}/doc/README-notify ${PREFIX}/share/doc/${package}-${version}
mkdir -p ${PREFIX}/examples
- for p in logevent ; do \
+ for p in logevent; do \
${INSTALL} -m 755 "$$p" "${PREFIX}/bin/glite-lb-$$p"; \
done
for p in ${TOOLS} ; do \
for p in ${EXAMPLES} ${EXAMPLES_CL} ${sh_PROGS} ; do \
${INSTALL} -m 755 "$$p" "${PREFIX}/examples/glite-lb-$$p"; \
done
- ${INSTALL} -m 755 ${top_srcdir}/examples/export.sh "${PREFIX}/examples/glite-lb-export.sh"
-# ${INSTALL} -m 755 ${top_srcdir}/examples/log_dag.sh "${PREFIX}/examples/glite-lb-log_dag.sh"
+ ${INSTALL} -m 755 ${top_srcdir}/src/export.sh "${PREFIX}/sbin/glite-lb-export.sh"
${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1
clean:
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "glite/wmsutils/jobid/cjobid.h"
+#include "glite/lb/producer.h"
+#include "glite/lb/events.h"
+
+extern char *optarg;
+extern int opterr,optind;
+
+static void usage(char *me)
+{
+ fprintf(stderr,"usage: %s -m bkserver -n num_subjobs [-s seed]\n", me);
+}
+
+int main(int argc, char *argv[])
+{
+ char *seed = "seed", *server = NULL,*p;
+ int done = 0,num_subjobs = 0,i;
+ edg_wll_Context ctx;
+ edg_wlc_JobId jobid,*subjobs;
+
+
+ edg_wll_InitContext(&ctx);
+ opterr = 0;
+
+ do {
+ switch (getopt(argc,argv,"m:n:s:")) {
+ case 's': seed = strdup(optarg); break;
+ case 'm': server = strdup(optarg); break;
+ case 'n': num_subjobs = atoi(optarg); break;
+ case '?': usage(argv[0]); exit(EINVAL);
+ case -1: done = 1; break;
+ }
+ } while (!done);
+
+ if (!server) {
+ fprintf(stderr,"%s: -m server required\n",argv[0]);
+ exit(1);
+ }
+
+ if (!num_subjobs) {
+ fprintf(stderr,"%s: -n num_subjobs required\n",argv[0]);
+ exit(1);
+ }
+
+ p = strchr(server,':');
+ if (p) *p=0;
+ edg_wlc_JobIdCreate(server,p?atoi(p+1):0,&jobid);
+ printf("seed=\"%s\"\nnodes=%d\ndag=\"%s\"\n",seed,num_subjobs,edg_wlc_JobIdUnparse(jobid));
+
+ edg_wll_GenerateSubjobIds(ctx,jobid,num_subjobs,seed,&subjobs);
+
+ for (i=0; i<num_subjobs; i++) printf("node[%d]=\"%s\"\n",i,edg_wlc_JobIdUnparse(subjobs[i]));
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "glite/lb/producer.h"
+#include "glite/wmsutils/jobid/cjobid.h"
+
+static void slave();
+
+int main(int argc,char **argv)
+{
+ int i,nproc;
+
+ if (argc != 2) {
+ fprintf(stderr,"usage: %s nproc\n",argv[0]);
+ return 1;
+ }
+
+ nproc = atoi(argv[1]);
+ if (nproc < 1) {
+ fprintf(stderr,"%s: nproc must be >= 1\n",argv[0]);
+ return 1;
+ }
+
+ for (i=0; i<nproc; i++) {
+ switch (fork()) {
+ case -1: perror("fork()"); return 1;
+ case 0: slave();
+ default: break;
+ }
+ }
+
+ while (nproc) {
+ int stat;
+ wait(&stat);
+ if (WIFEXITED(stat)) nproc--;
+ }
+
+ puts("done");
+ return 0;
+}
+
+
+static void slave()
+{
+ edg_wll_Context ctx;
+ edg_wlc_JobId job;
+ int i,pid = getpid(),noent = 0;
+
+ for (i=0; i<100; i++) {
+ int err;
+ char *et,*ed;
+
+ edg_wll_InitContext(&ctx);
+ edg_wlc_JobIdParse("https://fake.server/fakejob",&job);
+
+ if ((err = edg_wll_SetLoggingJobProxy(ctx,job,NULL,"some user",0))) edg_wll_Error(ctx,&et,&ed);
+ else et = ed = "none";
+
+ printf("[%d] %d: %s (%s)\n",pid,i,
+ err == 0 || err == ENOENT ? "OK" : et,
+ ed);
+
+ if (err == ENOENT) noent++;
+
+ edg_wll_LogUserTagProxy(ctx,"test","x");
+
+ edg_wll_FreeContext(ctx);
+ }
+ printf("[%d] done, ENOENTs %d\n",pid,noent);
+ exit(0);
+}
static void usage(char *me)
{
- fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S]] [-l jdl_file]\n", me);
+ fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S]] [-l jdl_file] [-e seed]\n", me);
}
int main(int argc, char *argv[])
{
- char *src = NULL,*job = NULL,*server = NULL,*seq,*jdl = NULL;
+ char *src = NULL,*job = NULL,*server = NULL,*seq,*jdl = NULL, *seed = NULL;
int lbproxy = 0;
int done = 0,num_subjobs = 0,reg_subjobs = 0,i;
edg_wll_Context ctx;
opterr = 0;
do {
- switch (getopt(argc,argv,"xs:j:m:n:Sl:")) {
+ switch (getopt(argc,argv,"xs:j:m:n:Sl:e:")) {
case 'x': lbproxy = 1; break;
case 's': src = (char *) strdup(optarg); break;
case 'j': job = (char *) strdup(optarg); break;
case 'n': num_subjobs = atoi(optarg); break;
case 'S': if (num_subjobs>0) { reg_subjobs = 1; break; }
case 'l': jdl = (char *) strdup(optarg); break;
+ case 'e': seed = strdup(optarg); break;
case '?': usage(argv[0]); exit(EINVAL);
case -1: done = 1; break;
}
if (edg_wll_RegisterJobProxy(ctx,jobid,
num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
+ num_subjobs,seed,&subjobs))
{
char *et,*ed;
edg_wll_Error(ctx,&et,&ed);
if (edg_wll_RegisterJobSync(ctx,jobid,
num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
jdl ? jdl : "blabla", "NNNSSSS",
- num_subjobs,NULL,&subjobs))
+ num_subjobs,seed,&subjobs))
{
char *et,*ed;
edg_wll_Error(ctx,&et,&ed);
--- /dev/null
+#ident "$Header$"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+#include <time.h>
+
+#include "glite/lb/consumer.h"
+
+static void usage(char *);
+static int query_all(edg_wll_Context, int, struct timeval, edg_wll_JobStat **, edg_wlc_JobId **);
+static void dgerr(edg_wll_Context,char *);
+
+static char *myname = NULL;
+static int debug = 0, verbose = 0, lbproxy =0;
+static const char rcsid[] = "@(#)$Id$";
+
+static struct option const long_options[] = {
+ { "help", no_argument, 0, 'h' },
+ { "version", no_argument, 0, 'V' },
+ { "verbose", no_argument, 0, 'v' },
+ { "debug", no_argument, 0, 'd' },
+ { "lbproxy", required_argument, 0, 'x' },
+ { NULL, 0, NULL, 0}
+};
+
+int main(int argc,char *argv[]) {
+ edg_wll_Context ctx;
+ edg_wll_JobStat *statesOut = NULL;
+ edg_wlc_JobId *jobsOut = NULL;
+ struct timeval time_now;
+
+ int i, result, opt, nJobs;
+ i = result = opt = 0;
+ gettimeofday(&time_now,0);
+
+ myname = argv[0];
+ fprintf(stdout,"\n");
+ /* get arguments */
+ while ((opt = getopt_long(argc,argv,
+ "h" /* help */
+ "V" /* version */
+ "v" /* verbose */
+ "d" /* debug */
+ "x", /* lbproxy */
+ long_options, (int *) 0)) != EOF) {
+
+ switch (opt) {
+ case 'V': fprintf(stdout,"%s:\t%s\n",argv[0],rcsid); exit(0);
+ case 'v': verbose = 1; break;
+ case 'd': debug = 1; break;
+ case 'x': lbproxy = 1; break;
+ case 'h':
+ default:
+ usage(argv[0]); exit(0);
+ }
+ }
+ if ( edg_wll_InitContext(&ctx) ) {
+ fprintf(stderr,"%s: cannot initialize edg_wll_Context\n ",myname);
+ exit(1);
+ }
+
+ if ( (result = query_all(ctx, EDG_WLL_JOB_CLEARED, time_now, &statesOut, &jobsOut)) ) {
+ dgerr(ctx, "edg_wll_QueryJobs");
+ } else {
+ fprintf(stdout,"Number of jobs... ");
+ }
+
+ nJobs = 0;
+ if ( jobsOut ) {
+ for (i=0; jobsOut[i]; i++) edg_wlc_JobIdFree(jobsOut[i]); {
+ nJobs++;
+ free(jobsOut);
+ }
+ }
+ if ( statesOut ) {
+ for (i=0; statesOut[i].state; i++) edg_wll_FreeStatus(&statesOut[i]);
+ free(statesOut);
+ }
+ edg_wll_FreeContext(ctx);
+
+
+ return result;
+}
+
+static void
+usage(char *name) {
+ fprintf(stderr,"Usage: %s [-x]\n", name);
+}
+
+static int
+query_all(edg_wll_Context ctx, int query_status, struct timeval query_time, edg_wll_JobStat **statesOut, edg_wlc_JobId **jobsOut) {
+ edg_wll_QueryRec jc[3];
+ int ret;
+
+ memset(jc, 0, sizeof jc);
+
+ /* jobs in the state 'query_status' within last hour */
+ jc[0].attr = EDG_WLL_QUERY_ATTR_STATUS;
+ jc[0].op = EDG_WLL_QUERY_OP_EQUAL;
+ jc[0].value.i = query_status;
+ jc[1].attr = EDG_WLL_QUERY_ATTR_TIME;
+ jc[1].attr_id.state = query_status;
+ jc[1].op = EDG_WLL_QUERY_OP_WITHIN;
+ jc[1].value.t.tv_sec = query_time.tv_sec - 3600;
+ jc[1].value.t.tv_usec = query_time.tv_usec;
+ jc[1].value2.t.tv_sec = query_time.tv_sec;
+ jc[1].value2.t.tv_usec = query_time.tv_usec;
+ jc[2].attr = EDG_WLL_QUERY_ATTR_UNDEF;
+
+ if ( (ret = edg_wll_QueryJobs(ctx, jc, 0, jobsOut, statesOut)) ) {
+ if ( ret == E2BIG ) {
+ int r;
+ if ( edg_wll_GetParam(ctx, EDG_WLL_PARAM_QUERY_RESULTS, &r) ) return ret;
+ if ( r != EDG_WLL_QUERYRES_LIMITED ) return ret;
+
+ fprintf(stderr," edg_wll_QueryJobs() Warning: only limited result returned!\n");
+ return 0;
+ } else return ret;
+ }
+
+ return ret;
+}
+
+static void
+dgerr(edg_wll_Context ctx,char *where) {
+ char *etxt,*edsc;
+
+ edg_wll_Error(ctx,&etxt,&edsc);
+ fprintf(stderr,"%s: %s: %s",myname,where,etxt);
+ if (edsc) fprintf(stderr," (%s)",edsc);
+ putc('\n',stderr);
+ if(etxt) free(etxt);
+ if(edsc) free(edsc);
+}
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <limits.h>
+
+#include "glite/wmsutils/jobid/cjobid.h"
+#include "glite/lb/producer.h"
+#include "glite/lb/events.h"
+
+char *outfile = "context_errors";
+edg_wlc_JobId job;
+
+static int stop;
+
+struct {
+ int err;
+ char *text,*desc;
+} *errors;
+
+int nerrors;
+
+static void killslaves(int sig)
+{
+ kill(0,SIGTERM);
+ exit(0);
+}
+
+static void terminate(int sig)
+{
+ stop = sig;
+}
+
+static void slave(int num)
+{
+ int good = 0,i;
+ char fname[PATH_MAX];
+ FILE *errf;
+ edg_wll_Context ctx;
+
+ signal(SIGINT,terminate);
+ signal(SIGTERM,terminate);
+ signal(SIGHUP,terminate);
+
+
+ while (!stop) {
+ edg_wll_InitContext(&ctx);
+ edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_WORKLOAD_MANAGER);
+
+ if (edg_wll_SetLoggingJobProxy(ctx,job,NULL,"/I/am/the/user",EDG_WLL_SEQ_NORMAL) && !stop) {
+ errors = realloc(errors,(nerrors+1) * sizeof(*errors));
+ errors[nerrors].err = edg_wll_Error(ctx,&errors[nerrors].text,&errors[nerrors].desc);
+ nerrors++;
+ }
+ else good++;
+
+ edg_wll_FreeContext(ctx);
+ }
+
+ sprintf(fname,"%s_%03d",outfile,num);
+ errf = fopen(fname,"w");
+ if (!errf) { perror(fname); exit(1); }
+
+ for (i=0; i<nerrors; i++)
+ fprintf(errf,"%d %s %s\n",errors[i].err,errors[i].text,errors[i].desc);
+
+ fprintf(errf,"\n%d errors, %d successful attempts\n",nerrors,good);
+
+ fclose(errf);
+ exit(0);
+}
+
+static void usage(const char *me)
+{
+ fprintf(stderr,"usage: %s [-n nproc] [-o outfile] jobid\n",me);
+}
+
+int main(int argc,char **argv)
+{
+ int nproc = 10,opt,i;
+
+ while ((opt = getopt(argc,argv,"n:o:")) != -1) switch (opt) {
+ case 'n': nproc = atoi(optarg); break;
+ case 'o': outfile = optarg; break;
+ case '?': usage(argv[0]); exit(1);
+ }
+
+ if (optind != argc-1) { usage(argv[0]); exit(1); }
+
+ if (edg_wlc_JobIdParse(argv[optind],&job)) {
+ fprintf(stderr,"%s: can't parse\n",argv[optind]);
+ exit(1);
+ }
+
+ signal(SIGTERM,killslaves);
+ signal(SIGINT,killslaves);
+ signal(SIGHUP,killslaves);
+ signal(SIGCHLD,SIG_IGN);
+
+ if (nproc == 1) slave(0);
+ else for (i=0; i<nproc; i++) switch(fork()) {
+ case -1: perror("fork()"); exit(1);
+ case 0: slave(i); /* don't return */
+ default: break;
+ }
+
+ puts("Slaves started, press Ctrl-C to stop");
+
+ while(1) pause();
+}
--- /dev/null
+#!/usr/bin/perl -n
+
+BEGIN{
+ @pf = split /,/,shift;
+};
+
+next if /^\s*$/;
+
+@F = split / /;
+
+undef $prev;
+undef %f;
+
+for $f (@F) {
+ if ($f =~ /^[.A-Z_]+="/) {
+# print $prev,"\n" if $prev;
+ @P = split /=/,$prev,2;
+ $f{$P[0]} = $P[1];
+ $prev = $f;
+ }
+ else { $prev .= $f; }
+}
+
+# print $prev,"\n";
+@P = split /=/,$prev,2;
+$f{$P[0]} = $P[1];
+
+for $f (@pf) {
+ print "$f=$f{$f}\n" if $f{$f};
+}
+print "\n";
Revision history:
$Log$
+<<<<<<< configure.properties.xml
+ Revision 1.6 2006/04/20 07:06:31 jpospi
+ lb4vdt stuff and cleanup
+
+=======
+ Revision 1.5.2.1 2006/08/15 20:06:05 akrenek
+ merge of changes betwen merge_for_3_1_src and merge_30_31_src
+
+>>>>>>> 1.5.2.1
Revision 1.5 2006/03/15 18:02:37 akrenek
cares
Revision 1.3 2004/08/31 16:32:31 jpospi
First attempt to producer test
-
+
Revision 1.2 2004/07/06 20:47:11 flammer
Moved to configure.properties.xml
#Fri Sep 02 14:17:41 CEST 2005
# glite-lb-client_branch_3_0_0_RC15 tag is taken!
-module.version=2.3.0
+module.version=2.2.3
module.age=0
#include "glite/lb/context-int.h"
#include "glite/lb/mini_http.h"
-
+#include "connection.h"
static void CloseConnection(edg_wll_Context ctx, int conn_index)
{
{
edg_wll_plain_close(&ctx->connProxy->conn);
- return edg_wll_Error(ctx, NULL, NULL);
+ return edg_wll_ResetError(ctx);
}
{
struct sockaddr_un saddr;
int flags;
-
+ int err;
+ char *ed = NULL;
+ int retries = 0;
+
+ edg_wll_ResetError(ctx);
+
+ edg_wll_ResetError(ctx);
if (ctx->connProxy->conn.sock > -1) {
// XXX: test path socket here?
goto err;
}
- if (connect(ctx->connProxy->conn.sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
- edg_wll_SetError(ctx, errno, "connect()");
+ while ((err = connect(ctx->connProxy->conn.sock, (struct sockaddr *)&saddr, sizeof(saddr))) < 0 &&
+ errno == EAGAIN &&
+ ctx->p_tmp_timeout.tv_sec >= 0 && ctx->p_tmp_timeout.tv_usec >= 0 &&
+ !(ctx->p_tmp_timeout.tv_sec == 0 && ctx->p_tmp_timeout.tv_usec == 0)
+ )
+ {
+ struct timespec ns = { 0, PROXY_CONNECT_RETRY * 1000000 /* 10 ms */ },rem;
+
+ nanosleep(&ns,&rem);
+
+ ctx->p_tmp_timeout.tv_usec -= ns.tv_nsec/1000;
+ ctx->p_tmp_timeout.tv_usec += rem.tv_nsec/1000;
+
+ ctx->p_tmp_timeout.tv_sec -= ns.tv_sec;
+ ctx->p_tmp_timeout.tv_sec += rem.tv_sec;
+
+ if (ctx->p_tmp_timeout.tv_usec < 0) {
+ ctx->p_tmp_timeout.tv_usec += 1000000;
+ ctx->p_tmp_timeout.tv_sec--;
+ }
+ retries++;
+ }
+
+ /* printf("retries %d\n",retries); */
+
+ if (err) {
+ if (errno == EAGAIN) edg_wll_SetError(ctx,ETIMEDOUT, "edg_wll_open_proxy()");
+ else edg_wll_SetError(ctx, errno, "connect()");
goto err;
}
- return edg_wll_Error(ctx,NULL,NULL);
+ return 0;
err:
/* some error occured; close created connection */
+ err = edg_wll_Error(ctx,NULL,&ed);
edg_wll_close_proxy(ctx);
+ edg_wll_SetError(ctx,err,ed);
+ free(ed);
- return edg_wll_Error(ctx,NULL,NULL);
+ return err;
}
#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__
#define __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__
-#ident "$Header"
+#ident "$Header$"
int edg_wll_close(edg_wll_Context ctx);
int edg_wll_open(edg_wll_Context ctx);
int http_check_status(edg_wll_Context, char *);
+#define PROXY_CONNECT_RETRY 10 /* ms */
+
#endif /* __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__ */
# dump directory of bkserver
+GLITE_LB_EXPORT_PURGEDIR=${GLITE_LB_EXPORT_PURGEDIR:-/tmp/purge}
GLITE_LB_EXPORT_DUMPDIR=${GLITE_LB_EXPORT_DUMPDIR:-/tmp/dump}
-GLITE_LB_EXPORT_DUMPDIR_OLD=${GLITE_LB_EXPORT_DUMPDIR_OLD:-$GLITE_LB_EXPORT_DUMPDIR.old}
+GLITE_LB_EXPORT_PURGEDIR_KEEP=${GLITE_LB_EXPORT_PURGEDIR_KEEP:-""}
+GLITE_LB_EXPORT_DUMPDIR_KEEP=${GLITE_LB_EXPORT_DUMPDIR_KEEP:-""}
# maildir dump directory for jp importer
GLITE_LB_EXPORT_JPDUMP_MAILDIR=${GLITE_LB_EXPORT_JPDUMP_MAILDIR:-/tmp/jpdump}
# directory with exported data (file per job)
-GLITE_LB_EXPORT_EXPORTDIR=${GLITE_LB_EXPORT_EXPORTDIR:-/tmp/lbexport}
+GLITE_LB_EXPORT_JOBSDIR=${GLITE_LB_EXPORT_JOBSDIR:-/tmp/lbexport}
# purge args (timeouts)
-GLITE_LB_EXPORT_PURGE_ARGS=${GLITE_LB_EXPORT_PURGE_ARGS:--a 1h -c 1h -n 1h -o 1d}
+GLITE_LB_EXPORT_PURGE_ARGS=${GLITE_LB_EXPORT_PURGE_ARGS:---cleared 2d --aborted 2w --cancelled 2w --other 2m}
# Book Keeping Server
-GLITE_LB_EXPORT_BKSERVER=${GLITE_LB_EXPORT_BKSERVER:-localhost:9000}
+GLITE_LB_SERVER_PORT=${GLITE_LB_SERVER_PORT:-9000}
+GLITE_LB_EXPORT_BKSERVER=${GLITE_LB_EXPORT_BKSERVER:-localhost:$GLITE_LB_SERVER_PORT}
[ -d $GLITE_LB_EXPORT_JPDUMP_MAILDIR ] || mkdir -p $GLITE_LB_EXPORT_JPDUMP_MAILDIR
[ -d $GLITE_LB_EXPORT_DUMPDIR ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR
-[ -d $GLITE_LB_EXPORT_DUMPDIR_OLD ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR_OLD
-[ -d $GLITE_LB_EXPORT_EXPORTDIR ] || mkdir -p $GLITE_LB_EXPORT_EXPORTDIR
+[ -d $GLITE_LB_EXPORT_PURGEDIR ] || mkdir -p $GLITE_LB_EXPORT_PURGEDIR
+[ -d $GLITE_LB_EXPORT_DUMPDIR_KEEP ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR_KEEP
+[ -d $GLITE_LB_EXPORT_PURGEDIR_KEEP ] || mkdir -p $GLITE_LB_EXPORT_PURGEDIR_KEEP
+[ -d $GLITE_LB_EXPORT_JOBSDIR ] || mkdir -p $GLITE_LB_EXPORT_JOBSDIR
X509_USER_CERT="$X509_USER_CERT" X509_USER_KEY="$X509_USER_KEY" $PREFIX/sbin/glite-lb-purge $GLITE_LB_EXPORT_PURGE_ARGS -l -m $GLITE_LB_EXPORT_BKSERVER
-for file in $GLITE_LB_EXPORT_DUMPDIR/*; do
+for file in $GLITE_LB_EXPORT_PURGEDIR/*; do
if [ -s $file ]; then
- $PREFIX/sbin/glite-lb-lb_dump_exporter -d $file -s $GLITE_LB_EXPORT_EXPORTDIR -m $GLITE_LB_EXPORT_JPDUMP_MAILDIR
- mv $file $GLITE_LB_EXPORT_DUMPDIR_OLD
+ $PREFIX/sbin/glite-lb-lb_dump_exporter -d $file -s $GLITE_LB_EXPORT_JOBSDIR -m $GLITE_LB_EXPORT_JPDUMP_MAILDIR
+ if [ -n "$GLITE_LB_EXPORT_PURGEDIR_KEEP" ]; then
+ mv $file $GLITE_LB_EXPORT_PURGEDIR_KEEP
+ else
+ rm $file
+ fi
else
rm $file
fi
done
+
+if [ -n "$GLITE_LB_EXPORT_DUMPDIR_KEEP" ]; then
+ ls $GLITE_LB_EXPORT_DUMPDIR | xargs -i'{}' cp $GLITE_LB_EXPORT_DUMPDIR/'{}' $GLITE_LB_EXPORT_DUMPDIR_KEEP;
+else
+ ls $GLITE_LB_EXPORT_DUMPDIR | xargs -i'{}' rm -f $GLITE_LB_EXPORT_DUMPDIR/'{}'
+fi
+
#include <errno.h>
#include <time.h>
#include <limits.h>
+#include <sys/time.h>
+
#include "glite/lb/context.h"
#include "glite/lb/events.h"
}
if ( !(st = dump_storage_find(dstorage, jobid)) ) {
- int fd, i;
+ int fd, i;
char fname[PATH_MAX];
+ struct timeval tv;
i = 0;
while ( 1 ) {
perror("Can't create dump file - max tries limit reached ");
cleanup(1);
}
- snprintf(fname, PATH_MAX, "%s/%s.%ld", store_pref, unique, (long) time(NULL));
+ gettimeofday(&tv, NULL);
+ snprintf(fname, PATH_MAX, "%s/%s.%ld_%ld", store_pref, unique, tv.tv_sec, tv.tv_usec);
if ( (fd = open(fname, O_CREAT|O_EXCL|O_RDWR, 00640)) < 0 ) {
- if ( errno == EEXIST ) { sleep(2); continue; }
+ if ( errno == EEXIST ) { usleep(1000); continue; }
perror(fname);
cleanup(1);
}
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <poll.h>
#include "glite/security/glite_gss.h"
#include "glite/lb/notification.h"
#endif
/* NotifReceive */
{
- fd_set fds;
+ struct pollfd pollfds[1];
struct sockaddr_in a;
int recv_sock, alen;
edg_wll_Event *event = NULL;
}
}
- FD_ZERO(&fds);
- FD_SET(fd,&fds);
+ pollfds[0].fd = fd;
+ pollfds[0].events = POLLIN;
tv.tv_sec = timeout->tv_sec;
tv.tv_usec = timeout->tv_usec;
if (ctx->connPoolNotif[0].gss.context == GSS_C_NO_CONTEXT)
{
int ret;
- switch(select(fd+1, &fds, NULL, NULL, &tv)) {
+ switch(poll(pollfds, 1, tv.tv_sec*1000+tv.tv_usec/1000)) {
case -1:
- edg_wll_SetError(ctx, errno, "select() failed");
+ edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: poll() failed");
goto err;
case 0:
- edg_wll_SetError(ctx, ETIMEDOUT, "select() timeouted");
+ edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive: poll() timed out");
goto err;
default:
+ if (!(pollfds[0].revents & POLLIN)) {
+ edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: error on filedescriptor");
+ goto err;
+ }
break;
}
extern int edg_wll_DoLogEventDirect(edg_wll_Context context, edg_wll_LogLine logline);
#define DEFAULT_SOCKET "/tmp/interlogger.sock"
-#define DEFAULT_PREFIX "/tmp/dglogd.log"
+#define DEFAULT_PREFIX EDG_WLL_LOG_PREFIX_DEFAULT
/*
extern char *optarg;
#include "glite/lb/escape.h"
#include "prod_proto.h"
+#include "connection.h"
static const char* socket_path="/tmp/lb_proxy_store.sock";
edg_wll_LogLine logline)
{
int answer;
- int flags;
+ int flags,retries;
char *name_esc,*dguser;
struct sockaddr_un saddr;
edg_wll_PlainConnection conn;
close(conn.sock);
goto edg_wll_DoLogEventProxy_end;
}
+
+/* non-retry variant (pre bug #18994)
+ * XXX: what is the EISCONN case good for? conn.sock is created above.
+ *
if (connect(conn.sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
if(errno != EISCONN) {
edg_wll_SetError(context,answer = errno,"connect()");
goto edg_wll_DoLogEventProxy_end;
}
}
+*/
+
+ retries = 0;
+ while ((answer = connect(conn.sock, (struct sockaddr *)&saddr, sizeof(saddr))) < 0 &&
+ errno == EAGAIN &&
+ context->p_tmp_timeout.tv_sec >= 0 && context->p_tmp_timeout.tv_usec >= 0 &&
+ !(context->p_tmp_timeout.tv_sec == 0 && context->p_tmp_timeout.tv_usec == 0)
+ )
+ {
+ struct timespec ns = { 0, PROXY_CONNECT_RETRY * 1000000 /* 10 ms */ },rem;
+
+ nanosleep(&ns,&rem);
+
+ context->p_tmp_timeout.tv_usec -= ns.tv_nsec/1000;
+ context->p_tmp_timeout.tv_usec += rem.tv_nsec/1000;
+
+ context->p_tmp_timeout.tv_sec -= ns.tv_sec;
+ context->p_tmp_timeout.tv_sec += rem.tv_sec;
+
+ if (context->p_tmp_timeout.tv_usec < 0) {
+ context->p_tmp_timeout.tv_usec += 1000000;
+ context->p_tmp_timeout.tv_sec--;
+ }
+ retries++;
+ }
+
+ if (answer) {
+ if (errno == EAGAIN) edg_wll_SetError(context,answer = ETIMEDOUT,"edg_wll_DoLogEventProxy connect()");
+ else edg_wll_SetError(context,answer = errno,"connect()");
+ close(conn.sock);
+ goto edg_wll_DoLogEventProxy_end;
+ }
+
+/* just debug if (retries) printf("edg_wll_DoLogEventProxy connect retries %d\n",retries); */
/* add DG.USER to the message: */
name_esc = edg_wll_LogEscape(context->p_user_lbproxy);
edg_wll_SetParamString(context, EDG_WLL_PARAM_LBPROXY_USER, user);
/* query LBProxyServer for sequence code if not user-suplied */
-/* FIXME: doesn't work yet */
if (!code) {
- edg_wll_QuerySequenceCodeProxy(context, job, &code_loc);
- goto edg_wll_setloggingjobproxy_end;
+ if (edg_wll_QuerySequenceCodeProxy(context, job, &code_loc))
+ goto edg_wll_setloggingjobproxy_end;
} else {
code_loc = strdup(code);
}
edg_wlc_JobId const *psubjob;
edg_wlc_JobId oldctxjob;
char * oldctxseq;
+ int errcode = 0;
+ char * errdesc = NULL;
if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
oldctxseq = edg_wll_GetSequenceCode(ctx);
while (*pjdl != NULL) {
if (edg_wll_RegisterSubjob(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
ns, parent, 0, NULL, NULL) != 0) {
+ errcode = edg_wll_Error(ctx, NULL, &errdesc);
goto edg_wll_registersubjobs_end;
}
pjdl++; psubjob++;
}
+edg_wll_registersubjobs_end:
edg_wll_SetLoggingJob(ctx, oldctxjob, oldctxseq, EDG_WLL_SEQ_NORMAL);
-edg_wll_registersubjobs_end:
+ if (errcode) {
+ edg_wll_SetError(ctx, errcode, errdesc);
+ free(errdesc);
+ }
return edg_wll_Error(ctx, NULL, NULL);
}
edg_wlc_JobId const *psubjob;
edg_wlc_JobId oldctxjob;
char * oldctxseq;
+ int errcode = 0;
+ char * errdesc = NULL;
if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
oldctxseq = edg_wll_GetSequenceCode(ctx);
while (*pjdl != NULL) {
if (edg_wll_RegisterSubjobProxy(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
ns, parent, 0, NULL, NULL) != 0) {
+ errcode = edg_wll_Error(ctx, NULL, &errdesc);
goto edg_wll_registersubjobsproxy_end;
}
pjdl++; psubjob++;
}
+edg_wll_registersubjobsproxy_end:
edg_wll_SetLoggingJobProxy(ctx, oldctxjob, oldctxseq, NULL, EDG_WLL_SEQ_NORMAL);
-edg_wll_registersubjobsproxy_end:
+ if (errcode) {
+ edg_wll_SetError(ctx, errcode, errdesc);
+ free(errdesc);
+ }
return edg_wll_Error(ctx, NULL, NULL);
}
void log_proto_server(int con, char *logline) {
int i;
- char b[4];
+ char b[5];
char *buf;
ssize_t size, retsize;
// read DGLOG
retsize = read(con, b, 5);
CPPUNIT_ASSERT(retsize == 5);
- CPPUNIT_ASSERT(b[0] = 'D' && b[1] == 'G' && b[2] == 'L' && b[3] == 'O' && b[4] == 'G');
+ CPPUNIT_ASSERT(b[0] == 'D' && b[1] == 'G' && b[2] == 'L' && b[3] == 'O' && b[4] == 'G');
// read size (including '\0', little endian)
for (i = 0; i < 4; i++)
extern int edg_wll_MaildirInit(const char *);
extern int edg_wll_MaildirStoreMsg(const char *, const char *, const char *);
-extern int edg_wll_MaildirRetryTransStart(const char *, time_t, char **, char **);
+extern int edg_wll_MaildirRetryTransStart(const char *, time_t, time_t, char **, char **);
extern int edg_wll_MaildirTransStart(const char *, char **, char **);
extern int edg_wll_MaildirTransEnd(const char *, char *, int);
* default prefix for names of log files
*/
/** default prefix */
-#define EDG_WLL_LOG_PREFIX_DEFAULT "/tmp/dglogd.log"
+#define EDG_WLL_LOG_PREFIX_DEFAULT "/var/glite/log/dglogd.log"
/**
#Fri Sep 02 14:17:07 CEST 2005
-module.version=3.2.0
+module.version=4.0.0
module.age=0
#include <dirent.h>
#include <time.h>
#include <fcntl.h>
+#include <sys/time.h>
+
#include "context-int.h"
#include "lb_maildir.h"
LBMD_DIR_TMP = 0,
LBMD_DIR_NEW,
LBMD_DIR_WORK,
- LBMD_DIR_POST
+ LBMD_DIR_POST,
+ LBMD_DIR_UNDELIVERABLE
};
-static const char *dirs[] = { "tmp", "new", "work", "post" };
+static const char *dirs[] = { "tmp", "new", "work", "post", "undeliverable" };
#define MAX_ERR_LEN 1024
int edg_wll_MaildirStoreMsg(
- const char *root,
- const char *srvname,
- const char *msg)
+ const char *root,
+ const char *srvname,
+ const char *msg)
{
- char fname[PATH_MAX],
- newfname[PATH_MAX];
- int fhnd,
- written,
- msgsz,
- ct, i;
- struct timeval tv;
+ char fname[PATH_MAX],
+ newfname[PATH_MAX];
+ int fhnd,
+ written,
+ msgsz,
+ ct, i;
+ struct timeval tv;
if ( !root ) root = DEFAULT_ROOT;
snprintf(lbm_errdesc, MAX_ERR_LEN, "Maximum tries limit reached with unsuccessful file creation");
return -1;
}
- gettimeofday(&tv,NULL);
- snprintf(fname, PATH_MAX, "%s/%s/%ld.%ld_%d.%s", root, dirs[LBMD_DIR_TMP],
- (long) tv.tv_sec, (long) tv.tv_usec, getpid(), srvname);
+ gettimeofday(&tv, NULL);
+ snprintf(fname, PATH_MAX, "%s/%s/%ld_%ld.%s", root, dirs[LBMD_DIR_TMP], tv.tv_sec, tv.tv_usec, srvname);
if ( (fhnd = open(fname, O_CREAT|O_EXCL|O_WRONLY, 00600)) < 0 ) {
- if ( errno == EEXIST ) { /* hypothetic error */ continue; }
+ if ( errno == EEXIST ) { usleep(1000); continue; }
snprintf(lbm_errdesc, MAX_ERR_LEN, "Can't create file %s", fname);
return -1;
}
int edg_wll_MaildirRetryTransStart(
- const char *root,
- time_t tm,
- char **msg,
- char **fname)
+ const char *root,
+ time_t retry,
+ time_t remove,
+ char **msg,
+ char **fname)
{
- static DIR *dir = NULL;
- struct dirent *ent;
- time_t tlimit;
- struct stat st;
- char newfname[PATH_MAX],
- oldfname[PATH_MAX],
- *buf = NULL;
- int fhnd,
- toread, ct,
- bufsz, bufuse;
+ static DIR *dir = NULL;
+ struct dirent *ent;
+ time_t tlimit_retry, tlimit_remove;
+ struct stat st;
+ char newfname[PATH_MAX],
+ oldfname[PATH_MAX],
+ *buf = NULL;
+ int fhnd,
+ toread, ct,
+ bufsz, bufuse;
if ( !root ) root = DEFAULT_ROOT;
}
}
- tlimit = time(NULL) - tm;
+ tlimit_retry = time(NULL) - retry;
+ tlimit_remove = time(NULL) - remove;
do {
errno = 0;
if ( !(ent = readdir(dir)) ) {
goto err;
}
- if ( st.st_ctime > tlimit ) continue;
+ /* if we cannot deliver the file for 'remove' time limit, */
+ /* it is moved to undeliverable folder and forgotten */
+ if ( st.st_mtime < tlimit_remove ) {
+ snprintf(newfname, PATH_MAX, "%s/%s/%s",
+ root, dirs[LBMD_DIR_UNDELIVERABLE], ent->d_name);
+ }
+ /* try to deliver file every 'retry' seconds */
+ else if ( st.st_ctime > tlimit_retry ) continue;
+
if ( rename(oldfname, newfname) ) {
if ( errno == ENOENT ) {
goto err;
}
} else {
- /* we have found and moved the file with which we will work now */
- break;
+ if (st.st_mtime < tlimit_remove) {
+ /* we have moved undeliverable file to undeliverable folder */
+ /* no other action needed */
+ snprintf(oldfname, PATH_MAX, "%s/%s/%s", root, dirs[LBMD_DIR_TMP], ent->d_name);
+ unlink(oldfname);
+ continue;
+ } else {
+ /* we have found and moved the file to work folder */
+ /* going to process it */
+ break;
+ }
}
} while ( 1 );
close(fhnd);
if ( !(*fname = strdup(ent->d_name)) ) goto err;
+ buf[bufuse] = 0;
*msg = buf;
return 1;
#include <netdb.h>
#include <netinet/in.h>
#include <errno.h>
+#include <poll.h>
+#ifndef INFTIM
+#define INFTIM (-1)
+#endif
#include "lb_plain_io.h"
struct timeval *to)
{
int ct, toread = 0;
- fd_set fds;
+ struct pollfd pollfds[1];
+ int polltime = 0;
struct timeval timeout, before, after;
toread = 0;
do {
- FD_ZERO(&fds);
- FD_SET(conn->sock, &fds);
- switch (select(conn->sock+1, &fds, NULL, NULL, to ? &timeout : NULL)) {
- case 0: errno = ETIMEDOUT; goto cleanup; break;
- case -1: goto cleanup; break;
+ pollfds[0].fd = conn->sock;
+ pollfds[0].events = POLLIN;
+ polltime = to ? (timeout.tv_sec*1000+timeout.tv_usec/1000) : INFTIM;
+ switch (poll(pollfds, 1, polltime)) {
+ case 0: errno = ETIMEDOUT; goto cleanup; break;
+ case -1: goto cleanup; break;
+ default: if (!(pollfds[0].revents & POLLIN)) {
+ errno = EIO;
+ goto cleanup; break;
+ }
}
if ( conn->bufUse == conn->bufSize ) {
if ( to->tv_sec < 0 ) to->tv_sec = to->tv_usec = 0;
}
+ if ( errno == ECONNRESET) errno = ENOTCONN;
if ( errno ) return -1;
if ( conn->bufUse > 0 ) {
{
size_t written = 0;
int ct = -1;
- fd_set fds;
+ struct pollfd pollfds[1];
+ int polltime = 0;
struct timeval timeout, before, after;
struct sigaction sa,osa;
errno = 0;
while ( written < bufsz ) {
- FD_ZERO(&fds);
- FD_SET(conn->sock, &fds);
- switch ( select(conn->sock+1, NULL, &fds, NULL, to? &timeout: NULL) ) {
+ pollfds[0].fd = conn->sock;
+ pollfds[0].events = POLLOUT;
+ polltime = to ? (timeout.tv_sec*1000+timeout.tv_usec/1000) : INFTIM;
+
+ switch (poll(pollfds, 1, polltime)) {
case 0: errno = ETIMEDOUT; goto end; break;
case -1: goto end; break;
+ default: if (!(pollfds[0].revents & POLLOUT)) {
+ errno = ENOTCONN;
+ goto end; break;
+ }
}
if ( (ct=write(conn->sock, ((char*)buf)+written, bufsz-written)) < 0 ) {
if ( errno == EINTR ) { errno = 0; continue; }
edg_wll_SetErrorGss(ctx, "receving HTTP request", &gss_code);
goto error;
case EDG_WLL_GSS_ERROR_ERRNO:
+ if (errno == ECONNRESET) errno = ENOTCONN;
edg_wll_SetError(ctx,errno,"edg_wll_gss_read()");
goto error;
case EDG_WLL_GSS_ERROR_TIMEOUT:
free(id);
return NULL;
}
+
+edg_wll_NotifId *
+edg_wll_NotifIdDup(const edg_wll_NotifId src)
+{
+ char *str;
+ edg_wll_NotifId id = NULL;
+ int ret;
+
+ str = edg_wll_NotifIdUnparse(src);
+ if (str == NULL)
+ return NULL;
+
+ ret = edg_wll_NotifIdParse((const char *)str, &id);
+ free(str);
+
+ return id;
+}
locallogger.port = 9002
-locallogger.file-prefix = /tmp/dglogd.log
+locallogger.file-prefix = /var/glite/log/dglogd.log
locallogger.socket = /tmp/interlogger.sock
locallogger.cert = /etc/grid-security/hostcert.pem
locallogger.key = /etc/grid-security/hostkey.pem
locallogger.CAdir = /etc/grid-security/certificates
-interlogger.file-prefix = /tmp/dglogd.log
+interlogger.file-prefix = /var/glite/log/dglogd.log
interlogger.socket = /tmp/interlogger.sock
interlogger.cert = /etc/grid-security/hostcert.pem
interlogger.key = /etc/grid-security/hostkey.pem
[ -n "$GLITE_LB_LOGGER_PORT" ] && port="-p $GLITE_LB_LOGGER_PORT"
+ mkdir -p /var/glite/log
+ chown $GLITE_USER /var/glite/log
echo -n Starting glite-lb-logd ...
(cd /tmp && ls -f /tmp |fgrep ^dglogd_sock_ |xargs rm -f)
su - $GLITE_USER -c "$GLITE_LOCATION/bin/glite-lb-logd \
#Fri Sep 02 14:18:17 CEST 2005
-module.version=1.4.0
+module.version=1.3.3
module.age=0
#include "interlogd.h"
#include "glite/lb/consumer.h"
+#include "glite/lb/log_proto.h"
#include "glite/security/glite_gss.h"
#ifdef LB_PERF
#include "glite/lb/lb_perftest.h"
#define DEFAULT_PREFIX "/tmp/notif_events"
#define DEFAULT_SOCKET "/tmp/notif_interlogger.sock"
#else
-#define DEFAULT_PREFIX "/tmp/dglogd.log"
+#define DEFAULT_PREFIX EDG_WLL_LOG_PREFIX_DEFAULT
#define DEFAULT_SOCKET "/tmp/interlogger.sock"
#endif
/* welcome */
fprintf(stdout,"\
-This is LocalLogger, part of Workload Management System in EU DataGrid.\
-Copyright (c) 2002 CERN, INFN and CESNET on behalf of the EU DataGrid.\n");
+This is LocalLogger, part of Workload Management System in EU DataGrid & EGEE.\n");
/* get arguments */
while ((opt = getopt_long(argc,argv,
size_t bytes_sent;
struct timeval tv;
edg_wll_GssStatus gss_stat;
+ int events_sent = 0;
clear_error();
eq->timeout = TIMEOUT;
return(0);
}
-
+ if(ret < 0) {
+ if (ret == EDG_WLL_GSS_ERROR_ERRNO && errno == EPIPE && events_sent > 0)
+ eq->timeout = 0;
+ else
+ eq->timeout = TIMEOUT;
+ return(0);
+ }
+
if((code = get_reply(eq, &rep, &code_min)) < 0) {
/* could not get the reply properly, so try again later */
il_log(LOG_ERR, " error reading server %s reply:\n %s\n", eq->dest_name, error_get_msg());
il_log(LOG_ERR, "send_event: %s\n", error_get_msg());
event_queue_remove(eq);
+ events_sent++;
break;
} /* switch */
#Fri Sep 02 14:17:59 CEST 2005
-module.version=2.3.0
+module.version=2.2.2
module.age=0
*/
exit(1);
- while ( !die && req_cnt < set_slave_reqs_max)
+ while ( !die && (req_cnt < set_slave_reqs_max || (conn >= 0 && first_request)))
{
fd_set fds;
int max = sock,
kick_client = KICK_LOAD;
}
- if (req_cnt >= set_slave_reqs_max) kick_client = KICK_COUNT;
+ if (req_cnt >= set_slave_reqs_max && !first_request) kick_client = KICK_COUNT;
if ( kick_client && conn >= 0 )
{
conn = newconn;
srv = newsrv;
gettimeofday(&client_start, NULL);
- client_done.tv_sec = client_start.tv_sec;
- client_done.tv_usec = client_start.tv_usec;
switch ( send(sock, &seq, sizeof(seq), 0) )
{
conn = srv = -1;
continue;
}
+ gettimeofday(&client_done, NULL);
first_request = 1;
}
}
LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
INSTALL:=libtool --mode=install install
LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS}
-XSLTPROC:=xsltproc
+XSLTPROC:=xsltproc --novalid
GLOBUS_LIBS:= -L${globus_prefix}/lib \
-lglobus_common_${nothrflavour} \
</xs:simpleType>
<xs:complexType name="historyStatusType">
- <xs:sequence>
- <xs:element name="status" type="a:statusType" minOccurs="1" maxOccurs="1"/>
- <xs:element name="timestamp" type="xs:dateTime" minOccurs="1" maxOccurs="1"/>
- <xs:element name="reason" type="xs:string"/>
- </xs:sequence>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:attribute name="name" type="a:statusType" use="required"/>
+ <xs:attribute name="timestamp" type="xs:dateTime" use="required"/>
+ <xs:attribute name="reason" type="xs:string" use="optional"/>
+ </xs:restriction>
+ </xs:complexContent>
</xs:complexType>
<xs:simpleType name="jobTypeType">
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="jobIdSequenceType">
+ <xs:sequence>
+ <xs:element name="jobId" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:element name="jobId" type="xs:string" />
<xs:element name="user" type="xs:string">
- <xs:documentation>Job owner according to LB</xs:documentation>
+ <xs:annotation> <xs:documentation>Job owner according to LB</xs:documentation> </xs:annotation>
</xs:element>
+ <!-- Parent jobId of DAG -->
+ <xs:element name="parent" type="xs:string" />
+
<!-- the following 6 elements have to be retrieved from JDL -->
<xs:element name="VO" type="xs:string" />
<xs:element name="aTag" type="xs:string" />
<xs:element name="jobType" type="a:jobTypeType" />
<xs:element name="nsubjobs" type="xs:int" />
+ <xs:element name="subjobs" type="a:jobIdSequenceType" />
<!-- timestamps of the state history of the last resubmission cycle,
i.e. it is guaranteed that each state apears here only once.
<xs:element ref="a:jobId" minOccurs="1" maxOccurs="1"/>
<xs:element ref="a:user" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="a:parent" minOccurs="0" maxOccurs="1"/>
<!-- the following 6 elements have to be retrieved from JDL -->
<xs:element ref="a:VO" minOccurs="0" maxOccurs="1"/>
<xs:element ref="a:jobType" minOccurs="1" maxOccurs="1"/>
<xs:element ref="a:nsubjobs" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="a:subjobs" minOccurs="0" maxOccurs="1"/>
<!-- timestamps of the state history of the last resubmission cycle,
i.e. it is guaranteed that each state apears here only once.
<!-- timestamps of the whole state history, including all resubmission cycles -->
<xs:element ref="a:fullStatusHistory" minOccurs="1" maxOccurs="1"/>
+
+ <xs:element ref="a:JDL" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<!-- No idea where to get these from:
#Fri Sep 02 14:18:35 CEST 2005
-module.version=1.5.0
+module.version=1.4.3
module.age=0
fpid = fopen(pidfile, "w");
if (!fpid) { perror(pidfile); return 1; }
- fprintf(fpid, "%d", getpid());
- fclose(fpid);
+ if (fprintf(fpid, "%d", getpid()) <= 0) { perror(pidfile); return 1; }
+ if (fclose(fpid) != 0) { perror(pidfile); return 1; }
semkey = ftok(pidfile,0);
#define FCNTL_ATTEMPTS 5
#define FCNTL_TIMEOUT 1
-#define FILE_PREFIX "/tmp/dglogd.log"
+#define FILE_PREFIX EDG_WLL_LOG_PREFIX_DEFAULT
#define DEFAULT_SOCKET "/tmp/interlogger.sock"
char *lbproxy_ilog_socket_path = DEFAULT_SOCKET;
event->any.level = context->p_level;
event->any.source = context->p_source;
if (context->p_instance) event->notification.src_instance = strdup(context->p_instance);
- event->notification.notifId = reg_id;
+ event->notification.notifId = edg_wll_NotifIdDup(reg_id);
if (owner) event->notification.owner = strdup(owner);
if (host) event->notification.dest_host = strdup(host);
event->notification.dest_port = port;
#include <string.h>
#include <stdio.h>
#include <errno.h>
+#include <time.h>
+#include <ctype.h>
+
+#include <cclassad.h>
#include <cclassad.h>
free(h->events);
}
+ // FIXME: Fails here on corrupted jobId
if (h->status.state != EDG_WLL_JOB_UNDEF)
edg_wll_FreeStatus(&h->status);
(h->fullStatusHistory == NULL) ) {
*attrval = NULL;
err.code = ENOENT;
- trio_asprintf(&err.desc,"There is no job information to query.");
+ err.desc = strdup("There is no job information to query.");
return glite_jp_stack_error(ctx,&err);
}
av[0].size = -1;
av[0].timestamp = h->status.lastUpdateTime.tv_sec;
}
+ } else if (strcmp(attr, GLITE_JP_LB_parent) == 0) {
+ if (h->status.parent_job) {
+ av = calloc(2, sizeof(glite_jp_attrval_t));
+ av[0].name = strdup(attr);
+ av[0].value = edg_wlc_JobIdUnparse(h->status.parent_job);
+ av[0].size = -1;
+ av[0].timestamp = h->status.lastUpdateTime.tv_sec;
+ }
} else if (strcmp(attr, GLITE_JP_LB_VO) == 0) {
i = 0;
while (h->events[i]) {
}
} else if (strcmp(attr, GLITE_JP_LB_aTag) == 0 ||
strcmp(attr, GLITE_JP_LB_rQType) == 0 ||
- strcmp(attr, GLITE_JP_LB_eDuration) == 0) {
+ strcmp(attr, GLITE_JP_LB_eDuration) == 0)
+ {
/* have to be retrieved from JDL, but probably obsolete and not needed at all */
+ char et[BUFSIZ];
*attrval = NULL;
err.code = ENOSYS;
- trio_asprintf(&err.desc,"Attribute '%s' not implemented yet.",attr);
+ snprintf(et,sizeof et,"Attribute '%s' not implemented yet.",attr);
+ et[BUFSIZ-1] = 0;
+ err.desc = et;
return glite_jp_stack_error(ctx,&err);
} else if (strcmp(attr, GLITE_JP_LB_RB) == 0) {
if (h->status.network_server) {
}
} else if (strcmp(attr, GLITE_JP_LB_NProc) == 0) {
/* currently LB hasn't got the info */
+ char et[BUFSIZ];
*attrval = NULL;
err.code = ENOSYS;
- trio_asprintf(&err.desc,"Attribute '%s' not implemented yet.",attr);
+ snprintf(et,sizeof et,"Attribute '%s' not implemented yet.",attr);
+ et[BUFSIZ-1] = 0;
+ err.desc = et;
return glite_jp_stack_error(ctx,&err);
} else if (strcmp(attr, GLITE_JP_LB_finalStatus) == 0) {
av = calloc(2, sizeof(glite_jp_attrval_t));
av[0].size = -1;
av[0].timestamp = h->status.lastUpdateTime.tv_sec;
} else if (strcmp(attr, GLITE_JP_LB_finalStatusDate) == 0) {
- av = calloc(2, sizeof(glite_jp_attrval_t));
- av[0].name = strdup(attr);
- trio_asprintf(&av[0].value,"%ld.%06ld",
- h->status.lastUpdateTime.tv_sec,
- h->status.lastUpdateTime.tv_usec);
- av[0].size = -1;
- av[0].timestamp = h->status.lastUpdateTime.tv_sec;
+ struct tm *t = NULL;
+ if ((t = gmtime(&h->status.lastUpdateTime.tv_sec)) != NULL) {
+ av = calloc(2, sizeof(glite_jp_attrval_t));
+ av[0].name = strdup(attr);
+ /* dateTime format: yyyy-mm-ddThh:mm:ss:uuuuuu */
+ trio_asprintf(&av[0].value,"%04d-%02d-%02dT%02d:%02d:%02d:%06d",
+ 1900+t->tm_year, 1+t->tm_mon, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec,
+ h->status.lastUpdateTime.tv_usec);
+ av[0].size = -1;
+ av[0].timestamp = h->status.lastUpdateTime.tv_sec;
+ }
} else if (strcmp(attr, GLITE_JP_LB_finalStatusReason) == 0) {
if (h->status.reason) {
av = calloc(2, sizeof(glite_jp_attrval_t));
av[0].timestamp = h->status.lastUpdateTime.tv_sec;
} else if (strcmp(attr, GLITE_JP_LB_additionalReason) == 0) {
/* what is it? */
+ char et[BUFSIZ];
*attrval = NULL;
err.code = ENOSYS;
- trio_asprintf(&err.desc,"Attribute '%s' not implemented yet.",attr);
+ snprintf(et,sizeof et,"Attribute '%s' not implemented yet.",attr);
+ et[BUFSIZ-1] = 0;
+ err.desc = et;
return glite_jp_stack_error(ctx,&err);
} else if (strcmp(attr, GLITE_JP_LB_jobType) == 0) {
av = calloc(2, sizeof(glite_jp_attrval_t));
trio_asprintf(&av[0].value,"%d", h->status.children_num);
av[0].size = -1;
av[0].timestamp = h->status.lastUpdateTime.tv_sec;
- } else if (strcmp(attr, GLITE_JP_LB_lastStatusHistory) == 0) {
-/*
- av = calloc(1 + EDG_WLL_NUMBER_OF_STATCODES, sizeof(glite_jp_attrval_t));
- av[0].name = strdup(attr);
- av[0].value = check_strdup(h->status.reason);
- av[0].timestamp = h->status.stateEnterTime.tv_sec;
- av[0].size = -1;
- for (i=1; i<EDG_WLL_NUMBER_OF_STATCODES; i++) {
- av[i].name = strdup(attr);
- if (i == h->status.state) av[i].value = check_strdup(h->status.reason);
- av[i].timestamp = h->status.stateEnterTimes[i+1];
- av[i].size = -1;
+ } else if (strcmp(attr, GLITE_JP_LB_subjobs) == 0) {
+ if (h->status.children_num > 0) {
+ char *val = NULL, *old_val;
+
+ old_val = strdup ("");
+ for (i=0; i<h->status.children_num; i++) {
+ trio_asprintf(&val,"%s\t\t<jobId>%s</jobId>\n",
+ old_val, "");
+// FIXME: h->status.children[i] ? h->status.children[i] : "");
+ if (old_val) free(old_val);
+ old_val = val; val = NULL;
+ }
+ av = calloc(2, sizeof(glite_jp_attrval_t));
+ av[0].name = strdup(attr);
+ av[0].value = check_strdup(old_val);
+ av[0].size = -1;
+ av[0].timestamp = h->status.lastUpdateTime.tv_sec;
+ } else {
+ char et[BUFSIZ];
+ *attrval = NULL;
+ err.code = 0;
+ snprintf(et,sizeof et,"Value unknown for attribute '%s', there are no subjobs.",attr);
+ et[BUFSIZ-1] = 0;
+ err.desc = et;
+ return glite_jp_stack_error(ctx,&err);
}
-*/
- int j;
- i = 0; while (h->lastStatusHistory[i]) i++;
- av = calloc(i+2, sizeof(glite_jp_attrval_t));
- av[0].name = strdup(attr);
- av[0].value = check_strdup(h->status.reason);
- av[0].timestamp = h->status.stateEnterTime.tv_sec;
- av[0].size = -1;
+ } else if (strcmp(attr, GLITE_JP_LB_lastStatusHistory) == 0) {
+ int i,j;
+ char *val, *old_val, *s_str, *t_str, *r_str;
+ struct tm *t;
+
+ val = s_str = t_str = r_str = NULL;
+ old_val = strdup("");
+ t = calloc(1, sizeof(t));
+ /* first record is Submitted - hopefully in fullStatusHistory[0] */
if ((h->fullStatusHistory[0] &&
- (h->fullStatusHistory[0]->state == EDG_WLL_JOB_SUBMITTED)) ) {
- av[1].name = edg_wll_StatToString(h->fullStatusHistory[0]->state);
- av[1].value = check_strdup(h->fullStatusHistory[0]->reason);
- av[1].timestamp = h->fullStatusHistory[0]->timestamp.tv_sec;
- av[1].size = -1;
- j = 2;
- } else {
- j = 1;
+ (h->fullStatusHistory[0]->state == EDG_WLL_JOB_SUBMITTED)) ) {
+
+ s_str = edg_wll_StatToString(h->fullStatusHistory[0]->state);
+ for (j = 0; s_str[j]; j++) s_str[j] = toupper(s_str[j]);
+ if (gmtime_r(&h->fullStatusHistory[0]->timestamp.tv_sec,t) != NULL) {
+ /* dateTime format: yyyy-mm-ddThh:mm:ss:uuuuuu */
+ trio_asprintf(&t_str,"timestamp=\"%04d-%02d-%02dT%02d:%02d:%02d:%06d\" ",
+ 1900+t->tm_year, 1+t->tm_mon, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec,
+ h->fullStatusHistory[0]->timestamp.tv_usec);
+ }
+ if (h->fullStatusHistory[0]->reason) {
+ trio_asprintf(&r_str,"reason=\"%s\" ",h->fullStatusHistory[0]->reason);
+ }
+ trio_asprintf(&val,"%s\t\t<status name=\"%s\" %s%s/>\n",
+ old_val, s_str ? s_str : "", t_str ? t_str : "", r_str ? r_str : "");
+ if (s_str) free(s_str);
+ if (t_str) free(t_str);
+ if (r_str) free(t_str);
+ if (old_val) free(old_val);
+ old_val = val; val = NULL;
+ }
+ /* and the rest is from last Waiting to the end - i.e. all lastStatusHistory[] */
+ if (h->lastStatusHistory) {
+ i = 0;
+ while (h->lastStatusHistory[i]) {
+ s_str = edg_wll_StatToString(h->lastStatusHistory[i]->state);
+ for (j = 0; s_str[j]; j++) s_str[j] = toupper(s_str[j]);
+ if (gmtime_r(&h->lastStatusHistory[i]->timestamp.tv_sec,t) != NULL) {
+ /* dateTime format: yyyy-mm-ddThh:mm:ss:uuuuuu */
+ trio_asprintf(&t_str,"timestamp=\"%04d-%02d-%02dT%02d:%02d:%02d:%06d\" ",
+ 1900+t->tm_year, 1+t->tm_mon, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec,
+ h->lastStatusHistory[i]->timestamp.tv_usec);
+ }
+ if (h->lastStatusHistory[i]->reason) {
+ trio_asprintf(&r_str,"reason=\"%s\" ",h->lastStatusHistory[i]->reason);
+ }
+// FIXME: fails here for Dan's dumpfile, no idea why, all data are correct :(
+ trio_asprintf(&val,"%s\t\t<status name=\"%s\" %s%s/>\n",
+ old_val, s_str ? s_str : "", t_str ? t_str : "", r_str ? r_str : "");
+ if (s_str) free(s_str); s_str = NULL;
+ if (t_str) free(t_str); t_str = NULL;
+ if (r_str) free(r_str); r_str = NULL;
+// FIXME: if (old_val) free(old_val);
+ old_val = val; val = NULL;
+ i++;
+ }
+ }
+ val = old_val; old_val = NULL;
+ if (val) {
+ av = calloc(2, sizeof(glite_jp_attrval_t));
+ av[0].name = strdup(attr);
+ av[0].value = strdup(val);
+ av[0].size = -1;
+ av[0].timestamp = h->status.lastUpdateTime.tv_sec;
+// FIXME: free(val);
}
- i = 0;
- while (h->lastStatusHistory[i]) {
- av[j].name = edg_wll_StatToString(h->lastStatusHistory[i]->state);
- av[j].value = check_strdup(h->lastStatusHistory[i]->reason);
- av[j].timestamp = h->lastStatusHistory[i]->timestamp.tv_sec;
- av[j].size = -1;
- i++;
- j++;
- }
} else if (strcmp(attr, GLITE_JP_LB_fullStatusHistory) == 0) {
- i = 0; while (h->fullStatusHistory[i]) i++;
- av = calloc(i+1, sizeof(glite_jp_attrval_t));
- av[0].name = strdup(attr);
- av[0].value = check_strdup(h->status.reason);
- av[0].timestamp = h->status.stateEnterTime.tv_sec;
- av[0].size = -1;
+ int i,j;
+ char *val, *old_val, *s_str, *t_str, *r_str;
+ struct tm *t;
+
+ val = s_str = t_str = r_str = NULL;
+ old_val = strdup("");
+ t = calloc(1, sizeof(t));
i = 0;
while (h->fullStatusHistory[i]) {
- av[i+1].name = edg_wll_StatToString(h->fullStatusHistory[i]->state);
- av[i+1].value = check_strdup(h->fullStatusHistory[i]->reason);
- av[i+1].timestamp = h->fullStatusHistory[i]->timestamp.tv_sec;
- av[i+1].size = -1;
+ s_str = edg_wll_StatToString(h->fullStatusHistory[i]->state);
+ for (j = 0; s_str[j]; j++) s_str[j] = toupper(s_str[j]);
+ if (gmtime_r(&h->fullStatusHistory[i]->timestamp.tv_sec,t) != NULL) {
+ /* dateTime format: yyyy-mm-ddThh:mm:ss:uuuuuu */
+ trio_asprintf(&t_str,"timestamp=\"%04d-%02d-%02dT%02d:%02d:%02d:%06d\" ",
+ 1900+t->tm_year, 1+t->tm_mon, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec,
+ h->fullStatusHistory[i]->timestamp.tv_usec);
+ }
+ if (h->fullStatusHistory[i]->reason) {
+ trio_asprintf(&r_str,"reason=\"%s\" ",h->fullStatusHistory[i]->reason);
+ }
+// FIXME: fails here for Dan's dumpfile, no idea why, all data are correct :(
+ trio_asprintf(&val,"%s\t\t<status name=\"%s\" %s%s/>\n",
+ old_val, s_str ? s_str : "", t_str ? t_str : "", r_str ? r_str : "");
+ if (s_str) free(s_str); s_str = NULL;
+ if (t_str) free(t_str); t_str = NULL;
+ if (r_str) free(r_str); r_str = NULL;
+// FIXME: if (old_val) free(old_val);
+ old_val = val; val = NULL;
i++;
}
+ val = old_val; old_val = NULL;
+ if (val) {
+ av = calloc(2, sizeof(glite_jp_attrval_t));
+ av[0].name = strdup(attr);
+ av[0].value = strdup(val);
+ av[0].size = -1;
+ av[0].timestamp = h->status.lastUpdateTime.tv_sec;
+// FIXME: free(val);
+ }
} else if (strncmp(attr, GLITE_JP_LBTAG_NS, sizeof(GLITE_JP_LBTAG_NS)-1) == 0) {
tag = strrchr(attr, ':');
if (h->events && tag) {
while (h->events[i]) {
if ((h->events[i]->type == EDG_WLL_EVENT_USERTAG) &&
- (strcmp(h->events[i]->userTag.name, tag) == 0) ) {
+/* XXX: LB tag names are case-insensitive */
+ (strcasecmp(h->events[i]->userTag.name, tag) == 0) ) {
av = realloc(av, (n_tags+2) * sizeof(glite_jp_attrval_t));
memset(&av[n_tags], 0, 2 * sizeof(glite_jp_attrval_t));
i++;
}
} else {
+ char et[BUFSIZ];
*attrval = NULL;
err.code = EINVAL;
- trio_asprintf(&err.desc,"No such attribute '%s'.",attr);
+ snprintf(et,sizeof et,"No such attribute '%s'.",attr);
+ et[BUFSIZ-1] = 0;
+ err.desc = et;
return glite_jp_stack_error(ctx,&err);
}
*attrval = av;
return 0;
} else {
+ char et[BUFSIZ];
*attrval = NULL;
err.code = ENOENT;
- trio_asprintf(&err.desc,"Value unknown for attribute '%s'.",attr);
- if (av) glite_jp_attrval_free(av,1); // probably not needed
+ snprintf(et,sizeof et,"Value unknown for attribute '%s'.",attr);
+ et[BUFSIZ-1] = 0;
+ err.desc = et;
+ if (av) glite_jp_attrval_free(av,1); // XXX: probably not needed
return glite_jp_stack_error(ctx,&err);
}
}
maxnstates = INITIAL_NUMBER_STATES;
nstates = 0;
h->fullStatusHistory = calloc(maxnstates, sizeof(lb_historyStatus *));
+ h->lastStatusHistory = NULL;
i = 0;
while (h->events[i])
{
h->fullStatusHistory[nstates]->timestamp.tv_usec = js->pub.stateEnterTime.tv_usec;
h->fullStatusHistory[nstates]->reason = check_strdup(js->pub.reason);
if (js->pub.state == EDG_WLL_JOB_WAITING) {
- h->lastStatusHistory = &h->fullStatusHistory[nstates];
+ h->lastStatusHistory = &(h->fullStatusHistory[nstates]);
}
old_state = js->pub.state;
nstates++;
i++;
}
+ h->fullStatusHistory[nstates] = NULL;
memcpy(&h->status, &js->pub, sizeof(edg_wll_JobStat));
e->enQueued.host,
e->enQueued.src_instance);
if (e->enQueued.source == EDG_WLL_SOURCE_LOG_MONITOR)
- js->pub.resubmitted = 1;
+ js->pub.resubmitted += 1;
} else {
js->pub.location = location_string(
edg_wll_SourceToString(e->enQueued.source),
int i,parse = 0,dumpfile = -1;
edg_wlc_JobId job;
char *message = NULL, *response = NULL;
- char *tmpfname;
+ char *tmpfname = NULL;
int naffected_jobs = 0;
edg_wll_PurgeResult result;
int ret = HTTP_OK;
-module.version = 1.2.0
+module.version = 1.1.1
module.age = 0
--- /dev/null
+/*
+ * load and test L&B plugin
+ *
+ * (requires -rdynamic to use fake JP backend symbols)
+ */
+
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <time.h>
+#include <dlfcn.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <getopt.h>
+
+#include "glite/jp/types.h"
+#include "glite/jp/context.h"
+#include "glite/jp/backend.h"
+#include "glite/jp/file_plugin.h"
+#include "glite/jp/known_attr.h"
+#include "glite/jp/attr.h"
+#include "glite/lb/jp_job_attrs.h"
+
+
+typedef int init_f(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data);
+typedef void done_f(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data);
+
+static const char rcsid[] = "@(#)$$";
+static int verbose = 0;
+static char *file = NULL;
+
+static struct option const long_options[] = {
+ { "file", required_argument, 0, 'f' },
+ { "help", no_argument, 0, 'h' },
+ { "verbose", no_argument, 0, 'v' },
+ { "version", no_argument, 0, 'V' },
+ { NULL, 0, NULL, 0}
+};
+
+/*
+ * usage
+ */
+static void
+usage(char *program_name) {
+ fprintf(stdout,"LB statistics\n"
+ "- reads a dump file (one job only) \n"
+ "- and outputs an XML with statistics to stdout \n\n"
+ "Usage: %s [option]\n"
+ "-h, --help display this help and exit\n"
+ "-V, --version output version information and exit\n"
+ "-v, --verbose print extensive debug output\n"
+ "-f, --file <file> port to listen\n\n",
+ program_name);
+}
+
+/*
+ * substitute implementatin of JP backend
+ */
+
+int glite_jppsbe_pread(glite_jp_context_t ctx, void *handle, void *buf, size_t nbytes, off_t offset, ssize_t *nbytes_ret) {
+ FILE *f;
+
+ f = (FILE *)handle;
+ if (fseek(f, offset, SEEK_SET) != 0) {
+ *nbytes_ret = 0;
+ return 0;
+ }
+ *nbytes_ret = fread(buf, 1, nbytes, f);
+
+ return ferror(f) ? 1 : 0;
+}
+
+
+int glite_jp_stack_error(glite_jp_context_t ctx, const glite_jp_error_t *jperror) {
+ printf("JP backend error %d: %s\n", jperror->code, jperror->desc);
+ return 0;
+}
+
+
+int glite_jp_clear_error(glite_jp_context_t ctx) {
+ return 0;
+}
+
+
+/*
+ * free the array of JP attr
+ */
+static void free_attrs(glite_jp_attrval_t *av) {
+ glite_jp_attrval_t *item;
+
+ item = av;
+ while (item->name) {
+ glite_jp_attrval_free(item++, 0);
+ }
+ free(av);
+}
+
+/*
+ * main
+ */
+int main(int argc, char *argv[])
+{
+ glite_jp_context_t jpctx;
+ glite_jpps_fplug_data_t plugin_data;
+ void *data_handle, *lib_handle;
+ FILE *f;
+ glite_jp_attrval_t *attrval;
+ char *err;
+ init_f *plugin_init;
+ done_f *plugin_done;
+ int opt;
+
+ /* get arguments */
+ while ((opt = getopt_long(argc,argv,
+ "f:" /* file */
+ "h" /* help */
+ "v" /* verbose */
+ "V", /* version */
+ long_options, (int *) 0)) != EOF) {
+
+ switch (opt) {
+ case 'V': fprintf(stdout,"%s:\t%s\n",argv[0],rcsid); return(0);
+ case 'v': verbose = 1; break;
+ case 'f': file = optarg; break;
+ case 'h':
+ default:
+ usage(argv[0]); return(0);
+ }
+ }
+
+ /* load L&B plugin and its 'init' symbol */
+ if ((lib_handle = dlopen("glite_lb_plugin.so", RTLD_LAZY)) == NULL) {
+ err = dlerror() ? :"unknown error";
+ printf("can't load L&B plugin (%s)\n", err);
+ return 1;
+ }
+ if ((plugin_init = dlsym(lib_handle, "init")) == NULL ||
+ (plugin_done = dlsym(lib_handle, "done")) == NULL) {
+ err = dlerror() ? :"unknown error";
+ printf("can't find symbol 'init' or 'done' (%s)\n", err);
+ goto err;
+ }
+
+ /* dump file with events */
+ if ((f = fopen(file, "rt")) == NULL) {
+ printf("Error: %s\n", strerror(errno));
+ goto err;
+ }
+
+ /* use the plugin */
+ plugin_init(jpctx, &plugin_data);
+ plugin_data.ops.open(jpctx, f, "uri://", &data_handle);
+
+ if (data_handle) {
+ /* header */
+ printf("<?xml version=\"1.0\"?>");
+ printf("<lbd:jobRecord");
+ printf("\txmlns:lbd=\"http://glite.org/wsdl/types/lbdump\"\n");
+
+ /* jobid */
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_ATTR_JOBID, &attrval);
+ if (attrval) {
+ printf("\tjobid=\"%s\"\n>\n", attrval->value);
+ free_attrs(attrval);
+ } else {
+ printf("\tjobid=\"default\"\n>\n");
+ }
+ printf(">\n");
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_ATTR_OWNER, &attrval);
+ if (attrval) {
+ printf("\t<user>%s</user>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_aTag, &attrval);
+ if (attrval) {
+ printf("\t<aTag>%s</aTag>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_rQType, &attrval);
+ if (attrval) {
+ printf("\t<rQType>%s</rQType>\n", ctime(&attrval->timestamp));
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_eDuration, &attrval);
+ if (attrval) {
+ printf("\t<eDuration>%s</eDuration>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_eNodes, &attrval);
+ if (attrval) {
+ printf("\t<eNodes>%s</eNodes>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_eProc, &attrval);
+ if (attrval) {
+ printf("\t<eProc>%s</eProc>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_RB, &attrval);
+ if (attrval) {
+ printf("\t<RB>%s</RB>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_CE, &attrval);
+ if (attrval) {
+ printf("\t<CE>%s</CE>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_host, &attrval);
+ if (attrval) {
+ printf("\t<host>%s</host>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_UIHost, &attrval);
+ if (attrval) {
+ printf("\t<UIHost>%s</UIHost>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_CPUTime, &attrval);
+ if (attrval) {
+ printf("\t<CPUTime>%s</CPUTime>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_NProc, &attrval);
+ if (attrval) {
+ printf("\t<NProc>%s</NProc>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_finalStatus, &attrval);
+ if (attrval) {
+ printf("\t<finalStatus>%s</finalStatus>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_finalStatusDate, &attrval);
+ if (attrval) {
+ printf("\t<finalStatusDate>%s</finalStatusDate>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_finalStatusReason, &attrval);
+ if (attrval) {
+ printf("\t<finalStatusReason>%s</finalStatusReason>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_LRMSDoneStatus, &attrval);
+ if (attrval) {
+ printf("\t<LRMSDoneStatus>%s</LRMSDoneStatus>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_LRMSStatusReason, &attrval);
+ if (attrval) {
+ printf("\t<LRMSStatusReason>%s</LRMSStatusReason>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_retryCount, &attrval);
+ if (attrval) {
+ printf("\t<retryCount>%s</retryCount>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_additionalReason, &attrval);
+ if (attrval) {
+ printf("\t<additionalReason>%s</additionalReason>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_jobType, &attrval);
+ if (attrval) {
+ printf("\t<jobType>%s</jobType>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_nsubjobs, &attrval);
+ if (attrval) {
+ printf("\t<nsubjobs>%s</nsubjobs>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_lastStatusHistory, &attrval);
+ if (attrval) {
+ printf("\t<lastStatusHistory>%s</lastStatusHistory>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_fullStatusHistory, &attrval);
+ if (attrval) {
+ printf("\t<fullStatusHistory>%s</fullStatusHistory>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ printf("</lbd:jobRecord>\n");
+
+ plugin_data.ops.close(jpctx, data_handle);
+ }
+ plugin_done(jpctx, &plugin_data);
+
+ fclose(f);
+ dlclose(lib_handle);
+ return 0;
+
+err:
+ dlclose(lib_handle);
+ return 1;
+}
static const char rcsid[] = "@(#)$Id$";
static int verbose = 0;
-static char *file = NULL;
+static char *infilename = NULL;
+static char *outfilename = NULL;
static int jdl = 0;
static struct option const long_options[] = {
{ "file", required_argument, 0, 'f' },
+ { "outfile", required_argument, 0, 'o' },
{ "jdl", no_argument, 0, 'j' },
{ "help", no_argument, 0, 'h' },
{ "verbose", no_argument, 0, 'v' },
static void
usage(char *program_name) {
fprintf(stdout,"LB statistics\n"
- "- reads a dump file (one job only) \n"
+ "- reads a dump file (one job only!) \n"
"- and outputs an XML with statistics to stdout \n\n"
"Usage: %s [option]\n"
"-h, --help display this help and exit\n"
"-V, --version output version information and exit\n"
"-v, --verbose print extensive debug output to stderr\n"
"-f, --file <file> dump file to process\n"
+ "-o, --outfile <file> output filename\n"
"-j, --jdl prit also JDL in the XML\n\n",
program_name);
}
glite_jp_context_t jpctx;
glite_jpps_fplug_data_t plugin_data;
void *data_handle, *lib_handle;
- FILE *f;
+ FILE *infile,*outfile = NULL;
glite_jp_attrval_t *attrval;
char *err;
init_f *plugin_init;
/* get arguments */
while ((opt = getopt_long(argc,argv,
- "f:" /* file */
+ "f:" /* input file */
+ "o:" /* output file */
"j" /* jdl */
"h" /* help */
"v" /* verbose */
switch (opt) {
case 'V': fprintf(stdout,"%s:\t%s\n",argv[0],rcsid); return(0);
case 'v': verbose = 1; break;
- case 'f': file = optarg; break;
+ case 'f': infilename = optarg; break;
+ case 'o': outfilename = optarg; break;
case 'j': jdl = 1; break;
case 'h':
default:
(plugin_done = dlsym(lib_handle, "done")) == NULL) {
err = dlerror() ? : "unknown error";
fprintf(stderr,"lb_statistics: can't find symbol 'init' or 'done' (%s)\n", err);
- goto err;
+ dlclose(lib_handle);
+ return 1;
}
/* dump file with events */
- if ((f = fopen(file, "rt")) == NULL) {
- fprintf(stderr,"lb_statistics: Error: %s\n", strerror(errno));
- goto err;
+ if ((infile = fopen(infilename, "rt")) == NULL) {
+ fprintf(stderr,"lb_statistics: Error opening file %s: %s\n", infilename, strerror(errno));
+ dlclose(lib_handle);
+ return 1;
+ }
+
+ /* output filename */
+ if (outfilename) {
+ if ((outfile = fopen(outfilename, "wt")) == NULL) {
+ fprintf(stderr,"lb_statistics: Error opening file %s: %s\n", outfilename, strerror(errno));
+ dlclose(lib_handle);
+ fclose(infile);
+ }
+ } else {
+ outfile = stdout;
}
/* use the plugin */
plugin_init(jpctx, &plugin_data);
- plugin_data.ops.open(jpctx, f, "uri://", &data_handle);
+ plugin_data.ops.open(jpctx, infile, "uri://", &data_handle);
if (data_handle) {
- /* header */
- fprintf(stdout,"<?xml version=\"1.0\"?>\n\n");
- fprintf(stdout,"<lbd:jobRecord\n");
- fprintf(stdout,"\txmlns:lbd=\"http://glite.org/wsdl/types/lbdump\"\n");
+ /* <header> */
+ fprintf(outfile,"<?xml version=\"1.0\"?>\n\n");
+ fprintf(outfile,"<lbd:jobRecord\n");
+ fprintf(outfile,"\txmlns:lbd=\"http://glite.org/wsdl/types/lbdump\"\n");
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_jobId, &attrval);
if (attrval) {
- fprintf(stdout,"\tjobid=\"%s\"\n", attrval->value);
+ fprintf(outfile,"\tjobid=\"%s\"\n", attrval->value);
free_attrs(attrval);
} else {
- fprintf(stdout,"\tjobid=\"default\"\n");
+ fprintf(outfile,"\tjobid=\"default\"\n");
}
- fprintf(stdout,">\n");
- /* /header */
+ fprintf(outfile,">\n");
+ /* </header> */
+ /* <body> */
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_user, &attrval);
if (attrval) {
- fprintf(stdout,"\t<user>%s</user>\n", attrval->value);
+ fprintf(outfile,"\t<user>%s</user>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_parent, &attrval);
+ if (attrval) {
+ fprintf(outfile,"\t<parent>%s</parent>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_VO, &attrval);
+ if (attrval) {
+ fprintf(outfile,"\t<VO>%s</VO>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_aTag, &attrval);
if (attrval) {
- fprintf(stdout,"\t<aTag>%s</aTag>\n", attrval->value);
+ fprintf(outfile,"\t<aTag>%s</aTag>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_rQType, &attrval);
if (attrval) {
- fprintf(stdout,"\t<rQType>%s</rQType>\n", ctime(&attrval->timestamp));
+ fprintf(outfile,"\t<rQType>%s</rQType>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_eDuration, &attrval);
if (attrval) {
- fprintf(stdout,"\t<eDuration>%s</eDuration>\n", attrval->value);
+ fprintf(outfile,"\t<eDuration>%s</eDuration>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_eNodes, &attrval);
if (attrval) {
- fprintf(stdout,"\t<eNodes>%s</eNodes>\n", attrval->value);
+ fprintf(outfile,"\t<eNodes>%s</eNodes>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_eProc, &attrval);
if (attrval) {
- fprintf(stdout,"\t<eProc>%s</eProc>\n", attrval->value);
+ fprintf(outfile,"\t<eProc>%s</eProc>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_RB, &attrval);
if (attrval) {
- fprintf(stdout,"\t<RB>%s</RB>\n", attrval->value);
+ fprintf(outfile,"\t<RB>%s</RB>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_CE, &attrval);
if (attrval) {
- fprintf(stdout,"\t<CE>%s</CE>\n", attrval->value);
+ fprintf(outfile,"\t<CE>%s</CE>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_host, &attrval);
if (attrval) {
- fprintf(stdout,"\t<host>%s</host>\n", attrval->value);
+ fprintf(outfile,"\t<host>%s</host>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_UIHost, &attrval);
if (attrval) {
- fprintf(stdout,"\t<UIHost>%s</UIHost>\n", attrval->value);
+ fprintf(outfile,"\t<UIHost>%s</UIHost>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_CPUTime, &attrval);
if (attrval) {
- fprintf(stdout,"\t<CPUTime>%s</CPUTime>\n", attrval->value);
+ fprintf(outfile,"\t<CPUTime>%s</CPUTime>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_NProc, &attrval);
if (attrval) {
- fprintf(stdout,"\t<NProc>%s</NProc>\n", attrval->value);
+ fprintf(outfile,"\t<NProc>%s</NProc>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_finalStatus, &attrval);
if (attrval) {
- fprintf(stdout,"\t<finalStatus>%s</finalStatus>\n", attrval->value);
+ fprintf(outfile,"\t<finalStatus>%s</finalStatus>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_finalStatusDate, &attrval);
if (attrval) {
- fprintf(stdout,"\t<finalStatusDate>%s</finalStatusDate>\n", attrval->value);
+ fprintf(outfile,"\t<finalStatusDate>%s</finalStatusDate>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_finalStatusReason, &attrval);
if (attrval) {
- fprintf(stdout,"\t<finalStatusReason>%s</finalStatusReason>\n", attrval->value);
+ fprintf(outfile,"\t<finalStatusReason>%s</finalStatusReason>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_LRMSDoneStatus, &attrval);
if (attrval) {
- fprintf(stdout,"\t<LRMSDoneStatus>%s</LRMSDoneStatus>\n", attrval->value);
+ fprintf(outfile,"\t<LRMSDoneStatus>%s</LRMSDoneStatus>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_LRMSStatusReason, &attrval);
if (attrval) {
- fprintf(stdout,"\t<LRMSStatusReason>%s</LRMSStatusReason>\n", attrval->value);
+ fprintf(outfile,"\t<LRMSStatusReason>%s</LRMSStatusReason>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_retryCount, &attrval);
if (attrval) {
- fprintf(stdout,"\t<retryCount>%s</retryCount>\n", attrval->value);
+ fprintf(outfile,"\t<retryCount>%s</retryCount>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_additionalReason, &attrval);
if (attrval) {
- fprintf(stdout,"\t<additionalReason>%s</additionalReason>\n", attrval->value);
+ fprintf(outfile,"\t<additionalReason>%s</additionalReason>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_jobType, &attrval);
if (attrval) {
- fprintf(stdout,"\t<jobType>%s</jobType>\n", attrval->value);
+ fprintf(outfile,"\t<jobType>%s</jobType>\n", attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_nsubjobs, &attrval);
if (attrval) {
- fprintf(stdout,"\t<nsubjobs>%s</nsubjobs>\n", attrval->value);
+ fprintf(outfile,"\t<nsubjobs>%s</nsubjobs>\n", attrval->value);
+ free_attrs(attrval);
+ }
+
+ plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_subjobs, &attrval);
+ if (attrval) {
+ fprintf(outfile,"\t<subjobs>\n%s\t</subjobs>\n", attrval->value);
free_attrs(attrval);
}
+/* FIXME: */
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_lastStatusHistory, &attrval);
if (attrval) {
- fprintf(stdout,"\t<lastStatusHistory>\n");
-/*
- for (i = 1; i < EDG_WLL_NUMBER_OF_STATCODES; i++) {
- char *stat = edg_wll_StatToString(i);
- fprintf(stdout,"\t<status>\n");
- fprintf(stdout,"\t\t<status>%s</status>\n", stat);
- fprintf(stdout,"\t\t<timestamp>%ld.%06ld</timestamp>\n", attrval[i].timestamp,0);
- fprintf(stdout,"\t\t<reason>%s</reason>\n", attrval[i].value ? attrval[i].value : "");
- fprintf(stdout,"\t</status>\n");
- if (stat) free(stat);
- }
-*/
- i = 1;
- while (attrval[i].name) {
- fprintf(stdout,"\t<status>\n");
- fprintf(stdout,"\t\t<status>%s</status>\n", attrval[i].name);
- fprintf(stdout,"\t\t<timestamp>%ld.%06ld</timestamp>\n", attrval[i].timestamp,0);
- fprintf(stdout,"\t\t<reason>%s</reason>\n", attrval[i].value ? attrval[i].value : "");
- fprintf(stdout,"\t</status>\n");
- i++;
- }
- fprintf(stdout,"\t</lastStatusHistory>\n");
+ fprintf(outfile,"\t<lastStatusHistory>\n%s\t</lastStatusHistory>\n",attrval->value);
free_attrs(attrval);
}
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_fullStatusHistory, &attrval);
if (attrval) {
- fprintf(stdout,"\t<fullStatusHistory>\n");
- i = 1;
- while (attrval[i].name) {
- fprintf(stdout,"\t<status>\n");
- fprintf(stdout,"\t\t<status>%s</status>\n", attrval[i].name);
- fprintf(stdout,"\t\t<timestamp>%ld.%06ld</timestamp>\n", attrval[i].timestamp,0);
- fprintf(stdout,"\t\t<reason>%s</reason>\n", attrval[i].value ? attrval[i].value : "");
- fprintf(stdout,"\t</status>\n");
- i++;
- }
- fprintf(stdout,"\t</fullStatusHistory>\n");
+ fprintf(outfile,"\t<fullStatusHistory>\n%s\t</fullStatusHistory>\n",attrval->value);
free_attrs(attrval);
}
+
if (jdl) {
plugin_data.ops.attr(jpctx, data_handle, GLITE_JP_LB_JDL, &attrval);
if (attrval) {
- fprintf(stdout,"\t<JDL>%s</JDL>\n", attrval->value);
+ fprintf(outfile,"\t<JDL>%s</JDL>\n", attrval->value);
free_attrs(attrval);
}
}
- fprintf(stdout,"</lbd:jobRecord>\n");
+ fprintf(outfile,"</lbd:jobRecord>\n");
+ /* </body> */
plugin_data.ops.close(jpctx, data_handle);
}
plugin_done(jpctx, &plugin_data);
- fclose(f);
+ fclose(infile);
+ if (outfile) fclose(outfile);
dlclose(lib_handle);
return 0;
-
-err:
- dlclose(lib_handle);
- return 1;
}
#Fri Sep 02 14:16:49 CEST 2005
# glite-lb-ws-interface_branch_3_0_0_RC15 tak is taken!
-module.version=2.3.0
+module.version=2.2.1
module.age=0
# System dependencies
###################################################################
-org.glite.version = HEAD
-org.glite.lb.version = HEAD
+org.glite.version = glite_branch_3_1_0
+org.glite.lb.version = glite-lb_branch_1_3_0_RC31
# Component dependencies tag = do not remove this line =
-org.glite.lb.client-interface.version = HEAD
-org.glite.lb.ws-interface.version = HEAD
-org.glite.lb.common.version = HEAD
-org.glite.lb.client.version = HEAD
-org.glite.lb.server.version = HEAD
-org.glite.lb.proxy.version = HEAD
-org.glite.lb.server-bones.version = HEAD
-org.glite.lb.logger.version = HEAD
-org.glite.lb.utils.version = HEAD
+org.glite.lb.client-interface.version = glite-lb-client-interface_branch_2_2_0_RC31
+org.glite.lb.ws-interface.version = glite-lb-ws-interface_branch_2_2_0_RC31
+org.glite.lb.common.version = glite-lb-common_branch_3_1_0_RC31
+org.glite.lb.client.version = glite-lb-client_branch_2_2_0_RC31
+org.glite.lb.server.version = glite-lb-server_branch_1_4_0_RC31
+org.glite.lb.proxy.version = glite-lb-proxy_branch_1_3_0_RC31
+org.glite.lb.server-bones.version = glite-lb-server-bones_branch_2_2_0_RC31
+org.glite.lb.logger.version = glite-lb-logger_branch_1_3_0_RC31
+org.glite.lb.utils.version = glite-lb-utils_branch_1_1_0_RC31
ext.gsoap.version = 2.7.0
#Fri Sep 02 14:19:10 CEST 2005
-module.version=1.4.0
+module.version=1.3.3
module.age=0