+
This directory contains source code of examples from LB Developer's Guide
To build these examples, set the GLITE_LOCATION variable and run make.
+
+Consumer examples:
+
+cons_example1
+-------------
+Retrieves a list of jobs based on state and destination.
+
+cons_example2
+-------------
+Retrieves a list of jobs based on state and ORed destination conditions.
+
+
+cons_example3
+-------------
+Retrieves a list of jobs based on ORed user tag conditions.
+
static struct option opts[] = {
{"help", 0, NULL, 'h'},
- {"sock", 1, NULL, 's'},
+ {"server", 1, NULL, 's'},
+ {"port", 1, NULL, 'p'},
{"jobid", 1, NULL, 'j'},
{"user", 1, NULL, 'u'},
};
{
fprintf(stderr, "usage: %s [option]\n"
"\t-h, --help Shows this screen.\n"
- "\t-s, --server LB Proxy socket.\n"
+ "\t-s, --server Server address.\n"
+ "\t-p, --port Query server port.\n"
"\t-j, --jobid ID of requested job.\n"
"\t-u, --user User DN.\n"
, me);
{
char *server, *jobid_s, *user;
int opt, err = 0;
+ edg_wlc_JobId jobid = NULL;
+ long i;
+ int port = 0;
- server = code = jobid_s = name = value = NULL;
- while ( (opt = getopt_long(argc, argv, "hs:j:u:c:n:v:", opts, NULL)) != EOF)
+ server = jobid_s = user = NULL;
+ while ( (opt = getopt_long(argc, argv, "hs:p:j:u:c:n:v:", opts, NULL)) != EOF)
switch (opt) {
- case 'h': usage(name); return 0;
+ case 'h': usage(argv[0]); return 0;
case 's': server = strdup(optarg); break;
+ case 'p': port = atoi(optarg); break;
case 'j': jobid_s = strdup(optarg); break;
case 'u': user = strdup(optarg); break;
- case '?': usage(name); return 1;
+ case '?': usage(argv[0]); return 1;
}
if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
- if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
+ //if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
/*variables*/
edg_wll_Context ctx;
edg_wll_InitContext(&ctx);
edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, port);
+ if (port) edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, port);
/*end context*/
/*queryrec*/
if ( err == E2BIG ) {
fprintf(stderr,"Warning: only limited result returned!\n");
return 0;
- } elseif (err) {
+ } else if (err) {
char *et,*ed;
edg_wll_Error(ctx,&et,&ed);
static struct option opts[] = {
{"help", 0, NULL, 'h'},
- {"sock", 1, NULL, 's'},
+ {"server", 1, NULL, 's'},
+ {"port", 1, NULL, 'p'},
{"jobid", 1, NULL, 'j'},
{"user", 1, NULL, 'u'},
};
{
fprintf(stderr, "usage: %s [option]\n"
"\t-h, --help Shows this screen.\n"
- "\t-s, --server LB Proxy socket.\n"
+ "\t-s, --server LB server.\n"
+ "\t-p, --port LB server port.\n"
"\t-j, --jobid ID of requested job.\n"
"\t-u, --user User DN.\n"
, me);
int main(int argc, char *argv[])
{
char *server, *jobid_s, *user;
+ edg_wlc_JobId jobid = NULL;
int opt, err = 0;
+ long i;
+ int port = 0;
- server = code = jobid_s = name = value = NULL;
- while ( (opt = getopt_long(argc, argv, "hs:j:u:c:n:v:", opts, NULL)) != EOF)
+ server = jobid_s = user = NULL;
+ while ( (opt = getopt_long(argc, argv, "hs:p:j:u:c:n:v:", opts, NULL)) != EOF)
switch (opt) {
- case 'h': usage(name); return 0;
+ case 'h': usage(argv[0]); return 0;
case 's': server = strdup(optarg); break;
+ case 'p': port = atoi(optarg); break;
case 'j': jobid_s = strdup(optarg); break;
case 'u': user = strdup(optarg); break;
- case '?': usage(name); return 1;
+ case '?': usage(argv[0]); return 1;
}
if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
- if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
/*variables*/
edg_wll_Context ctx;
edg_wll_InitContext(&ctx);
edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, port);
+ if (port) edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, port);
/*end context*/
/*queryrec*/
if ( err == E2BIG ) {
fprintf(stderr,"Warning: only limited result returned!\n");
return 0;
- } elseif (err) {
+ } else if (err) {
char *et,*ed;
edg_wll_Error(ctx,&et,&ed);
static struct option opts[] = {
{"help", 0, NULL, 'h'},
- {"sock", 1, NULL, 's'},
+ {"server", 1, NULL, 's'},
+ {"port", 1, NULL, 'p'},
{"jobid", 1, NULL, 'j'},
{"user", 1, NULL, 'u'},
};
{
fprintf(stderr, "usage: %s [option]\n"
"\t-h, --help Shows this screen.\n"
- "\t-s, --server LB Proxy socket.\n"
+ "\t-s, --server LB server.\n"
+ "\t-p, --port LB server port.\n"
"\t-j, --jobid ID of requested job.\n"
"\t-u, --user User DN.\n"
, me);
{
char *server, *jobid_s, *user;
int opt, err = 0;
+ edg_wlc_JobId jobid = NULL;
+ long i;
+ int port = 0;
- server = code = jobid_s = name = value = NULL;
- while ( (opt = getopt_long(argc, argv, "hs:j:u:c:n:v:", opts, NULL)) != EOF)
+
+ server = jobid_s = NULL;
+ while ( (opt = getopt_long(argc, argv, "hs:p:j:u:c:n:v:", opts, NULL)) != EOF)
switch (opt) {
- case 'h': usage(name); return 0;
+ case 'h': usage(argv[0]); return 0;
case 's': server = strdup(optarg); break;
+ case 'p': port = atoi(optarg); break;
case 'j': jobid_s = strdup(optarg); break;
case 'u': user = strdup(optarg); break;
- case '?': usage(name); return 1;
+ case '?': usage(argv[0]); return 1;
}
if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
- if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
/*variables*/
edg_wll_Context ctx;
edg_wll_InitContext(&ctx);
edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER, server);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, port);
+ if (port) edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_SERVER_PORT, port);
/*end context*/
/*queryrec*/
if ( err == E2BIG ) {
fprintf(stderr,"Warning: only limited result returned!\n");
return 0;
- } elseif (err) {
+ } else if (err) {
char *et,*ed;
edg_wll_Error(ctx,&et,&ed);
free(et); free(ed);
}
+ if ( err == ENOENT ) return err;
+
/*printevents*/
- for (i = 0; eventsOut[i].type; i++ ) {
- printf("jobId : %s\n", edg_wlc_JobIdUnparse(eventsOut[i].jobId));
+ for (i = 0; eventsOut && (eventsOut[i].type); i++ ) {
+ //printf("jobId : %s\n", edg_wlc_JobIdUnparse(eventsOut[i].jobId));
printf("event : %s\n\n", edg_wll_EventToString(eventsOut[i].type));
}
/*end printevents*/
if ( eventsOut ) {
- for (i=0; eventsOut[i]; i++) edg_wlc_JobIdFree(eventsOut[i]);
+ for (i=0; &(eventsOut[i]); i++) edg_wll_FreeEvent(&(eventsOut[i]));
free(eventsOut);
}
int opt, err = 0;
- server = code = jobid_s = name = value = NULL;
+ server = seq_code = jobid_s = name = value = NULL;
while ( (opt = getopt_long(argc, argv, "hs:j:u:c:n:v:", opts, NULL)) != EOF)
switch (opt) {
- case 'h': usage(name); return 0;
+ case 'h': usage(argv[0]); return 0;
case 's': server = strdup(optarg); break;
case 'j': jobid_s = strdup(optarg); break;
case 'u': user = strdup(optarg); break;
case 'c': seq_code = strdup(optarg); break;
case 'n': name = strdup(optarg); break;
case 'v': value = strdup(optarg); break;
- case '?': usage(name); return 1;
+ case '?': usage(argv[0]); return 1;
}
if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_USER_INTERFACE);
edg_wll_SetParam(ctx, EDG_WLL_PARAM_HOST, server);
- edg_wll_SetParam(ctx, EDG_WLL_PARAM_PORT, port);
+ //edg_wll_SetParam(ctx, EDG_WLL_PARAM_PORT, port);
/*end context*/
/*sequence*/