- unified edg_wll_RegisterSubjobs*() calls by adding edg_wll_RegisterSubjobsMaster()
authorJan Pospíšil <honik@ntc.zcu.cz>
Mon, 15 Mar 2010 06:10:52 +0000 (06:10 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Mon, 15 Mar 2010 06:10:52 +0000 (06:10 +0000)
- fixed LB_PERF build

org.glite.lb.client/src/perftest_logjobs.c
org.glite.lb.client/src/producer.c

index c113692..9c82680 100644 (file)
@@ -279,10 +279,10 @@ main(int argc, char *argv[])
                        switch(dest) {
                        case DEST_PROXY:
                                ctx->p_tmp_timeout = ctx->p_sync_timeout;
-                               if (edg_wll_DoLogEventProxy(ctx,event)) {
+                               if (edg_wll_DoLogEventServer(ctx,EDG_WLL_LOGFLAG_PROXY,event)) {
                                        char    *et,*ed;
                                        edg_wll_Error(ctx,&et,&ed);
-                                       fprintf(stderr,"edg_wll_DoLogEventProxy(): %s (%s)\n",et,ed);
+                                       fprintf(stderr,"edg_wll_DoLogEventServer(): %s (%s)\n",et,ed);
                                        fprintf(stderr,"Event:\n%s\n", event);
                                        exit(1);
                                }
@@ -321,10 +321,10 @@ main(int argc, char *argv[])
                        case DEST_BKSERVER:
                                ctx->p_tmp_timeout = ctx->p_log_timeout;
                                edg_wlc_JobIdParse(jobid, &ctx->p_jobid);
-                               if (edg_wll_DoLogEventDirect(ctx, event)) {
+                               if (edg_wll_DoLogEventServer(ctx,EDG_WLL_LOGFLAG_DIRECT,event)) {
                                        char    *et,*ed;
                                        edg_wll_Error(ctx,&et,&ed);
-                                       fprintf(stderr,"edg_wll_DoLogEventDirect(): %s (%s)\n",et,ed);
+                                       fprintf(stderr,"edg_wll_DoLogEventServer(): %s (%s)\n",et,ed);
                                        fprintf(stderr,"Event:\n%s\n", event);
                                        exit(1);
                                }
index 6664537..8861e24 100644 (file)
@@ -995,58 +995,49 @@ int edg_wll_RegisterJobProxyOnly(
 {
        return edg_wll_RegisterJobMaster(ctx,EDG_WLL_LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs,NULL);
 }
-#endif
 
 /**
  *-----------------------------------------------------------------------
- * Register one subjob with L&B service
+ * Register one job with L&B Proxy service
  * \note simple wrapper around edg_wll_RegisterJobMaster()
+ * this is original edg_wll_RegisterJobProxy, krept only for performance measuring
  *-----------------------------------------------------------------------
  */
-static
-int edg_wll_RegisterSubjob(
+int edg_wll_RegisterJobProxyOld(
         edg_wll_Context         ctx,
         glite_jobid_const_t     job,
-        enum edg_wll_RegJobJobtype     type,
+        enum edg_wll_RegJobJobtype      type,
         const char *            jdl,
         const char *            ns,
-       glite_jobid_const_t     parent,
         int                     num_subjobs,
         const char *            seed,
         edg_wlc_JobId **        subjobs)
 {
-       return edg_wll_RegisterJobMaster(ctx,EDG_WLL_LOGFLAG_LOCAL,job,type,jdl,ns,parent,num_subjobs,seed,subjobs,NULL);
-}
+       int     ret=0;
 
-/**
- *-----------------------------------------------------------------------
- * Register one subjob with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterJobMaster()
- *-----------------------------------------------------------------------
- */
-static
-int edg_wll_RegisterSubjobProxy(
-        edg_wll_Context         ctx,
-        glite_jobid_const_t     job,
-        enum edg_wll_RegJobJobtype     type,
-        const char *            jdl,
-        const char *            ns,
-       glite_jobid_const_t     parent,
-        int                     num_subjobs,
-        const char *            seed,
-        edg_wlc_JobId **        subjobs)
-{
-       return edg_wll_RegisterJobMaster(ctx,EDG_WLL_LOGFLAG_PROXY,job,type,jdl,ns,parent,num_subjobs,seed,subjobs,NULL);
+        /* first register with bkserver ... */
+        ret=edg_wll_RegisterJobMaster(ctx,EDG_WLL_LOGFLAG_DIRECT,
+               job,type,jdl,ns,NULL,num_subjobs,seed,subjobs,NULL);
+       if (ret) return ret;
+
+        /* ... and then with L&B Proxy */
+        ret=edg_wll_RegisterJobMaster(ctx,EDG_WLL_LOGFLAG_PROXY,
+               job,type,jdl,ns,NULL,num_subjobs,seed,subjobs,NULL);
+
+       return ret;
 }
 
+#endif
+
 /**
  *-----------------------------------------------------------------------
- * Register batch of subjobs with L&B service
- * \note simple wrapper around edg_wll_RegisterSubjob()
+ * Master function for registering batch of subjobs 
+ * \note simple wrapper around edg_wll_RegisterJobMaster()
  *-----------------------------------------------------------------------
  */
-int edg_wll_RegisterSubjobs(
+static int edg_wll_RegisterSubjobsMaster(
        edg_wll_Context         ctx,
+       int                     logging_flags,
        glite_jobid_const_t     parent,
        char const * const *    jdls, 
        const char *            ns, 
@@ -1066,16 +1057,17 @@ int edg_wll_RegisterSubjobs(
        psubjob = subjobs;
        
        while (*pjdl != NULL) {
-               if (edg_wll_RegisterSubjob(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
-                                               ns, parent, 0, NULL, NULL) != 0) {
+               if (edg_wll_RegisterJobMaster(ctx, logging_flags,
+                       *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
+                       ns, parent, 0, NULL, NULL, NULL) != 0) {
                        errcode = edg_wll_Error(ctx, NULL, &errdesc);
-                       goto edg_wll_registersubjobs_end;
+                       goto edg_wll_registersubjobsmaster_end;
                }
                pjdl++; psubjob++;
        }
 
-edg_wll_registersubjobs_end:
-       edg_wll_SetLoggingJob(ctx, oldctxjob, oldctxseq, EDG_WLL_SEQ_NORMAL);
+edg_wll_registersubjobsmaster_end:
+       edg_wll_SetLoggingJobMaster(ctx, oldctxjob, oldctxseq, NULL, EDG_WLL_SEQ_NORMAL,logging_flags);
 
        if (errcode) {
                 edg_wll_SetError(ctx, errcode, errdesc);
@@ -1086,47 +1078,37 @@ edg_wll_registersubjobs_end:
 
 /**
  *-----------------------------------------------------------------------
+ * Register batch of subjobs with L&B service
+ * \note simple wrapper around edg_wll_RegisterSubjobsMaster()
+ *-----------------------------------------------------------------------
+ */ 
+int edg_wll_RegisterSubjobs(
+        edg_wll_Context         ctx,
+        glite_jobid_const_t     parent,
+        char const * const *    jdls,
+        const char *            ns, 
+        edg_wlc_JobId const *   subjobs)
+{
+       return edg_wll_RegisterSubjobsMaster(ctx,EDG_WLL_LOGFLAG_LOCAL,
+               parent, jdls, ns, subjobs);
+}
+
+/**
+ *-----------------------------------------------------------------------
  * Register batch of subjobs with L&B Proxy service
- * \note simple wrapper around edg_wll_RegisterSubjobProxy()
+ * \note simple wrapper around edg_wll_RegisterSubjobsMaster()
  *-----------------------------------------------------------------------
- */
+ */ 
 int edg_wll_RegisterSubjobsProxy(
-       edg_wll_Context         ctx,
-       glite_jobid_const_t     parent,
-       char const * const *    jdls, 
-       const char *            ns, 
-       edg_wlc_JobId const *   subjobs)
+        edg_wll_Context         ctx,
+        glite_jobid_const_t     parent,
+        char const * const *    jdls,
+        const char *            ns, 
+        edg_wlc_JobId const *   subjobs)
 {
-       char const * const      *pjdl;
-       edg_wlc_JobId const     *psubjob;
-       edg_wlc_JobId           oldctxjob;
-       char *                  oldctxseq;
-       int                     errcode = 0;
-       char *                  errdesc = NULL;
+       return edg_wll_RegisterSubjobsMaster(ctx,EDG_WLL_LOGFLAG_PROXY,
+               parent, jdls, ns, subjobs);
 
-       if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
-       oldctxseq = edg_wll_GetSequenceCode(ctx);
-
-       pjdl = jdls;
-       psubjob = subjobs;
-       
-       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);
-
-       if (errcode) {
-                edg_wll_SetError(ctx, errcode, errdesc);
-                free(errdesc);
-        }
-       return edg_wll_Error(ctx, NULL, NULL);
 }
 
 /**