#include "db_supp.h"
#include "index.h"
-static int notif_match_conditions(edg_wll_Context,const edg_wll_JobStat *,const char *);
+static int notif_match_conditions(edg_wll_Context,const edg_wll_JobStat *,const edg_wll_JobStat *,const char *);
static int notif_check_acl(edg_wll_Context,const edg_wll_JobStat *,const char *);
extern int debug;
if (debug) fprintf(stderr,"[%d] NOTIFY:%s expired at %s UTC\n",
getpid(),jobc[0],asctime(gmtime(&expires)));
}
- else if (notif_match_conditions(ctx,stat,jobc[4]) &&
+ else if (notif_match_conditions(ctx,oldstat,stat,jobc[4]) &&
notif_check_acl(ctx,stat,jobc[3]))
{
char *dest, *aux;
}
-static int notif_match_conditions(edg_wll_Context ctx,const edg_wll_JobStat *stat,const char *cond)
+static int notif_match_conditions(edg_wll_Context ctx,const edg_wll_JobStat *oldstat, const edg_wll_JobStat *stat,const char *cond)
{
edg_wll_QueryRec **c,**p;
int match,i;
return 1;
}
- match = match_status(ctx,stat,(const edg_wll_QueryRec **) c);
+ match = match_status(ctx,oldstat,stat,(const edg_wll_QueryRec **) c);
if ( c )
{
for (p = c; *p; p++) {
if ( conds[i][j].value.i == stat->resubmitted ) goto or_satisfied;
} else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL ) {
if ( conds[i][j].value.i != stat->resubmitted ) goto or_satisfied;
- } else if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if ( oldstat->resubmitted != stat->resubmitted ) goto or_satisfied;
}
break;
case EDG_WLL_QUERY_ATTR_DONECODE:
if ( conds[i][j].value.i <= stat->done_code
&& conds[i][j].value2.i >= stat->done_code ) goto or_satisfied;
break;
- case EDG_WLL_QUERY_OP_CHANGED:
- if ( oldstat->done_code != stat->done_code ) goto or_satisfied;
- break;
}
break;
case EDG_WLL_QUERY_ATTR_EXITCODE:
if ( conds[i][j].value.i <= stat->exit_code
&& conds[i][j].value2.i >= stat->exit_code ) goto or_satisfied;
break;
- case EDG_WLL_QUERY_OP_CHANGED:
- if ( oldstat->exit_code != stat->exit_code ) goto or_satisfied;
- break;
}
break;
case EDG_WLL_QUERY_ATTR_OWNER:
if (edg_wll_gss_equal_subj(ctx->peerName, stat->owner) ) {
if ( conds[i][j].op == EDG_WLL_QUERY_OP_EQUAL ) goto or_satisfied;
} else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL ) goto or_satisfied;
- } else if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if (!edg_wll_gss_equal_subj(oldstat->owner, stat->owner) ) goto or_satisfied;
}
}
break;
if ( conds[i][j].op == EDG_WLL_QUERY_OP_EQUAL ) goto or_satisfied;
} else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL ) goto or_satisfied;
}
- if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if ( (oldstat->location && !stat->location) ||
- (!oldstat->location && stat->location) ) goto or_satisfied;
- if ( oldstat->location && stat->location &&
- strcmp(oldstat->location,stat->location) ) goto or_satisfied;
- }
break;
case EDG_WLL_QUERY_ATTR_DESTINATION:
if ( stat->destination )
if ( conds[i][j].op == EDG_WLL_QUERY_OP_EQUAL ) goto or_satisfied;
} else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL ) goto or_satisfied;
}
- if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if ( (oldstat->destination && !stat->destination) ||
- (!oldstat->destination && stat->destination) ) goto or_satisfied;
- if ( oldstat->destination && stat->destination &&
- strcmp(oldstat->destination,stat->destination) ) goto or_satisfied;
- }
case EDG_WLL_QUERY_ATTR_NETWORK_SERVER:
if ( stat->network_server )
{
} else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL ) goto or_satisfied;
}
break;
- if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if ( (oldstat->network_server && !stat->network_server) ||
- (!oldstat->network_server && stat->network_server) ) goto or_satisfied;
- if ( oldstat->network_server && stat->network_server &&
- strcmp(oldstat->network_server,stat->network_server) ) goto or_satisfied;
- }
case EDG_WLL_QUERY_ATTR_JOBID:
if ( !stat->jobId )
break;
}
if ( !stat->user_tags[n].tag && conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL )
goto or_satisfied;
- if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if ( (oldstat->user_tags && !stat->user_tags) ||
- (!oldstat->user_tags && stat->user_tags) ) goto or_satisfied;
- if ( oldstat->user_tags && stat->user_tags ) {
- for ( n = 0; stat->user_tags[n].tag; n++ )
- if ( !oldstat->user_tags[n].tag ) goto or_satisfied;
- if ( strcmp(oldstat->user_tags[n].tag,stat->user_tags[n].tag) ) goto or_satisfied;
- else {
- if ( strcmp(oldstat->user_tags[n].value, stat->user_tags[n].value) ) goto or_satisfied;
- }
- }
- }
-
break;
case EDG_WLL_QUERY_ATTR_TIME:
if ( !stat->stateEnterTimes || !stat->stateEnterTimes[1+conds[i][j].attr_id.state] )
if ( conds[i][j].value.t.tv_sec <= stat->stateEnterTimes[1+conds[i][j].attr_id.state]
&& conds[i][j].value2.t.tv_sec >= stat->stateEnterTimes[1+conds[i][j].attr_id.state] ) goto or_satisfied;
break;
- case EDG_WLL_QUERY_OP_CHANGED:
- if ( oldstat->stateEnterTimes[1+conds[i][j].attr_id.state] != stat->stateEnterTimes[1+conds[i][j].attr_id.state] ) goto or_satisfied;
- break;
}
break;
case EDG_WLL_QUERY_ATTR_JDL_ATTR:
- if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- if ( (oldstat->jdl && !stat->jdl) ||
- (!oldstat->jdl && stat->jdl) ) goto or_satisfied;
- }
if (stat->jdl != NULL) {
struct cclassad *ad = NULL;
char *extr_val = NULL;
// Jobs that do not have a JDL come with blabla:
- if (!strcmp(stat->jdl,"blabla") && conds[i][j].op != EDG_WLL_QUERY_OP_CHANGED) break;
+ if (!strcmp(stat->jdl,"blabla")) break;
ad = cclassad_create(stat->jdl);
if (ad) {
else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL ) goto or_satisfied;
}
}
- if ( conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED ) {
- struct cclassad *ad2 = NULL;
- char *extr_val2 = NULL;
-
- // Jobs that do not have a JDL come with blabla:
- if ( (!strcmp(stat->jdl,"blabla") && strcmp(oldstat->jdl,"blabla")) ||
- (strcmp(stat->jdl,"blabla") && !strcmp(oldstat->jdl,"blabla")) ) goto or_satisfied;
-
- ad2 = cclassad_create(oldstat->jdl);
- if (ad2) {
- if (!cclassad_evaluate_to_string(ad2, conds[i][j].attr_id.tag, &extr_val2)) // Extract attribute value
- extr_val2 = NULL;
- cclassad_delete(ad2);
- }
- if (extr_val2) {
- if ( strcmp(extr_val, extr_val2) ) goto or_satisfied;
- }
- }
}
break;
case EDG_WLL_QUERY_ATTR_STATEENTERTIME:
if ( conds[i][j].value.t.tv_sec <= stat->stateEnterTime.tv_sec
&& conds[i][j].value2.t.tv_sec >= stat->stateEnterTime.tv_sec ) goto or_satisfied;
break;
- case EDG_WLL_QUERY_OP_CHANGED:
- if ( oldstat->stateEnterTime.tv_sec != stat->stateEnterTime.tv_sec ) goto or_satisfied;
- break;
}
case EDG_WLL_QUERY_ATTR_LASTUPDATETIME:
if ( !stat->lastUpdateTime.tv_sec )
if ( conds[i][j].value.t.tv_sec <= stat->lastUpdateTime.tv_sec
&& conds[i][j].value2.t.tv_sec >= stat->lastUpdateTime.tv_sec ) goto or_satisfied;
break;
- case EDG_WLL_QUERY_OP_CHANGED:
- if ( oldstat->lastUpdateTime.tv_sec != stat->lastUpdateTime.tv_sec ) goto or_satisfied;
- break;
}
default:
break;