basic support for cream jobs in job_status
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 10 Sep 2009 15:08:35 +0000 (15:08 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 10 Sep 2009 15:08:35 +0000 (15:08 +0000)
org.glite.lb.client/examples/job_status.c
org.glite.lb.common/src/status.c.T

index cc30d25..6127e2a 100644 (file)
@@ -215,7 +215,11 @@ static void printstat(edg_wll_JobStat stat, int level)
                case EDG_WLL_STAT_CONDOR:
                        printf("%sjobtype : CONDOR\n", ind);
                         break;
+               case EDG_WLL_STAT_CREAM:
+                       printf("%sjobtype : CREAM\n", ind);
+                        break;
                default:
+                       printf("%sjobtype : UNKNOWN\n", ind);
                        break;
        }
        printf("%sparent_job : %s\n", ind,
@@ -313,6 +317,25 @@ static void printstat(edg_wll_JobStat stat, int level)
                        (stat.pbs_error_desc) ? "\n" : "", stat.pbs_error_desc);
        }
 
+       /* CREAM state section */
+       if (stat.jobtype == EDG_WLL_STAT_CREAM) {
+               char    *cream_stat_name = edg_wll_JWStatToString(stat.cream_state);
+
+               printf("%scream_state : %s\n", ind, cream_stat_name);
+               printf("%scream_owner : %s\n", ind, stat.cream_owner);
+               printf("%scream_endpoint : %s\n", ind, stat.cream_endpoint);
+               printf("%scream_reason : %s\n", ind, stat.cream_reason);
+               printf("%scream_lrms_id : %s\n", ind, stat.cream_lrms_id);
+               printf("%scream_node : %s\n", ind, stat.cream_node);
+               printf("%scream_done_code : %d\n", ind, stat.cream_done_code);
+               printf("%scream_exit_code : %d\n", ind, stat.cream_exit_code);
+               printf("%scream_cancelling : %d\n", ind, stat.cream_cancelling);
+               printf("%scream_cpu_time : %d\n", ind, stat.cream_cpu_time);
+               printf("%scream_jw_status : %d\n", ind, stat.cream_jw_status);
+
+               free(cream_stat_name);
+       }
+
        printf("\n");   
        
        free(j1);
index 83d1902..0c68dc3 100644 (file)
@@ -204,6 +204,38 @@ char *edg_wll_JWStatToString(enum edg_wll_StatJw_status statCode)
         return strdup(jw_statNames[statCode]);
 }
 
+static const char * const cream_statNames[] = {
+@@@{
+                my $f = selectField $status cream_state;
+                if ($f->{codes}) {
+                        for (@{$f->{codes}}) {
+                                my $lc = lc $_->{name};
+                               my $uc = ucfirst $lc;
+                                gen qq{
+!       "$uc",
+}; 
+                        } 
+                }
+@@@}
+};
+
+enum edg_wll_StatCream_state edg_wll_StringToCreamStat(const char *name)
+{
+        unsigned int     i;
+
+        for (i=0; i<sizeof(cream_statNames)/sizeof(cream_statNames[0]); i++)
+                if (strcasecmp(cream_statNames[i],name) == 0) return (enum edg_wll_StatCream_state) i;
+        return (enum edg_wll_StatCream_state) -1; 
+}
+
+char *edg_wll_CreamStatToString(enum edg_wll_StatCream_state statCode)
+{
+        if ((int)statCode < 0 || statCode >= sizeof(cream_statNames)/sizeof(cream_statNames[0])) return (char *) NULL; 
+        return strdup(cream_statNames[statCode]);
+}
+
+
+
 char *edg_wll_JDLField(edg_wll_JobStat *stat, const char *field_name)
 {
        char *extr_val;