make processEvent function and error codes internaly public
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 15 Sep 2005 08:10:49 +0000 (08:10 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 15 Sep 2005 08:10:49 +0000 (08:10 +0000)
better handling errors from processEvent in lb_plugin

org.glite.lb.server/src/jobstat.c
org.glite.lb.server/src/jobstat.h
org.glite.lb.server/src/lb_plugin.c

index 48071d3..eaf29b4 100644 (file)
 #define UNUSED_VAR
 #endif
   
-#define RET_FAIL       0
-#define RET_OK         1
-#define RET_FATAL      RET_FAIL
-#define RET_SOON       2
-#define RET_LATE       3
-#define RET_BADSEQ     4
-#define RET_SUSPECT    5
-#define RET_IGNORE     6
-#define RET_BADBRANCH  7
-#define RET_GOODBRANCH 8
-#define RET_TOOOLD     9
-#define RET_INTERNAL   100
 
 #define rep(a,b) { free(a); a = (b == NULL) ? NULL : strdup(b); }
 #define mov(a,b) { free(a); a = b; b = NULL; }
@@ -97,8 +85,6 @@ void destroy_intJobStat(intJobStat *p)
 static int eval_expect_update(intJobStat *, int *, char **);
 #endif
 
-static int processEvent(intJobStat *, edg_wll_Event *, int, int, char **);
-
 static char* matched_substr(char *, regmatch_t) UNUSED_VAR;
 
 static char* matched_substr(char *in, regmatch_t match)
@@ -422,7 +408,7 @@ static int badEvent(intJobStat *js UNUSED_VAR, edg_wll_Event *e, int ev_seq UNUS
 #define LRMS_STATE(state) ((state) == EDG_WLL_JOB_RUNNING || (state) == EDG_WLL_JOB_DONE)
 
 
-static int processEvent(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring)
+int processEvent(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring)
 {
 
        edg_wll_JobStatCode     old_state = js->pub.state;
index bb6fff5..d8a7a41 100644 (file)
@@ -7,6 +7,23 @@
 
 #define INTSTAT_VERSION "release-3.0_shallow"
 
+
+// Internal error codes 
+
+#define RET_FAIL        0
+#define RET_OK          1
+#define RET_FATAL       RET_FAIL
+#define RET_SOON        2
+#define RET_LATE        3
+#define RET_BADSEQ      4
+#define RET_SUSPECT     5
+#define RET_IGNORE      6
+#define RET_BADBRANCH   7
+#define RET_GOODBRANCH  8
+#define RET_TOOOLD      9
+#define RET_INTERNAL    100
+
+
 // shallow resubmission container - holds state of each branch
 // (useful when state restore is needed after ReallyRunning event)
 //
@@ -45,3 +62,4 @@ void write2rgma_status(edg_wll_JobStat *);
 int before_deep_resubmission(const char *, const char *);
 int same_branch(const char *, const char *);
 int component_seqcode(const char *a, edg_wll_Source index);
+int processEvent(intJobStat *, edg_wll_Event *, int, int, char **);
index e548c6c..ae6ffb1 100644 (file)
@@ -381,10 +381,7 @@ static int lb_status(edg_wll_Event **events, edg_wll_JobStat *status) {
        i = 0;
         while (events[i])  
         {
-               if (!processEvent(js, events[i], 0, be_strict, &errstring)) {
-                       // XXX: better way would be to export definitions
-                       //      of intermal job_status error codes and test 
-                       //      it againts RET_FATAL
+               if (processEvent(js, events[i], 0, be_strict, &errstring) == RET_FATAL) {
                        goto err;
                }
                i++;