support "changed JDL" notifications
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 21 Apr 2009 11:16:25 +0000 (11:16 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 21 Apr 2009 11:16:25 +0000 (11:16 +0000)
org.glite.lb.server/src/lb_xml_parse.c.T
org.glite.lb.server/src/notification.c
org.glite.lb.server/src/query.c

index ee8f4f9..88178dc 100644 (file)
@@ -123,9 +123,10 @@ static void startJobQueryRec(void *data, const char *el, const char **attr)
                                        XMLCtx->job_conditions[XMLCtx->row][XMLCtx->position].attr_id.state = edg_wll_StringToStat(attr[1]);
                                }
                                if ( (i+1) == EDG_WLL_QUERY_ATTR_JDL_ATTR) {
-                                       if (!attr[0] || !attr[1]) { unexp() break;}
-                                       if (strcmp(attr[0],"name")) { unexp() break;}
-                                       XMLCtx->job_conditions[XMLCtx->row][XMLCtx->position].attr_id.tag = strdup(attr[1]);
+                                       if (!attr[0] || !attr[1]) 
+                                               XMLCtx->job_conditions[XMLCtx->row][XMLCtx->position].attr_id.tag = NULL;
+                                       else if (strcmp(attr[0],"name")) { unexp() break;}
+                                       else XMLCtx->job_conditions[XMLCtx->row][XMLCtx->position].attr_id.tag = strdup(attr[1]);
                                } 
                                XMLCtx->job_conditions[XMLCtx->row][XMLCtx->position].attr = i+1;
                        }               
index 7e8416a..024b932 100644 (file)
@@ -717,7 +717,12 @@ static int get_indexed_cols(edg_wll_Context ctx,char const *notif,edg_wll_QueryR
        char    *cols = NULL,*aux;
 
        for (i=0; conds && conds[i]; i++) {
-               for (j=0; notif_cols[j].qrec.attr && notif_cols[j].qrec.attr != conds[i]->attr; j++);
+               for (j=0; notif_cols[j].qrec.attr &&
+                       (notif_cols[j].qrec.attr != conds[i]->attr || 
+                               (notif_cols[j].qrec.attr == EDG_WLL_QUERY_ATTR_JDL_ATTR && 
+                                       (!conds[i]->attr_id.tag || strcmp(notif_cols[j].qrec.attr_id.tag,conds[i]->attr_id.tag))
+                               )
+                       ); j++);
                if (notif_cols[j].qrec.attr) {
                        if (conds[i][1].attr && conds[i][0].op != EDG_WLL_QUERY_OP_EQUAL) {
                                char    buf[1000];
index 4a79e2d..12fd8f3 100644 (file)
@@ -1590,8 +1590,15 @@ int match_status(edg_wll_Context ctx, const edg_wll_JobStat *oldstat, const edg_
                                }
                                break;
                        case EDG_WLL_QUERY_ATTR_JDL_ATTR:
-
-                               if (stat->jdl != NULL) {
+                               if (conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED && 
+                                       conds[i][j].attr_id.tag == NULL &&
+                                       oldstat && 
+                                       (oldstat->jdl == NULL || 
+                                               (stat->jdl && strcmp(oldstat->jdl,stat->jdl))
+                                       )
+                               ) goto or_satisfied;
+
+                               if (stat->jdl != NULL && conds[i][j].attr_id.tag) {
                                        struct cclassad *ad = NULL;
                                        char *extr_val = NULL;