- standalone wrapper on edg_wll_GenerateSubjobIds()
authorAleš Křenek <ljocha@ics.muni.cz>
Wed, 6 Sep 2006 16:25:40 +0000 (16:25 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Wed, 6 Sep 2006 16:25:40 +0000 (16:25 +0000)
- job_reg -e seed

org.glite.lb.client/Makefile
org.glite.lb.client/examples/dagids.c [new file with mode: 0644]
org.glite.lb.client/examples/job_reg.c
org.glite.lb.client/examples/ulmfields.pl

index cec8b5a..b3a9f14 100644 (file)
@@ -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 (file)
index 0000000..d45b90f
--- /dev/null
@@ -0,0 +1,61 @@
+#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;
+}
index 2512ef8..1151898 100644 (file)
@@ -14,12 +14,12 @@ extern int opterr,optind;
 
 static void usage(char *me)
 {
-       fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S]]\n", me);
+       fprintf(stderr,"usage: %s [-m bkserver] [-x] [-j dg_jobid] [-s source_id] [-n num_subjobs [-S]] [-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;
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
        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;
@@ -38,6 +38,7 @@ int main(int argc, char *argv[])
                        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;
                }
@@ -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);
index fcf7f83..05c4e6e 100644 (file)
@@ -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";