goto fetch_cycle_cleanup;
}
- if ( !(match_status_old = match_status(ctx, (&state_out), job_conditions)) )
+ if ( !(match_status_old = match_status(ctx, NULL, (&state_out), job_conditions)) )
{
edg_wll_FreeEvent(out+i);
edg_wll_ResetError(ctx); /* check_strict_jobid() sets it */
}
if (where_flags & FL_FILTER) {
- if ( !match_status(ctx, states_out+i, conditions) )
+ if ( !match_status(ctx, NULL, states_out+i, conditions) )
{
edg_wlc_JobIdFree(jobs_out[i]);
edg_wll_FreeStatus(states_out+i);
/* FIXME: other op's, ORed conditions */
-int match_status(edg_wll_Context ctx, const edg_wll_JobStat *stat, const edg_wll_QueryRec **conds)
+int match_status(edg_wll_Context ctx, const edg_wll_JobStat *oldstat, const edg_wll_JobStat *stat, const edg_wll_QueryRec **conds)
{
int i, j, n;
char *s, *s1;
{
for ( j = 0; conds[i][j].attr; j++ )
{
- if ( is_indexed(&(conds[i][j]), ctx) ) goto or_satisfied;
+ // ignore operator CHANGED for non-notification matches
+ if ( (conds[i][j].op == EDG_WLL_QUERY_OP_CHANGED) && !oldstat) continue;
switch ( conds[i][j].attr )
{
if ( conds[i][j].value.i <= stat->state
&& conds[i][j].value2.i >= stat->state ) goto or_satisfied;
break;
+ case EDG_WLL_QUERY_OP_CHANGED:
+ if ( oldstat->state != stat->state ) goto or_satisfied;
+ break;
}
break;
case EDG_WLL_QUERY_ATTR_RESUBMITTED:
if ( conds[i][j].op == EDG_WLL_QUERY_OP_EQUAL ) {
if ( conds[i][j].value.i == stat->resubmitted ) goto or_satisfied;
- } else if ( conds[i][j].op == EDG_WLL_QUERY_OP_UNEQUAL )
+ } 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:
switch ( conds[i][j].op )
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")) break;
+ if (!strcmp(stat->jdl,"blabla") && conds[i][j].op != EDG_WLL_QUERY_OP_CHANGED) 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;