int processEvent_PBS(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring);
int processEvent_Condor(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring);
int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring);
+int processData_Cream(intJobStat *js, edg_wll_Event *e);
int processEvent_FileTransfer(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring);
int processEvent_FileTransferCollection(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring);
res = RET_LATE;
}
+ if (e->any.source == EDG_WLL_SOURCE_CREAM_EXECUTOR || e->any.source == EDG_WLL_SOURCE_CREAM_INTERFACE){
+ processData_Cream(js, e);
+ }
switch (e->any.type) {
case EDG_WLL_EVENT_TRANSFER:
ignore_seq_code = 1;
break;
+/************************************ CREAM events ****************************/
+ case EDG_WLL_EVENT_CREAMSTART:
+ break;
+
+ case EDG_WLL_EVENT_CREAMPURGE:
+ break;
+
+ case EDG_WLL_EVENT_CREAMACCEPTED:
+ break;
+
+ case EDG_WLL_EVENT_CREAMSTORE:
+ if (USABLE(res, strict)) {
+ switch (e->CREAMStore.command) {
+ case EDG_WLL_CREAMSTORE_CMDSTART:
+ if (e->CREAMStore.result == EDG_WLL_CREAMSTORE_OK) {
+ js->pub.state = EDG_WLL_JOB_WAITING;
+ js->pub.cream_state = EDG_WLL_STAT_PENDING;
+ }
+ break;
+ case EDG_WLL_CREAMSTORE_CMDSUSPEND:
+ if (e->CREAMStore.result == EDG_WLL_CREAMSTORE_OK) {
+ js->pub.suspended = 1;
+ }
+ break;
+ case EDG_WLL_CREAMSTORE_CMDRESUME:
+ if (e->CREAMStore.result == EDG_WLL_CREAMSTORE_OK) {
+ js->pub.suspended = 0;
+ }
+ break;
+ default:
+ break;
+ }
+ rep_cond(js->pub.cream_reason, e->CREAMStore.reason);
+ rep_cond(js->pub.reason, e->CREAMStore.reason);
+ }
+ break;
+ case EDG_WLL_EVENT_CREAMCALL:
+ if (e->any.source == EDG_WLL_SOURCE_CREAM_EXECUTOR &&
+ e->CREAMCall.callee == EDG_WLL_SOURCE_LRMS &&
+ e->CREAMCall.command == EDG_WLL_CREAMCALL_CMDSTART &&
+ e->CREAMCall.result == EDG_WLL_CREAMCALL_OK)
+ {
+ if (USABLE(res, strict)) {
+ // BLAH -> LRMS
+ js->pub.state = EDG_WLL_JOB_SCHEDULED;
+ js->pub.cream_state = EDG_WLL_STAT_IDLE;
+ rep_cond(js->pub.cream_reason, e->CREAMCall.reason);
+ rep_cond(js->pub.reason, e->CREAMCall.reason);
+ }
+ }
+ if (e->CREAMCall.command == EDG_WLL_CREAMCALL_CMDCANCEL &&
+ e->CREAMCall.result == EDG_WLL_CREAMCALL_OK)
+ {
+ if (USABLE(res, strict)){
+ js->pub.cream_cancelling = 1;
+ js->pub.cancelling = 1;
+ rep_cond(js->pub.cream_reason, e->CREAMCall.reason);
+ rep_cond(js->pub.reason, e->CREAMCall.reason);
+ }
+ }
+ break;
+ case EDG_WLL_EVENT_CREAMCANCEL:
+ if (USABLE(res, strict)) {
+ if (e->CREAMCancel.status_code == EDG_WLL_CANCEL_DONE) {
+ js->pub.state = EDG_WLL_JOB_CANCELLED;
+ js->pub.cream_state = EDG_WLL_STAT_ABORTED;
+ }
+ rep(js->pub.cream_reason, e->CREAMCancel.reason);
+ rep(js->pub.reason, e->CREAMCancel.reason);
+ }
+ break;
+ case EDG_WLL_EVENT_CREAMABORT:
+ if (USABLE(res, strict)) {
+ js->pub.state = EDG_WLL_JOB_ABORTED;
+ js->pub.cream_state = EDG_WLL_STAT_ABORTED;
+ rep(js->pub.cream_reason, e->CREAMAbort.reason);
+ rep(js->pub.reason, e->CREAMAbort.reason);
+ }
+ break;
+ case EDG_WLL_EVENT_CREAMSTATUS:
+ if (USABLE(res, strict) && e->CREAMStatus.result == EDG_WLL_CREAMSTATUS_DONE)
+ {
+ switch (js->pub.cream_state = edg_wll_StringToCreamStat(e->CREAMStatus.new_state))
+ {
+ case EDG_WLL_STAT_REGISTERED:
+ case EDG_WLL_NUMBER_OF_CREAM_STATES:
+ break;
+
+ case EDG_WLL_STAT_PENDING: js->pub.state = EDG_WLL_JOB_WAITING; break;
+ case EDG_WLL_STAT_IDLE: js->pub.state = EDG_WLL_JOB_SCHEDULED; break;
+ case EDG_WLL_STAT_RUNNING:
+ js->pub.state = EDG_WLL_JOB_RUNNING;
+ js->pub.jw_status = EDG_WLL_STAT_WRAPPER_RUNNING;
+ break;
+ case EDG_WLL_STAT_REALLY_RUNNING:
+ js->pub.state = EDG_WLL_JOB_RUNNING;
+ js->pub.jw_status = EDG_WLL_STAT_PAYLOAD_RUNNING;
+ break;
+ case EDG_WLL_STAT_HELD: /* TODO */ break;
+ case EDG_WLL_STAT_DONE_OK:
+ js->pub.state = EDG_WLL_JOB_DONE;
+ js->pub.done_code = EDG_WLL_STAT_OK;
+ js->pub.cream_done_code = EDG_WLL_STAT_OK;
+ break;
+ case EDG_WLL_STAT_DONE_FAILED:
+ js->pub.state = EDG_WLL_JOB_DONE;
+ js->pub.done_code = EDG_WLL_STAT_FAILED;
+ js->pub.cream_done_code = EDG_WLL_STAT_FAILED;
+ break;
+ case EDG_WLL_STAT_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
+ }
+ }
+ break;
+
default:
goto bad_event;
break;
#define rep(a,b) { free(a); a = (b == NULL) ? NULL : strdup(b); }
#define rep_cond(a,b) { if (b) { free(a); a = strdup(b); } }
+int processData_Cream(intJobStat *js, edg_wll_Event *e)
+{
+ int res = RET_OK;
+
+ switch (e->any.type) {
+ case EDG_WLL_EVENT_REGJOB:
+ if (USABLE_DATA(res)) {
+ rep_cond(js->pub.cream_owner, js->pub.owner);
+ rep_cond(js->pub.jdl, e->regJob.jdl);
+ rep_cond(js->pub.cream_jdl, e->regJob.jdl);
+ rep_cond(js->pub.cream_endpoint, e->regJob.ns);
+ rep_cond(js->pub.destination, e->regJob.ns);
+ rep_cond(js->pub.network_server, e->regJob.ns);
+ }
+ break;
+ case EDG_WLL_EVENT_CREAMSTART:
+ // nothing to be done
+ break;
+ case EDG_WLL_EVENT_CREAMPURGE:
+ // no state transition
+ break;
+ case EDG_WLL_EVENT_CREAMACCEPTED:
+ if (USABLE(res)){
+ rep(js->pub.cream_id, e->CREAMAccepted.local_jobid);
+ rep(js->pub.globusId, e->CREAMAccepted.local_jobid);
+ }
+ break;
+ case EDG_WLL_EVENT_CREAMSTATUS:
+ if (USABLE(res) && e->CREAMStatus.result == EDG_WLL_CREAMSTATUS_DONE)
+ {
+ if (e->CREAMStatus.exit_code && strcmp(e->CREAMStatus.exit_code, "N/A"))
+ {
+ js->pub.cream_exit_code = atoi(e->CREAMStatus.exit_code);
+ js->pub.exit_code = atoi(e->CREAMStatus.exit_code);
+ }
+ if (e->CREAMStatus.worker_node){ /*XXX should never be false */
+ if (js->pub.cream_node)
+ free(js->pub.cream_node);
+ js->pub.cream_node = strdup(e->CREAMStatus.worker_node);
+ if (js->pub.ce_node)
+ free(js->pub.ce_node);
+ js->pub.ce_node = strdup(e->CREAMStatus.worker_node);
+ }
+ if (e->CREAMStatus.LRMS_jobid){ /*XXX should never be false */
+ if (js->pub.cream_lrms_id)
+ free(js->pub.cream_lrms_id);
+ js->pub.cream_lrms_id = strdup(e->CREAMStatus.LRMS_jobid);
+ if (js->pub.localId)
+ free(js->pub.localId);
+ js->pub.localId = strdup(e->CREAMStatus.LRMS_jobid);
+ }
+ if (e->CREAMStatus.failure_reason){
+ if (js->pub.cream_failure_reason)
+ free(js->pub.cream_failure_reason);
+ js->pub.cream_failure_reason = strdup(e->CREAMStatus.failure_reason);
+ if (js->pub.failure_reasons){
+ char *glued_reasons;
+ asprintf(&glued_reasons,"%s\n", e->CREAMStatus.failure_reason);
+ rep(js->pub.failure_reasons, glued_reasons);
+ }
+ else
+ asprintf(&(js->pub.failure_reasons),"%s", e->CREAMStatus.failure_reason);
+ }
+ }
+ break;
+
+ case EDG_WLL_EVENT_USERTAG:
+ if (USABLE_DATA(res)) {
+ if (e->userTag.name != NULL && e->userTag.value != NULL) {
+ add_taglist(e->userTag.name, e->userTag.value, e->any.seqcode, js);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (! js->pub.location) js->pub.location = strdup("this is CREAM");
+
+ return RET_OK;
+}
+
int processEvent_Cream(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring)
{
edg_wll_JobStatCode old_state = js->pub.state;
js->pub.state = EDG_WLL_JOB_SUBMITTED;
js->pub.cream_state = EDG_WLL_STAT_REGISTERED;
}
- if (USABLE_DATA(res)) {
- rep_cond(js->pub.cream_owner, js->pub.owner);
- rep_cond(js->pub.jdl, e->regJob.jdl);
- rep_cond(js->pub.cream_jdl, e->regJob.jdl);
- rep_cond(js->pub.cream_endpoint, e->regJob.ns);
- rep_cond(js->pub.destination, e->regJob.ns);
- rep_cond(js->pub.network_server, e->regJob.ns);
- }
break;
case EDG_WLL_EVENT_CREAMSTART:
// nothing to be done
// no state transition
break;
case EDG_WLL_EVENT_CREAMACCEPTED:
- if (USABLE(res)){
- rep(js->pub.cream_id, e->CREAMAccepted.local_jobid);
- rep(js->pub.globusId, e->CREAMAccepted.local_jobid);
- }
break;
case EDG_WLL_EVENT_CREAMSTORE:
if (USABLE(res)) {
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);
- js->pub.exit_code = atoi(e->CREAMStatus.exit_code);
- }
- if (e->CREAMStatus.worker_node){ /*XXX should never be false */
- if (js->pub.cream_node)
- free(js->pub.cream_node);
- js->pub.cream_node = strdup(e->CREAMStatus.worker_node);
- if (js->pub.ce_node)
- free(js->pub.ce_node);
- js->pub.ce_node = strdup(e->CREAMStatus.worker_node);
- }
- if (e->CREAMStatus.LRMS_jobid){ /*XXX should never be false */
- if (js->pub.cream_lrms_id)
- free(js->pub.cream_lrms_id);
- js->pub.cream_lrms_id = strdup(e->CREAMStatus.LRMS_jobid);
- if (js->pub.localId)
- free(js->pub.localId);
- js->pub.localId = strdup(e->CREAMStatus.LRMS_jobid);
- }
- if (e->CREAMStatus.failure_reason){
- if (js->pub.cream_failure_reason)
- free(js->pub.cream_failure_reason);
- js->pub.cream_failure_reason = strdup(e->CREAMStatus.failure_reason);
- if (js->pub.failure_reasons){
- char *glued_reasons;
- asprintf(&glued_reasons,"%s\n", e->CREAMStatus.failure_reason);
- rep(js->pub.failure_reasons, glued_reasons);
- }
- else
- asprintf(&(js->pub.failure_reasons),"%s", e->CREAMStatus.failure_reason);
- }
}
break;
case EDG_WLL_EVENT_USERTAG:
- if (USABLE_DATA(res)) {
- if (e->userTag.name != NULL && e->userTag.value != NULL) {
- add_taglist(e->userTag.name, e->userTag.value, e->any.seqcode, js);
- }
- }
break;
default:
}
if (! js->pub.location) js->pub.location = strdup("this is CREAM");
+ processData_Cream(js, e);
return RET_OK;
}