check 'owner' index in the direct UserJobs query; return jobids only if not
authorAleš Křenek <ljocha@ics.muni.cz>
Wed, 26 Mar 2008 15:46:54 +0000 (15:46 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Wed, 26 Mar 2008 15:46:54 +0000 (15:46 +0000)
configured

org.glite.lb.server/interface/query.h
org.glite.lb.server/src/query.c
org.glite.lb.server/src/userjobs.c

index 66a6d67..3b0e1b8 100644 (file)
@@ -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"
 
index c0d0b95..baa2751 100644 (file)
@@ -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;
 
index e78e249..1ded648 100644 (file)
@@ -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);