From: Aleš Křenek Date: Wed, 26 Mar 2008 15:46:54 +0000 (+0000) Subject: check 'owner' index in the direct UserJobs query; return jobids only if not X-Git-Tag: merge_313_4~20 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=ffdc84b366cecc8f6fe89d65a91f6b72645afe8e;p=jra1mw.git check 'owner' index in the direct UserJobs query; return jobids only if not configured --- diff --git a/org.glite.lb.server/interface/query.h b/org.glite.lb.server/interface/query.h index 66a6d67..3b0e1b8 100644 --- a/org.glite.lb.server/interface/query.h +++ b/org.glite.lb.server/interface/query.h @@ -12,6 +12,7 @@ int convert_event_head(edg_wll_Context,char **,edg_wll_Event *); int check_strict_jobid(edg_wll_Context, glite_jobid_const_t); int match_status(edg_wll_Context, const edg_wll_JobStat *stat,const edg_wll_QueryRec **conditions); +int check_job_query_index(edg_wll_Context, const edg_wll_QueryRec **); #define NOTIF_ALL_JOBS "all_jobs" diff --git a/org.glite.lb.server/src/query.c b/org.glite.lb.server/src/query.c index c0d0b95..baa2751 100644 --- a/org.glite.lb.server/src/query.c +++ b/org.glite.lb.server/src/query.c @@ -34,7 +34,6 @@ static int check_event_query_index(edg_wll_Context,const edg_wll_QueryRec **,const edg_wll_QueryRec **); -static int check_job_query_index(edg_wll_Context, const edg_wll_QueryRec **); static char *jc_to_head_where(edg_wll_Context, const edg_wll_QueryRec **, int *); static char *ec_to_head_where(edg_wll_Context, const edg_wll_QueryRec **); static int match_flesh_conditions(const edg_wll_Event *,const edg_wll_QueryRec **); @@ -535,7 +534,7 @@ static int check_event_query_index(edg_wll_Context ctx,const edg_wll_QueryRec ** is_all_query(jc) ? "\"-all\" queries denied by server configuration" : NULL); } -static int check_job_query_index(edg_wll_Context ctx, const edg_wll_QueryRec **jc) +int check_job_query_index(edg_wll_Context ctx, const edg_wll_QueryRec **jc) { int i, j, jj; diff --git a/org.glite.lb.server/src/userjobs.c b/org.glite.lb.server/src/userjobs.c index e78e249..1ded648 100644 --- a/org.glite.lb.server/src/userjobs.c +++ b/org.glite.lb.server/src/userjobs.c @@ -12,6 +12,7 @@ #include "jobstat.h" #include "db_supp.h" +#include "query.h" int edg_wll_UserJobsServer( edg_wll_Context ctx, @@ -70,17 +71,30 @@ int edg_wll_UserJobsServer( free(res); res = NULL; } - if (states) *states = calloc(njobs+1, sizeof(**states)); - idx = 0; - for (i = 0; i < njobs; i++) { - if (edg_wll_JobStatusServer(ctx, out[idx], -1, &(*states)[idx]) != 0) { - if (edg_wll_Error(ctx, NULL, NULL) == ENOENT) { - /* some jobs may be purged meanwhile, ignore */ - continue; + if (states) { + edg_wll_QueryRec oc[2],*ocp[2] = { oc, NULL }; + + oc[0].attr = EDG_WLL_QUERY_ATTR_OWNER; + oc[1].attr = EDG_WLL_QUERY_ATTR_UNDEF; + + if (check_job_query_index(ctx,ocp)) { + edg_wll_ResetError(ctx); + *states = NULL; + goto err; + } + + *states = calloc(njobs+1, sizeof(**states)); + idx = 0; + for (i = 0; i < njobs; i++) { + if (edg_wll_JobStatusServer(ctx, out[idx], -1, &(*states)[idx]) != 0) { + if (edg_wll_Error(ctx, NULL, NULL) == ENOENT) { + /* some jobs may be purged meanwhile, ignore */ + continue; + } + else break; } - else break; + idx++; } - idx++; } err: free(res);