From: Michal Voců Date: Thu, 11 Oct 2012 10:06:52 +0000 (+0000) Subject: add context parameters for sending events to files for IL X-Git-Tag: glite-jobid-api-c_R_2_2_3_1~20 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=cdfc6fdb6d176115a95f0ec6e40a99e312edb622;p=jra1mw.git add context parameters for sending events to files for IL --- diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index 2635b1d..7d1b5ed 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -188,8 +188,13 @@ glite_lb_padded_struct(_edg_wll_Context,150, char *authz_policy_file; char *html_header_file; - + _edg_wll_id_mapping id_mapping; + + char *p_event_file_prefix; + + char *p_il_sock; + ) /* to be used internally: set, update and and clear the error information in diff --git a/org.glite.lb.common/interface/context.h b/org.glite.lb.common/interface/context.h index a4a47f1..d4db325 100644 --- a/org.glite.lb.common/interface/context.h +++ b/org.glite.lb.common/interface/context.h @@ -73,6 +73,8 @@ typedef enum _edg_wll_ContextParam { EDG_WLL_PARAM_LBPROXY_SERVE_SOCK,/**< lbproxy serve socket path */ EDG_WLL_PARAM_LBPROXY_USER, /**< user credentials when logging to L&B Proxy */ EDG_WLL_PARAM_JPREG_TMPDIR, /**< maildir storage path */ + EDG_WLL_PARAM_LOG_FILE_PREFIX, /**< logging file prefix */ + EDG_WLL_PARAM_LOG_IL_SOCK, /**< interlogger socket path */ EDG_WLL_PARAM__LAST, /**< marker, LB internal use only */ } edg_wll_ContextParam; diff --git a/org.glite.lb.common/interface/events.h.T b/org.glite.lb.common/interface/events.h.T index 315f735..c3cb1e6 100644 --- a/org.glite.lb.common/interface/events.h.T +++ b/org.glite.lb.common/interface/events.h.T @@ -477,6 +477,7 @@ for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} } #define EDG_WLL_LOGFLAG_DIRECT 16 /**< logging directly to bkserver */ #define EDG_WLL_LOGFLAG_INTERNAL 32 /**< internally generated event, don't forward */ #define EDG_WLL_LOGLFLAG_EXCL 64 /**< exclusive flag, to be used with RegisterJob only (if job already exists, than registration fails) */ +#define EDG_WLL_LOGFLAG_FILE 128 /**< logging to local file to be consumed by IL (IL must be running on the same node, which is not a typical setup) */ /* *@} end of group diff --git a/org.glite.lb.common/src/param.c b/org.glite.lb.common/src/param.c index 2ebaf8b..67f0f5e 100644 --- a/org.glite.lb.common/src/param.c +++ b/org.glite.lb.common/src/param.c @@ -58,6 +58,8 @@ static const char *myenv[] = { "%sLBPROXY_SERVE_SOCK", "%sLBPROXY_USER", "%sJPREG_TMPDIR", + "%sLOG_FILE_PREFIX", + "%sLOG_IL_SOCK", }; /* XXX: does not parse URL, just hostname[:port] */ @@ -204,6 +206,17 @@ int edg_wll_SetParamString(edg_wll_Context ctx,edg_wll_ContextParam param,const free(ctx->jpreg_dir); ctx->jpreg_dir = val ? strdup(val) : NULL; break; + case EDG_WLL_PARAM_LOG_FILE_PREFIX: + if(!val) val = mygetenv(param); + free(ctx->p_event_file_prefix); + ctx->p_event_file_prefix = val ? strdup(val) : NULL; + break; + case EDG_WLL_PARAM_LOG_IL_SOCK: + if(!val) val = mygetenv(param); + free(ctx->p_il_sock); + ctx->p_il_sock = val ? strdup(val) : NULL; + break; + default: return edg_wll_SetError(ctx,EINVAL,"unknown parameter"); } @@ -355,6 +368,8 @@ int edg_wll_SetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) case EDG_WLL_PARAM_LBPROXY_SERVE_SOCK: case EDG_WLL_PARAM_LBPROXY_USER: case EDG_WLL_PARAM_JPREG_TMPDIR: + case EDG_WLL_PARAM_LOG_FILE_PREFIX: + case EDG_WLL_PARAM_LOG_IL_SOCK: return edg_wll_SetParamString(ctx,param,va_arg(ap,char *)); case EDG_WLL_PARAM_LOG_TIMEOUT: case EDG_WLL_PARAM_LOG_SYNC_TIMEOUT: @@ -468,6 +483,14 @@ int edg_wll_GetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) p_string = va_arg(ap, char **); *p_string = estrdup(ctx->jpreg_dir); break; + case EDG_WLL_PARAM_LOG_FILE_PREFIX: + p_string = va_arg(ap, char **); + *p_string = estrdup(ctx->p_event_file_prefix); + break; + case EDG_WLL_PARAM_LOG_IL_SOCK: + p_string = va_arg(ap, char **); + *p_string = estrdup(ctx->p_il_sock); + break; case EDG_WLL_PARAM_LOG_TIMEOUT: p_tv = va_arg(ap,struct timeval *); *p_tv = ctx->p_log_timeout; @@ -484,7 +507,7 @@ int edg_wll_GetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) p_tv = va_arg(ap,struct timeval *); *p_tv = ctx->p_notif_timeout; break; - + default: return edg_wll_SetError(ctx, EINVAL, "unknown parameter"); break; @@ -506,6 +529,8 @@ void edg_wll_FreeParams(edg_wll_Context ctx) { if (ctx->p_key_filename) free(ctx->p_key_filename); if (ctx->p_lbproxy_store_sock) free(ctx->p_lbproxy_store_sock); if (ctx->p_lbproxy_serve_sock) free(ctx->p_lbproxy_serve_sock); + if (ctx->p_event_file_prefix) free(ctx->p_event_file_prefix); + if (ctx->p_il_sock) free(ctx->p_il_sock); ctx->p_jobid = NULL; ctx->p_host = NULL; @@ -519,6 +544,8 @@ void edg_wll_FreeParams(edg_wll_Context ctx) { ctx->p_key_filename = NULL; ctx->p_lbproxy_store_sock = NULL; ctx->p_lbproxy_serve_sock = NULL; + ctx->p_event_file_prefix = NULL; + ctx->p_il_sock = NULL; /* do not free (references only) * ctx->job_index