From: Jan Pospíšil Date: Sun, 6 Dec 2009 19:41:07 +0000 (+0000) Subject: first implementation of GetActivityStatus and GetActivityInfo X-Git-Tag: glite-lb-harvester_R_1_0_1_1~27 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=fdfe389235454a3cd0b26aa5b913036fb2b63855;p=jra1mw.git first implementation of GetActivityStatus and GetActivityInfo --- diff --git a/org.glite.lb.server/src/ws_lb4agu.c b/org.glite.lb.server/src/ws_lb4agu.c index e6914e6..028df6f 100644 --- a/org.glite.lb.server/src/ws_lb4agu.c +++ b/org.glite.lb.server/src/ws_lb4agu.c @@ -4,16 +4,68 @@ #include "glite/security/glite_gsplugin.h" #include "glite/security/glite_gscompat.h" +#include "glite/lbu/log.h" +#include "glite/lb/context-int.h" +#include "glite/lb/xml_conversions.h" + #include "bk_ws_Stub.h" #include "ws_fault.h" #include "ws_typeref.h" +#include "jobstat.h" + +extern int debug; SOAP_FMAC5 int SOAP_FMAC6 __lb4agu__GetActivityStatus( struct soap* soap, struct _lb4ague__GetActivityStatusRequest *in, struct _lb4ague__GetActivityStatusResponse *out) { - /* TODO */ + edg_wll_Context ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap); + edg_wlc_JobId j; + edg_wll_JobStat s; + int i,flags; + + glite_common_log(LOG_CATEGORY_LB_SERVER_ACCESS, LOG_PRIORITY_DEBUG, + "[%d] WS call %s", getpid(), __FUNCTION__); + + if (!in) return SOAP_FAULT; + if (!in->id) return SOAP_FAULT; + out = soap_malloc(soap, sizeof(*out)); + + /* process each request individually: */ + for (i=0; in->id[i]; i++) { + /* first parse jobId */ + if ( edg_wlc_JobIdParse(in->id[i], &j) ) { + edg_wll_SetError(ctx, EINVAL, in->id[i]); + edg_wll_ErrToFault(ctx, soap); + return SOAP_FAULT; + } + + /* FIXME: what are the flags? */ + flags = 0; + if (debug) { + char *cjobid = NULL, *cflags = NULL; + + cjobid = edg_wlc_JobIdUnparse(j); + cflags = edg_wll_stat_flags_to_string(flags); + glite_common_log(LOG_CATEGORY_LB_SERVER_ACCESS, + LOG_PRIORITY_DEBUG, + "[%d] \n\t%s\n\t%s\n", + getpid(), cflags, cjobid); + free(cjobid); + free(cflags); + } + + /* get job status */ + if ( edg_wll_JobStatusServer(ctx, j, flags, &s) ) { + edg_wll_ErrToFault(ctx, soap); + return SOAP_FAULT; + } + + /* fill in the response fields */ + out->status[i] = edg_wll_StatToString(s.state); + } + return SOAP_OK; } @@ -22,6 +74,53 @@ SOAP_FMAC5 int SOAP_FMAC6 __lb4agu__GetActivityInfo( struct _lb4ague__GetActivityInfoRequest *in, struct _lb4ague__GetActivityInfoResponse *out) { - /* TODO */ + edg_wll_Context ctx = (edg_wll_Context) glite_gsplugin_get_udata(soap); + edg_wlc_JobId j; + edg_wll_JobStat s; + int i,flags; + + glite_common_log(LOG_CATEGORY_LB_SERVER_ACCESS, LOG_PRIORITY_DEBUG, + "[%d] WS call %s", getpid(), __FUNCTION__); + + if (!in) return SOAP_FAULT; + if (!in->id) return SOAP_FAULT; + out = soap_malloc(soap, sizeof(*out)); + + /* process each request individually: */ + for (i=0; in->id[i]; i++) { + /* first parse jobId */ + if ( edg_wlc_JobIdParse(in->id[i], &j) ) { + edg_wll_SetError(ctx, EINVAL, in->id[i]); + edg_wll_ErrToFault(ctx, soap); + return SOAP_FAULT; + } + + /* FIXME: what are the flags? */ + flags = 0; + if (debug) { + char *cjobid = NULL, *cflags = NULL; + + cjobid = edg_wlc_JobIdUnparse(j); + cflags = edg_wll_stat_flags_to_string(flags); + glite_common_log(LOG_CATEGORY_LB_SERVER_ACCESS, + LOG_PRIORITY_DEBUG, + "[%d] \n\t%s\n\t%s\n", + getpid(), cflags, cjobid); + free(cjobid); + free(cflags); + } + + /* get job status */ + if ( edg_wll_JobStatusServer(ctx, j, flags, &s) ) { + edg_wll_ErrToFault(ctx, soap); + return SOAP_FAULT; + } + + /* fill in the response fields */ + out->status->ID = in->id[i]; + out->status->State = edg_wll_StatToString(s.state); + } + return SOAP_OK; } +