From 273b089bd97c655e9b851ff7e0237e89be74f549 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Tue, 21 Apr 2009 11:16:25 +0000 Subject: [PATCH] support "changed JDL" notifications --- org.glite.lb.server/src/lb_xml_parse.c.T | 7 ++++--- org.glite.lb.server/src/notification.c | 7 ++++++- org.glite.lb.server/src/query.c | 11 +++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/org.glite.lb.server/src/lb_xml_parse.c.T b/org.glite.lb.server/src/lb_xml_parse.c.T index ee8f4f9..88178dc 100644 --- a/org.glite.lb.server/src/lb_xml_parse.c.T +++ b/org.glite.lb.server/src/lb_xml_parse.c.T @@ -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; } diff --git a/org.glite.lb.server/src/notification.c b/org.glite.lb.server/src/notification.c index 7e8416a..024b932 100644 --- a/org.glite.lb.server/src/notification.c +++ b/org.glite.lb.server/src/notification.c @@ -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]; diff --git a/org.glite.lb.server/src/query.c b/org.glite.lb.server/src/query.c index 4a79e2d..12fd8f3 100644 --- a/org.glite.lb.server/src/query.c +++ b/org.glite.lb.server/src/query.c @@ -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; -- 1.8.2.3