example of specific LB harvester use of notifications
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 21 Apr 2009 11:14:56 +0000 (11:14 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 21 Apr 2009 11:14:56 +0000 (11:14 +0000)
org.glite.lb.client/Makefile
org.glite.lb.client/examples/test_changed_jdl.c [new file with mode: 0644]

index ff7f5d1..e85b7a1 100644 (file)
@@ -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 (file)
index 0000000..5f328f4
--- /dev/null
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <string.h>
+
+#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);
+       }
+}