From b78dcf8d8501f590bfbbc588088e0519e7e90612 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Wed, 6 Sep 2006 16:25:40 +0000 Subject: [PATCH] - standalone wrapper on edg_wll_GenerateSubjobIds() - job_reg -e seed --- org.glite.lb.client/Makefile | 2 +- org.glite.lb.client/examples/dagids.c | 61 +++++++++++++++++++++++++++++++ org.glite.lb.client/examples/job_reg.c | 11 +++--- org.glite.lb.client/examples/ulmfields.pl | 2 +- 4 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 org.glite.lb.client/examples/dagids.c diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index cec8b5a..b3a9f14 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -129,7 +129,7 @@ PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la TOOLS:=dump load purge lb_dump_exporter -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 +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 EXAMPLES_CL=user_jobs job_status FAKE_EXAMPLES:=job_log_fake diff --git a/org.glite.lb.client/examples/dagids.c b/org.glite.lb.client/examples/dagids.c new file mode 100644 index 0000000..d45b90f --- /dev/null +++ b/org.glite.lb.client/examples/dagids.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include +#include +#include + +#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; i0) { 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; } @@ -88,7 +89,7 @@ int main(int argc, char *argv[]) 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); @@ -99,7 +100,7 @@ int main(int argc, char *argv[]) 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); diff --git a/org.glite.lb.client/examples/ulmfields.pl b/org.glite.lb.client/examples/ulmfields.pl index fcf7f83..05c4e6e 100644 --- a/org.glite.lb.client/examples/ulmfields.pl +++ b/org.glite.lb.client/examples/ulmfields.pl @@ -26,6 +26,6 @@ for $f (@F) { $f{$P[0]} = $P[1]; for $f (@pf) { - print "$f=$f{$f}\n"; + print "$f=$f{$f}\n" if $f{$f}; } print "\n"; -- 1.8.2.3