From: Aleš Křenek Date: Tue, 21 Apr 2009 11:14:56 +0000 (+0000) Subject: example of specific LB harvester use of notifications X-Git-Tag: glite-lbjp-common-db_R_1_0_0_7~13 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=c7f1fb42cb8b1d6db5882d6676cd62de409547b9;p=jra1mw.git example of specific LB harvester use of notifications --- diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index ff7f5d1..e85b7a1 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -138,7 +138,7 @@ PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la TOOLS:=${LB_PERF_TOOLS} -EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c +EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c test_changed_jdl.c EXAMPLES:=${EXAMPLES_SRC:.c=} # TODO: migrate them here from branch_RC31_3 diff --git a/org.glite.lb.client/examples/test_changed_jdl.c b/org.glite.lb.client/examples/test_changed_jdl.c new file mode 100644 index 0000000..5f328f4 --- /dev/null +++ b/org.glite.lb.client/examples/test_changed_jdl.c @@ -0,0 +1,45 @@ +#include +#include + +#include "notification.h" + +int main(int argc,char **argv) +{ + edg_wll_Context ctx; + edg_wll_QueryRec chj[2], chs[2], *ch2[3] = { chj, chs, NULL }; + char *et,*ed; + edg_wll_NotifId id; + edg_wll_JobStat stat; + time_t valid = 0; + + edg_wll_InitContext(&ctx); + + memset(&chj,0,sizeof chj); + chj[0].op = EDG_WLL_QUERY_OP_CHANGED; + chj[0].attr = EDG_WLL_QUERY_ATTR_JDL_ATTR; + chj[0].attr_id.tag = NULL; + + memset(&chs,0,sizeof chs); + chs[0].op = EDG_WLL_QUERY_OP_EQUAL; + chs[0].attr = EDG_WLL_QUERY_ATTR_STATUS; + chs[0].value.i = EDG_WLL_JOB_WAITING; + + if (edg_wll_NotifNew(ctx,ch2,EDG_WLL_STAT_CLASSADS,-1,NULL,&id,&valid)) { + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"edg_wll_NotifNew(): %s %s\n",et,ed); + return 1; + } + + printf("notif %s\n",edg_wll_NotifIdUnparse(id)); + + for (;;) { + struct timeval tv = {120,0}; + if (edg_wll_NotifReceive(ctx,-1,&tv,&stat,&id)) { + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"edg_wll_NotifReceive(): %s %s\n",et,ed); + return 1; + } + + printf("JDL: %s\n",stat.jdl); + } +}