More info from CREAM (still in progress)
authorJiří Filipovič <fila@ics.muni.cz>
Thu, 18 Feb 2010 14:02:15 +0000 (14:02 +0000)
committerJiří Filipovič <fila@ics.muni.cz>
Thu, 18 Feb 2010 14:02:15 +0000 (14:02 +0000)
org.glite.lb.server/src/lb_html.c
org.glite.lb.state-machine/src/process_event_cream.c

index 65246f4..bfacfea 100644 (file)
@@ -268,6 +268,21 @@ int edg_wll_CreamJobStatusToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobStat
        TR("Owner", "%s", stat.cream_owner);
        TR("Endpoint", "%s", stat.cream_endpoint);
        TR("Reason", "%s", stat.cream_reason);
+       
+       if ( (stat.stateEnterTime.tv_sec) || (stat.stateEnterTime.tv_usec) ) {
+                time_t  time = stat.stateEnterTime.tv_sec;
+                TR("State entered","%s",ctime(&time));
+        }
+        else
+                TR("State entered", "%s", NULL);
+        if ( (stat.lastUpdateTime.tv_sec) || (stat.lastUpdateTime.tv_usec) ) {
+                time_t  time = stat.lastUpdateTime.tv_sec;
+                TR("Last update","%s",ctime(&time));
+        }
+        else
+                TR("Last update", "%s", NULL);
+
+
        TR("LRMS id", "%s", stat.cream_lrms_id);
        TR("Node", "%s", stat.cream_node);
        TR("Cancelling", "%s", stat.cream_cancelling > 0 ? "YES" : "NO");
@@ -279,14 +294,14 @@ int edg_wll_CreamJobStatusToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobStat
                 cream_jw_status
         */
        
-       if (stat.jdl){
+       if (stat.cream_jdl){
                 char *jdl_unp;
-                if (pretty_print(stat.jdl, &jdl_unp) == 0)
+                if (pretty_print(stat.cream_jdl, &jdl_unp) == 0)
                         asprintf(&jdl,"<h3>Job description</h3>\r\n"
                                 "<pre>%s</pre>\r\n",jdl_unp);
                 else
                         asprintf(&jdl,"<h3>Job description (not a ClassAd)"
-                                "</h3>\r\n<pre>%s</pre>\r\n",stat.jdl);
+                                "</h3>\r\n<pre>%s</pre>\r\n",stat.cream_jdl);
         }
         asprintf(&pomA, "<html>\r\n\t<body>\r\n"
                         "<h2>%s</h2>\r\n"
index 83870ca..d2286ad 100644 (file)
@@ -116,48 +116,6 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                }
                        }
                        break;
-
-/* not used, replaced by CREAMSTATUS */
-#if 0
-               case EDG_WLL_EVENT_CREAMRUNNING:
-                       if (USABLE(res)) {
-                               js->pub.state = EDG_WLL_JOB_RUNNING;
-                               js->pub.cream_state = EDG_WLL_STAT_RUNNING;
-                               if (e->any.source == EDG_WLL_SOURCE_LRMS) {
-                                       js->pub.cream_jw_status = EDG_WLL_STAT_WRAPPER_RUNNING;
-                               }
-                       }
-                       if (USABLE_DATA(res)) {
-                               rep(js->pub.cream_node, e->CREAMRunning.node);
-                       }
-                       break;
-               case EDG_WLL_EVENT_CREAMREALLYRUNNING:
-                       if (USABLE(res)) {
-                               js->pub.state = EDG_WLL_JOB_RUNNING;
-                               js->pub.cream_state = EDG_WLL_STAT_REALLYRUNNING;
-                               if (e->any.source == EDG_WLL_SOURCE_LRMS) {
-                                       js->pub.cream_jw_status = EDG_WLL_STAT_PAYLOAD_RUNNING;
-                               }
-                       }
-                       if (USABLE_DATA(res)) {
-                       }
-                       break;
-               case EDG_WLL_EVENT_CREAMDONE:
-                       if (USABLE(res)) {
-                               js->pub.state = EDG_WLL_JOB_DONE;
-                               js->pub.cream_state = (e->CREAMDone.status_code == EDG_WLL_DONE_OK) ? EDG_WLL_STAT_DONEOK : EDG_WLL_STAT_DONEFAILED;
-                               if (e->any.source == EDG_WLL_SOURCE_LRMS) {
-                                       js->pub.cream_jw_status = EDG_WLL_STAT_DONE;
-                               }
-                       }
-                       if (USABLE_DATA(res)) {
-                               js->pub.cream_done_code = e->CREAMDone.status_code;
-                               if (e->CREAMDone.exit_code != -1) js->pub.cream_exit_code = e->CREAMDone.exit_code;
-                               rep(js->pub.cream_reason, e->CREAMDone.reason);
-                       }
-                       break;
-#endif
-
                case EDG_WLL_EVENT_CREAMCANCEL:
                        if (USABLE(res)) {
                                if (e->CREAMCancel.status_code == EDG_WLL_CANCEL_DONE) {
@@ -180,7 +138,6 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                        break;
 
                case EDG_WLL_EVENT_CREAMSTATUS:
-                       printf("EDG_WLL_EVENT_CREAMSTATUS\n");
                        if (USABLE(res) && e->CREAMStatus.result == EDG_WLL_CREAMSTATUS_DONE)
                        {
                                switch (js->pub.cream_state = edg_wll_StringToCreamStat(e->CREAMStatus.new_state))
@@ -196,7 +153,7 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                                js->pub.state = EDG_WLL_JOB_RUNNING;
                                                js->pub.jw_status = EDG_WLL_STAT_WRAPPER_RUNNING;
                                                break;
-                                       case EDG_WLL_STAT_REALLYRUNNING:
+                                       case EDG_WLL_STAT_REALLY_RUNNING:
                                                js->pub.state = EDG_WLL_JOB_RUNNING;
                                                js->pub.jw_status = EDG_WLL_STAT_PAYLOAD_RUNNING;
                                                break;
@@ -211,6 +168,12 @@ int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict,
                                                break;
                                        case EDG_WLL_STAT_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
                                }
+                               if (e->CREAMStatus.exit_code && strcmp(e->CREAMStatus.exit_code, "N/A"))
+                                       js->pub.cream_exit_code = atoi(e->CREAMStatus.exit_code);
+                               if (js->pub.cream_node) free(js->pub.cream_node);
+                               js->pub.cream_node = strdup(e->CREAMStatus.worker_node);
+                               if (js->pub.cream_lrms_id) free(js->pub.cream_lrms_id);
+                               js->pub.cream_lrms_id = strdup(e->CREAMStatus.LRMS_jobid);
                        }
                        break;