framework for Job Wrapper status counting
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 31 Jul 2008 13:51:37 +0000 (13:51 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 31 Jul 2008 13:51:37 +0000 (13:51 +0000)
- no real implemantation yet

org.glite.lb.client/examples/job_status.c
org.glite.lb.client/src/StatusAttrNames.pl
org.glite.lb.common/interface/jobstat.h.T
org.glite.lb.common/src/status.c.T
org.glite.lb.server/src/jobstat_supp.c
org.glite.lb.state-machine/interface/intjobstat.h
org.glite.lb.types/status.T

index e930bc1..4f0601e 100644 (file)
@@ -11,6 +11,7 @@
 #include "glite/lb/context-int.h"
 #include "glite/lb/consumer.h"
 #include "glite/lb/xml_conversions.h"
+#include "glite/lb/jobstat.h"
 
 static void dgerr(edg_wll_Context,char *);
 static void printstat(edg_wll_JobStat,int);
@@ -295,6 +296,7 @@ static void printstat(edg_wll_JobStat stat, int level)
                         printf("%s\t%s \n", ind, stat.user_fqans[i]);
         }
        printf("%ssandbox_retrieved : %d\n", ind, stat.sandbox_retrieved);
+       printf("%sjw_status : %s\n", ind, edg_wll_JWStatToString(stat.jw_status));
 
        /* PBS state section */
        if (stat.jobtype == EDG_WLL_STAT_PBS) {
index 7798b97..1c7f01b 100644 (file)
@@ -71,4 +71,5 @@
        UI_HOST
        USER_FQANS
        SANDBOX_RETRIEVED
+       JW_STATUS
 /;
index 704a4e0..2875a91 100644 (file)
@@ -184,6 +184,16 @@ extern edg_wll_JobStatCode edg_wll_StringToStat(const char *);
  */
 extern char *edg_wll_StatToString(edg_wll_JobStatCode);
 
+/**
+ * Convert string Job Wrapper status to numeric code.
+ */
+extern enum edg_wll_StatJw_status edg_wll_StringToJWStat(const char *);
+
+/** 
+ * Convert numeric Job Wrapper status code to string representation
+ */
+extern char *edg_wll_JWStatToString(enum edg_wll_StatJw_status);
+
 /*@}*/
 
 /*
index 52b89e3..4f94b1a 100644 (file)
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "glite/lb/jobstat.h"
+#include "jobstat.h"
 
 static const struct timeval null_timeval = {0,0};
 
@@ -170,3 +170,35 @@ char *edg_wll_StatToString(edg_wll_JobStatCode statCode)
         if ((int)statCode < 0 || statCode >= sizeof(statNames)/sizeof(statNames[0])) return (char *) NULL; 
         return strdup(statNames[statCode]);
 }
+
+static const char * const jw_statNames[] = {
+@@@{
+                my $f = selectField $status jw_status;
+                if ($f->{codes}) {
+                        for (@{$f->{codes}}) {
+                                my $lc = lc $_->{name};
+                               my $uc = ucfirst $lc;
+                                gen qq{
+!       "$uc",
+}; 
+                        } 
+                }
+@@@}
+};
+
+enum edg_wll_StatJw_status edg_wll_StringToJWStat(const char *name)
+{
+        unsigned int     i;
+
+        for (i=0; i<sizeof(jw_statNames)/sizeof(jw_statNames[0]); i++)
+                if (strcasecmp(jw_statNames[i],name) == 0) return (enum edg_wll_StatJw_status) i;
+        return (enum edg_wll_StatJw_status) -1; 
+}
+
+char *edg_wll_JWStatToString(enum edg_wll_StatJw_status statCode)
+{
+        if ((int)statCode < 0 || statCode >= sizeof(jw_statNames)/sizeof(jw_statNames[0])) return (char *) NULL; 
+        return strdup(jw_statNames[statCode]);
+}
+
+
index b7620a4..ae5842c 100644 (file)
@@ -510,6 +510,7 @@ static char *enc_JobStat(char *old, edg_wll_JobStat* stat)
        if (ret) ret = enc_string(ret, stat->ui_host);
        if (ret) ret = enc_strlist(ret, stat->user_fqans);
        if (ret) ret = enc_int(ret, stat->sandbox_retrieved);
+       if (ret) ret = enc_int(ret, stat->jw_status);
        if (ret) ret = enc_string(ret, stat->pbs_state);
        if (ret) ret = enc_string(ret, stat->pbs_queue);
        if (ret) ret = enc_string(ret, stat->pbs_owner);
@@ -594,6 +595,7 @@ static edg_wll_JobStat* dec_JobStat(char *in, char **rest)
         if (tmp_in != NULL) stat->ui_host = dec_string(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->user_fqans = dec_strlist(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->sandbox_retrieved = dec_int(tmp_in, &tmp_in);
+        if (tmp_in != NULL) stat->jw_status = dec_int(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->pbs_state = dec_string(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->pbs_queue = dec_string(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->pbs_owner = dec_string(tmp_in, &tmp_in);
index d69d5a3..eb43b49 100644 (file)
@@ -14,7 +14,7 @@
 /* where Z.XX is version from indent + 1 (version after commit), Y = Z+1 */
 /* and DESCRIPTION is short hit why version changed            */
 
-#define INTSTAT_VERSION "revision 2.4 - proxy merge"
+#define INTSTAT_VERSION "revision 2.5 - proxy merge"
 
 
 // Internal error codes 
index dc46a15..ecd12dc 100644 (file)
@@ -91,6 +91,11 @@ int  sandbox_retrieved       Flag is set on incomming Clear event
        _code_  USER            User retrieved output sandbox.
        _code_  TIMEOUT         Timed out, resource forced purge of the sandbox.
        _code_  NOOUTPUT        No output was generated.
+int    jw_status               Status of Job wrapper
+       _code_  UNKNOWN         Status of JW unknown
+       _code_  WRAPPER_RUNNING Wrapper started
+       _code_  PAYLOAD_RUNNING Payload running
+       _code_  DONE            JW finished
 
 _pad_  55