a few tweaks towards cream jobs
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 8 Sep 2009 17:18:46 +0000 (17:18 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 8 Sep 2009 17:18:46 +0000 (17:18 +0000)
org.glite.lb.client/Makefile
org.glite.lb.client/examples/cream_pending.l [new file with mode: 0644]
org.glite.lb.client/examples/cream_registered.l [new file with mode: 0644]
org.glite.lb.client/examples/gen_sample_job
org.glite.lb.client/examples/job_reg.c
org.glite.lb.client/src/logevent.c.T
org.glite.lb.common/interface/context.h
org.glite.lb.common/src/context.c
org.glite.lb.state-machine/src/process_event.c

index e0f05da..f070c89 100644 (file)
@@ -56,6 +56,8 @@ l_SRC = \
        failed_subjob.l \
        aborted.l \
        cancelled.l \
+       cream_registered.l \
+       cream_pending.l
 
 # TODO: missing resubmission_deep
 #      shallow_resub_complex.l shallow_resub_simple.l shallow_resub_simple2.l \
diff --git a/org.glite.lb.client/examples/cream_pending.l b/org.glite.lb.client/examples/cream_pending.l
new file mode 100644 (file)
index 0000000..6228485
--- /dev/null
@@ -0,0 +1,6 @@
+# macro definition for WAITING state
+
+:cream_registered:
+
+-s CreamCore,-e CREAMStart
+-s CreamCore,-e CREAMStore,--command=CMDSTART,--result=START
diff --git a/org.glite.lb.client/examples/cream_registered.l b/org.glite.lb.client/examples/cream_registered.l
new file mode 100644 (file)
index 0000000..d8960a2
--- /dev/null
@@ -0,0 +1,2 @@
+# only job registration needed for submitted state
+
index c24dc1c..3ea9a7e 100755 (executable)
@@ -96,6 +96,16 @@ awk -F, $NESTED \
 /-e ReallyRunning/     { if (checkNOP(3) == 0) logit(); 
                        next;}
 
+/-e CREAMStart/        { logit(); next;}
+/-e CREAMStore/        { logit(); next;}
+/-e CREAMPurge/        { logit(); next;}
+/-e CREAMCall/ { logit(); next;}
+/-e CREAMRunning/      { logit(); next;}
+/-e CREAMReallyRunning/        { logit(); next;}
+/-e CREAMDone/ { logit(); next;}
+/-e CREAMCancel/       { logit(); next;}
+/-e CREAMAbort/        { logit(); next;}
+
 # shell escape (for sequence number branching)
 
 /^!/           { print substr($0,2,(length($0) - 1)); }
index 2a411c3..1417c73 100644 (file)
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
 {
        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, collection = 0, pbs=0;
+       int done = 0,num_subjobs = 0,reg_subjobs = 0,i, collection = 0, pbs=0, cream=0, type;
        edg_wll_Context ctx;
        edg_wlc_JobId   jobid,*subjobs;
 
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
        opterr = 0;
 
        do {
-               switch (getopt(argc,argv,"xX:s:j:m:n:SCl:e:P")) {
+               switch (getopt(argc,argv,"xX:s:j:m:n:SCl:e:Pc")) {
                        case 'x': lbproxy = 1; break;
                        case 'X': lbproxy = 1; 
                                  edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, optarg);
@@ -42,6 +42,7 @@ int main(int argc, char *argv[])
                        case 'S': reg_subjobs = 1; break;
                        case 'C': collection = 1; break;
                        case 'P': pbs = 1; break;
+                       case 'c': cream = 1; break;
                        case 'l': jdl = (char *) strdup(optarg); break;
                        case 'e': seed = strdup(optarg); break;
                        case '?': usage(argv[0]); exit(EINVAL);
@@ -95,13 +96,17 @@ int main(int argc, char *argv[])
        }
 
        edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,edg_wll_StringToSource(src));
-       if (lbproxy) {
-               if (edg_wll_RegisterJobProxy(ctx,jobid,
-                       pbs ? EDG_WLL_REGJOB_PBS
-                           : (num_subjobs ? 
-                               (collection?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_DAG) 
+
+       type = pbs ? EDG_WLL_REGJOB_PBS
+               : (cream ? EDG_WLL_REGJOB_CREAM
+                       : (num_subjobs ?
+                               (collection?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_DAG)
                                :EDG_WLL_REGJOB_SIMPLE
-                               ),
+                         )
+                 );
+
+       if (lbproxy) {
+               if (edg_wll_RegisterJobProxy(ctx,jobid,type,
                        jdl ? jdl : "blabla", "NS",
                        num_subjobs,seed,&subjobs))
                {
@@ -111,12 +116,7 @@ int main(int argc, char *argv[])
                        exit(1);
                }
        } else {
-               if (edg_wll_RegisterJobSync(ctx,jobid,
-                       pbs ? EDG_WLL_REGJOB_PBS
-                           : (num_subjobs ? 
-                               (collection?EDG_WLL_REGJOB_COLLECTION:EDG_WLL_REGJOB_DAG) 
-                               :EDG_WLL_REGJOB_SIMPLE
-                               ),
+               if (edg_wll_RegisterJobSync(ctx,jobid,type,
                        jdl ? jdl : "blabla", "NS",
                        num_subjobs,seed,&subjobs))
                {
index 2286b23..190d303 100644 (file)
@@ -26,6 +26,8 @@
 // undefine to disable support for -l option
 #define ENABLE_REASON_LENGTH
 
+static int flesh_seq(int);
+
 int main(int argc, char *argv[])
 {
        char    /* *fmt,*fname = NULL,*/ *fmt_arg=NULL;
@@ -45,6 +47,7 @@ int main(int argc, char *argv[])
         edg_wll_Source src;
        edg_wll_EventCode event = EDG_WLL_EVENT_UNDEF;
        edg_wlc_JobId jobid = 0;
+       int seq = EDG_WLL_SEQ_NORMAL;
         int (*logev)(edg_wll_Context context,
                     edg_wll_EventCode event,
                     char *fmt, ...);
@@ -161,6 +164,8 @@ int main(int argc, char *argv[])
        edg_wll_SetParam(ctx, EDG_WLL_PARAM_LEVEL,
                         (deb) ? EDG_WLL_LEVEL_DEBUG : EDG_WLL_LEVEL_SYSTEM);
 
+       seq = flesh_seq(event);
+
        if ( use_lbproxy ) {
                if ( !lbproxy_user ) {
                        edg_wll_GssCred         gss_cred = NULL;
@@ -173,14 +178,14 @@ int main(int argc, char *argv[])
                }
                if ( lbproxy_store_sock )
                        edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, lbproxy_store_sock);
-               if (edg_wll_SetLoggingJobProxy(ctx,jobid,code,lbproxy_user,EDG_WLL_SEQ_NORMAL)) {
+               if (edg_wll_SetLoggingJobProxy(ctx,jobid,code,lbproxy_user,seq)) {
                        char    *et,*ed;
                        edg_wll_Error(ctx,&et,&ed);
                        fprintf(stderr,"SetLoggingJobProxy(%s,%s,%s): %s (%s)\n",jobid_s,code,lbproxy_user,et,ed);
                        exit(1);
                }
        } else {
-               if (edg_wll_SetLoggingJob(ctx,jobid,code,EDG_WLL_SEQ_NORMAL)) {
+               if (edg_wll_SetLoggingJob(ctx,jobid,code,seq)) {
                        char    *et,*ed;
                        edg_wll_Error(ctx,&et,&ed);
                        fprintf(stderr,"SetLoggingJob(%s,%s): %s (%s)\n",jobid_s,code,et,ed);
@@ -188,7 +193,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       if (noinc) edg_wll_SetSequenceCode(ctx,code,EDG_WLL_SEQ_NORMAL);
+       if (noinc) edg_wll_SetSequenceCode(ctx,code,seq);
 
 #ifdef ENABLE_REASON_LENGTH
        if (elength > 200000000) {
@@ -299,3 +304,23 @@ gen qq{\t    //edg_wll_Log$t();
 
        return err;
 }
+
+static int flesh_seq(int event)
+{
+       switch (event) {
+@@@{
+       %seq = ( CREAM => 'CREAM', 'PBS' => 'PBS', 'gLite' => 'NORMAL', Condor=>'CONDOR' );
+       for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
+              $event->getTypes)
+       {
+               selectType $event $t;
+
+               my $type = uc $t;
+               my $sf = $seq{$event->{flesh}->{$t}};
+
+               print "\t\tcase EDG_WLL_EVENT_$type: return EDG_WLL_SEQ_$sf;\n";
+       }
+@@@}
+       default: return -1;
+       }
+}
index 29b103d..91debbb 100644 (file)
@@ -240,6 +240,7 @@ edg_wll_QueryResults edg_wll_StringToQResult(const char *name);
 #define EDG_WLL_SEQ_DUPLICATE   11
 #define EDG_WLL_SEQ_PBS                2
 #define EDG_WLL_SEQ_CONDOR     3
+#define EDG_WLL_SEQ_CREAM      4
 
 /**
  * initial sequence code for BigHelper
index fe09148..2792837 100644 (file)
@@ -279,6 +279,8 @@ static const char* const srcNames[] = {
        "LRMS",
        "Application",
        "LBServer",
+       "CreamCore",
+       "BLAH",
 };
 
 edg_wll_Source edg_wll_StringToSource(const char *name)
@@ -351,6 +353,9 @@ char *edg_wll_GetSequenceCode(const edg_wll_Context ctx)
                case EDG_WLL_SEQ_CONDOR:
                        ret = strdup(ctx->p_seqcode.condor);
                        break;
+               case EDG_WLL_SEQ_CREAM:
+                       ret = strdup("");       /* XXX: not yet */
+                       break;
                default:
                        edg_wll_SetError(ctx,EINVAL,"edg_wll_GetSequenceCode(): sequence code type");
                        return NULL;
@@ -391,7 +396,8 @@ int edg_wll_SetSequenceCode(edg_wll_Context ctx,
                                        &c[EDG_WLL_SOURCE_APPLICATION],
                                        &c[EDG_WLL_SOURCE_LB_SERVER]);
 
-                       assert(EDG_WLL_SOURCE__LAST == 10);
+                       /* XXX: can't be true anymore. What was the reason for assert()? 
+                       assert(EDG_WLL_SOURCE__LAST == 10); */
                        if (res == EDG_WLL_SOURCE_LB_SERVER-1) {
                                /* pre-collections compatibility */
                                c[EDG_WLL_SOURCE_LB_SERVER] = 0;
@@ -421,6 +427,8 @@ int edg_wll_SetSequenceCode(edg_wll_Context ctx,
                        else
                                strncpy(ctx->p_seqcode.condor, seqcode_str, sizeof(ctx->p_seqcode.condor));
                        break;
+               case EDG_WLL_SEQ_CREAM:
+                       break; /* XXX: not yet */
                default:
                        return edg_wll_SetError(ctx, EINVAL,
                                "edg_wll_SetSequenceCode(): unrecognized value of seq_type parameter");
@@ -447,6 +455,7 @@ int edg_wll_IncSequenceCode(edg_wll_Context ctx)
                        ctx->p_seqcode.c[ctx->p_source]++;
                        break;
                case EDG_WLL_SEQ_PBS:
+               case EDG_WLL_SEQ_CREAM:
                        /* no action */
                        break;
                default:
index 1dc77fe..0230b8d 100644 (file)
@@ -52,6 +52,9 @@ int processEvent(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char
                        case EDG_WLL_REGJOB_CONDOR:
                                js->pub.jobtype = EDG_WLL_STAT_CONDOR;
                                break;
+                       case EDG_WLL_REGJOB_CREAM:
+                               js->pub.jobtype = EDG_WLL_STAT_CREAM;
+                               break;
                        default:
                                trio_asprintf(errstring,"unknown job type %d in registration",e->regJob.jobtype);
                                return RET_FAIL;
@@ -66,6 +69,8 @@ int processEvent(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char
                        return processEvent_PBS(js,e,ev_seq,strict,errstring);
                case EDG_WLL_STAT_CONDOR: 
                        return processEvent_Condor(js,e,ev_seq,strict,errstring);
+               case EDG_WLL_STAT_CREAM:
+                       return RET_OK;          /* TODO: mulac */
                case -1: return RET_UNREG;
                default: 
                        trio_asprintf(errstring,"undefined job type %d",js->pub.jobtype);