From: Jan Pospíšil Date: Tue, 11 Oct 2005 19:47:34 +0000 (+0000) Subject: added edg_wll_RegisterSubjobsProxy() X-Git-Tag: glite-security-gsoap-plugin_R_1_2_0~8 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=80d346b4d28f4d3acaa78010922636619e374ca2;p=jra1mw.git added edg_wll_RegisterSubjobsProxy() --- diff --git a/org.glite.lb.client-interface/interface/producer.h.T b/org.glite.lb.client-interface/interface/producer.h.T index 03687a6..cfbafb2 100644 --- a/org.glite.lb.client-interface/interface/producer.h.T +++ b/org.glite.lb.client-interface/interface/producer.h.T @@ -218,10 +218,10 @@ extern int edg_wll_LogEventSync( /** * Formats a logging message and sends it synchronously to L&B Proxy * \brief generic synchronous logging function - * \param context INOUT context to work with, - * \param event IN type of the event, - * \param fmt IN printf()-like format string, - * \param ... IN event specific values/data according to fmt, + * \param[in,out] context context to work with, + * \param[in] event type of the event, + * \param[in] fmt printf()-like format string, + * \param[in] ... event specific values/data according to fmt, * \retval 0 successful completition, * \retval EINVAL bad jobId, unknown event code, or the format string together with the remaining arguments does not form a valid event, * \retval ENOSPC L&B infrastructure failed to accept the event due to lack of disk space etc., @@ -239,8 +239,8 @@ extern int edg_wll_LogEventProxy( * Instructs interlogger to to deliver all pending events related to current job * \brief flush events from interlogger * \note sort of status query more than a command - * \param context INOUT context to work with, - * \param timeout INOUT wait at most this much time for completition, remaining time on return, + * \param[in,out] context context to work with, + * \param[in,out] timeout wait at most this much time for completition, remaining time on return, * \retval 0 successful completition, * \retval EDG_WLL_ERROR_INTERLOG_TIMEOUT the inter-logger did not respond within the timeout, * \retval EDG_WLL_ERROR_INTERLOG_CONLOST inter-logger lost connection to one or more servers, @@ -279,29 +279,11 @@ extern int edg_wll_SetLoggingJob( /** * Set a current job for given context. * \note Should be called before any logging call. - * \param context INOUT context to work with - * \param job IN further logging calls are related to this job - * \param code IN sequence code as obtained from previous component - * \param user IN user credentials - * \param flags IN flags on code handling (\see API documentation) - */ -extern int edg_wll_SetLoggingJobProxy( - edg_wll_Context context, - const edg_wlc_JobId job, - const char * code, - const char * user, - int flags -); - - -/** - * Set a current job for given context. - * \note Should be called before any logging call. - * \param context INOUT context to work with - * \param job IN further logging calls are related to this job - * \param code IN sequence code as obtained from previous component - * \param user IN user credentials - * \param flags IN flags on code handling (\see API documentation) + * \param[in,out] context context to work with + * \param[in] job further logging calls are related to this job + * \param[in] code sequence code as obtained from previous component + * \param[in] user user credentials + * \param[in] flags flags on code handling (\see API documentation) */ extern int edg_wll_SetLoggingJobProxy( edg_wll_Context context, @@ -311,7 +293,6 @@ extern int edg_wll_SetLoggingJobProxy( int flags ); - /** * Register job with L&B service. * Done via logging REGJOB event, may generate subjob id's and create @@ -370,14 +351,14 @@ extern int edg_wll_RegisterJobSync( * Partitionable jobs should set num_subjobs=0 initially, * and re-register when number of subjobs becomes known. * - * \param type IN EDG_WLL_JOB_SIMPLE, EDG_WLL_JOB_DAG, or EDG_WLL_JOB_PARTITIONABLE - * \param user IN user credentials - * \param jdl IN user-specified JDL - * \param ns IN network server contact - * \param num_subjobs IN number of subjobs to create - * \param seed IN seed used for subjob id's generator. + * \param[in] type EDG_WLL_JOB_SIMPLE, EDG_WLL_JOB_DAG, or EDG_WLL_JOB_PARTITIONABLE + * \param[in] user user credentials + * \param[in] jdl user-specified JDL + * \param[in] ns network server contact + * \param[in] num_subjobs number of subjobs to create + * \param[in] seed seed used for subjob id's generator. * Use non-NULL value to be able to regenerate the set of jobid's - * \param subjobs OUT returned subjob id's + * \param[out] subjobs returned subjob id's */ extern int edg_wll_RegisterJobProxy( @@ -396,8 +377,8 @@ extern int edg_wll_RegisterJobProxy( * Register subjobs in a batch. * Mainly used to provide JDL's of individual subjobs in a more efficient * way than logging them one by one. - * \param jdls array of JDL's - * \param subjobs array of jobid's in the same order + * \param[in] jdls array of JDL's + * \param[in] subjobs array of jobid's in the same order */ extern int edg_wll_RegisterSubjobs( @@ -410,6 +391,22 @@ extern int edg_wll_RegisterSubjobs( /** + * Register subjobs to LB Proxyin a batch. + * Mainly used to provide JDL's of individual subjobs in a more efficient + * way than logging them one by one. + * \param[in] jdls array of JDL's + * \param[in] subjobs array of jobid's in the same order + */ + +extern int edg_wll_RegisterSubjobsProxy( + edg_wll_Context context, + const edg_wlc_JobId parent, + char const * const * jdls, + const char * ns, + edg_wlc_JobId const * subjobs +); + +/** * Generate or regenerate set of subjob ID's. * Calls the same algorithm used to generate subjob ID's in edg_wll_RegisterJob(). * Local semantics only, server is not contacted. diff --git a/org.glite.lb.client/src/producer.c b/org.glite.lb.client/src/producer.c index bd6905c..49b4549 100644 --- a/org.glite.lb.client/src/producer.c +++ b/org.glite.lb.client/src/producer.c @@ -789,8 +789,12 @@ static int edg_wll_RegisterJobMaster( (char *)jdl,ns,parent_s,type_s,num_subjobs,intseed); } } else if (flags & LOGFLAG_NORMAL) { - edg_wll_SetError(context,EINVAL, - "edg_wll_RegisterJobMaster(): register via interlogger is no more supported"); + /* SetLoggingJob and log normally the message through the locallogger */ + if (edg_wll_SetLoggingJob(context,job,NULL,EDG_WLL_SEQ_NORMAL) == 0) { + edg_wll_LogEventMaster(context, LOGFLAG_NORMAL, + EDG_WLL_EVENT_REGJOB,EDG_WLL_FORMAT_REGJOB, + (char *)jdl,ns,parent_s,type_s,num_subjobs,intseed); + } } else { edg_wll_SetError(context,EINVAL,"edg_wll_RegisterJobMaster(): wrong flag specified"); } @@ -831,6 +835,26 @@ int edg_wll_RegisterJob( return edg_wll_RegisterJobMaster(context,LOGFLAG_DIRECT,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs); } +int edg_wll_RegisterJobProxy( + edg_wll_Context context, + const edg_wlc_JobId job, + enum edg_wll_RegJobJobtype type, + const char * jdl, + const char * ns, + int num_subjobs, + const char * seed, + edg_wlc_JobId ** subjobs) +{ + /* first register with bkserver */ + int ret = edg_wll_RegisterJob(context,job,type,jdl,ns,num_subjobs,seed,subjobs); + if (ret) { + edg_wll_UpdateError(context,0,"edg_wll_RegisterJobProxy(): unable to register with bkserver"); + return edg_wll_Error(context,NULL,NULL); + } + /* and then with L&B Proxy */ + return edg_wll_RegisterJobMaster(context,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs); +} + int edg_wll_RegisterSubjob( edg_wll_Context context, const edg_wlc_JobId job, @@ -842,11 +866,29 @@ int edg_wll_RegisterSubjob( const char * seed, edg_wlc_JobId ** subjobs) { - return edg_wll_RegisterJobMaster(context,LOGFLAG_DIRECT,job,type,jdl,ns,parent,num_subjobs,seed,subjobs); + return edg_wll_RegisterJobMaster(context,LOGFLAG_NORMAL,job,type,jdl,ns,parent,num_subjobs,seed,subjobs); } -int edg_wll_RegisterSubjobs(edg_wll_Context ctx,const edg_wlc_JobId parent, - char const * const * jdls, const char * ns, edg_wlc_JobId const * subjobs) +int edg_wll_RegisterSubjobProxy( + edg_wll_Context context, + const edg_wlc_JobId job, + enum edg_wll_RegJobJobtype type, + const char * jdl, + const char * ns, + edg_wlc_JobId parent, + int num_subjobs, + const char * seed, + edg_wlc_JobId ** subjobs) +{ + return edg_wll_RegisterJobMaster(context,LOGFLAG_PROXY,job,type,jdl,ns,parent,num_subjobs,seed,subjobs); +} + +int edg_wll_RegisterSubjobs( + edg_wll_Context ctx, + const edg_wlc_JobId parent, + char const * const * jdls, + const char * ns, + edg_wlc_JobId const * subjobs) { char const * const *pjdl; edg_wlc_JobId const *psubjob; @@ -870,24 +912,33 @@ int edg_wll_RegisterSubjobs(edg_wll_Context ctx,const edg_wlc_JobId parent, return edg_wll_Error(ctx, NULL, NULL); } -int edg_wll_RegisterJobProxy( - edg_wll_Context context, - const edg_wlc_JobId job, - enum edg_wll_RegJobJobtype type, - const char * jdl, - const char * ns, - int num_subjobs, - const char * seed, - edg_wlc_JobId ** subjobs) +int edg_wll_RegisterSubjobsProxy( + edg_wll_Context ctx, + const edg_wlc_JobId parent, + char const * const * jdls, + const char * ns, + edg_wlc_JobId const * subjobs) { - /* first register with bkserver */ - int ret = edg_wll_RegisterJob(context,job,type,jdl,ns,num_subjobs,seed,subjobs); - if (ret) { - edg_wll_UpdateError(context,0,"edg_wll_RegisterJobProxy(): unable to register with bkserver"); - return edg_wll_Error(context,NULL,NULL); + char const * const *pjdl; + edg_wlc_JobId const *psubjob; + edg_wlc_JobId oldctxjob; + char * oldctxseq; + + if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL); + oldctxseq = edg_wll_GetSequenceCode(ctx); + + pjdl = jdls; + psubjob = subjobs; + + while (*pjdl != NULL) { + if (edg_wll_RegisterSubjobProxy(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl, + ns, parent, 0, NULL, NULL) != 0) break; + pjdl++; psubjob++; } - /* and then with L&B Proxy */ - return edg_wll_RegisterJobMaster(context,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs); + + edg_wll_SetLoggingJobProxy(ctx, oldctxjob, oldctxseq, NULL, EDG_WLL_SEQ_NORMAL); + + return edg_wll_Error(ctx, NULL, NULL); } int edg_wll_ChangeACL(