LCAS_PLUGIN_LOBJS:=${LCAS_PLUGIN_OBJS:.o=.lo}
LCAS_PLUGIN_LIB:=liblcas_lb.la
-EXAMPLES=ws_getversion ws_jobstat ws_query_ex ws_joblog ws_userjobs
+EXAMPLES=
glite-lb-bkserverd: ${NSMAP} ${BKSERVER_OBJS}
${LINKXX} -o $@ ${BKSERVER_OBJS} ${BKSERVER_LIBS}
examples: ${EXAMPLES}
-ws_getversion: ws_getversion.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
-
-ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
-
-ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
-
-ws_joblog: ws_joblog.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
-
-ws_userjobs: ws_userjobs.o ${WS_CLIENT_OBJS}
- ${LINK} -o $@ $< ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
-
${STATIC_LIB_BK}: ${LIB_OBJS_BK}
ar crv $@ ${LIB_OBJS_BK}
ranlib $@
+++ /dev/null
-#include <getopt.h>
-#include <stdsoap2.h>
-
-#include "glite/security/glite_gsplugin.h"
-#include "glite/lb/consumer.h"
-
-#include "bk_ws_H.h"
-#include "ws_fault.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___lb__GetVersion soap_call___ns1__GetVersion
-#endif
-
-#include "LoggingAndBookkeeping.nsmap"
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"server", 1, NULL, 'm'},
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-m, --server BK server address:port.\n"
- , me);
-}
-
-//static void printstat(edg_wll_JobStat stat, int level);
-
-int main(int argc,char** argv)
-{
- edg_wll_Context ctx;
- glite_gsplugin_Context gsplugin_ctx;
- struct soap soap;
- struct _lbe__GetVersion in;
- struct _lbe__GetVersionResponse out;
- int opt, err;
- char *server = "http://localhost:9003/",
- *name = NULL;
-
-
- name = strrchr(argv[0],'/');
- if (name) name++; else name = argv[0];
-
- while ((opt = getopt_long(argc, argv, "hm:", opts, NULL)) != EOF) switch (opt)
- {
- case 'h': usage(name); return 0;
- case 'm': server = optarg; break;
- case '?': usage(name); return 1;
- }
-
- edg_wll_InitContext(&ctx);
- glite_gsplugin_init_context(&gsplugin_ctx);
-
- memset(&soap, 0, sizeof soap);
- soap_init(&soap);
- soap_set_namespaces(&soap, namespaces);
-
- if ( soap_register_plugin_arg(&soap, glite_gsplugin, (void *)gsplugin_ctx) )
- {
- soap_print_fault(&soap, stderr);
- return 1;
- }
-
- memset(&in, 0, sizeof(in));
- memset(&out, 0, sizeof(out));
- switch (err = soap_call___lb__GetVersion(&soap, server, "", &in, &out))
- {
- case SOAP_OK: printf("Server version: %s\n", out.version); break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- {
- char *et,*ed;
-
- edg_wll_FaultToErr(&soap,ctx);
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed);
- exit(1);
- }
- default:
- printf("???, err=%d\n", err);
- soap_print_fault(&soap, stderr);
- }
-
- soap_end(&soap);
- soap_done(&soap);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
+++ /dev/null
-#include <getopt.h>
-#include <stdsoap2.h>
-
-#include "glite/lb/consumer.h"
-#include "glite/lb/events_parse.h"
-
-#include "soap_version.h"
-#include "glite/security/glite_gsplugin.h"
-#include "glite/security/glite_gscompat.h"
-
-#include "bk_ws_H.h"
-#include "ws_typeref.h"
-#include "ws_fault.h"
-
-#if GSOAP_VERSION <= 20602
-#define soap_call___lb__QueryEvents soap_call___ns1__QueryEvents
-#endif
-
-#include "LoggingAndBookkeeping.nsmap"
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"server", 1, NULL, 'm'},
- {"jobid", 1, NULL, 'j'}
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-m, --server BK server address:port.\n"
- "\t-j, --jobid ID of requested job.\n"
- , me);
-}
-
-static void free_events(edg_wll_Event *events);
-
-int main(int argc,char** argv)
-{
- edg_wll_Context ctx;
- glite_gsplugin_Context gsplugin_ctx;
- struct soap *mydlo = soap_new();
- struct _lbe__QueryEventsResponse out;
- struct _lbe__QueryEvents in;
- edg_wll_QueryRec **jconds = NULL;
- edg_wll_QueryRec j[2], e[1];
- int opt, err, i;
- edg_wlc_JobId job;
- char *server = "http://localhost:9003/",
- *jobid = NULL,
- *name = NULL;
-
-
- name = strrchr(argv[0],'/');
- if (name) name++; else name = argv[0];
-
- while ((opt = getopt_long(argc, argv, "hm:j:", opts, NULL)) != EOF) switch (opt)
- {
- case 'h': usage(name); return 0;
- case 'm': server = optarg; break;
- case 'j': jobid = optarg; break;
- case '?': usage(name); return 1;
- }
-
- if ( !jobid )
- {
- printf("jobid should be given\n");
- usage(name);
- return 1;
- }
- else if (edg_wlc_JobIdParse(jobid,&job)) {
- fprintf(stderr,"%s: can't parse job ID\n",argv[1]);
- return 1;
- }
-
-
- edg_wll_InitContext(&ctx);
- glite_gsplugin_init_context(&gsplugin_ctx);
-
- soap_set_namespaces(mydlo, namespaces);
- if ( soap_register_plugin_arg(mydlo, glite_gsplugin, (void *)gsplugin_ctx) )
- {
- soap_print_fault(mydlo, stderr);
- return 1;
- }
-
- glite_gsplugin_set_udata(mydlo, ctx);
-
- /* prepare job log query */
- memset(j,0,sizeof j);
- memset(e,0,sizeof e);
-
- j[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
- j[0].op = EDG_WLL_QUERY_OP_EQUAL;
- j[0].value.j = job;
-
-
- jconds = (edg_wll_QueryRec **) calloc(2, sizeof(edg_wll_QueryRec *));
- for ( i = 0; i < 1; i++ )
- {
- jconds[i] = (edg_wll_QueryRec *) calloc(2, sizeof(edg_wll_QueryRec));
- jconds[i][0] = j[i];
- }
-
-/* econds = (edg_wll_QueryRec **) calloc(1, sizeof(edg_wll_QueryRec *));
- for ( i = 0; i < 1; i++ )
- {
- econds[i] = (edg_wll_QueryRec *) calloc(1, sizeof(edg_wll_QueryRec));
- econds[i][0] = e[i];
- }*/
-
- memset(&in, 0, sizeof in);
- memset(&out, 0, sizeof out);
-
- soap_begin(mydlo);
- if (edg_wll_QueryCondsExtToSoap(mydlo, (const edg_wll_QueryRec **)jconds,
- &in.__sizejobConditions, &in.jobConditions) != SOAP_OK) {
- printf("Error converting QueryConds to Soap!\n");
- soap_end(mydlo);
- soap_done(mydlo);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
- return(1);
- }
-
- for (i = 0; jconds[i]; i++) {
- if (jconds[i]) edg_wlc_JobIdFree(jconds[i][0].value.j);
- free(jconds[i]);
- }
- free(jconds);
-
- //edg_wll_QueryCondsExtToSoap(mydlo, (const edg_wll_QueryRec **)econds,
- // &in.__sizeeventConditions, &in.eventConditions);
-
- //in.jobConditions = NULL;
- //in.__sizejobConditions = 0;
- in.eventConditions = NULL;
- in.__sizeeventConditions = 0;
-
- switch (err = soap_call___lb__QueryEvents(mydlo, server, "",&in,&out))
- {
- case SOAP_OK:
- {
- edg_wll_Event *events = NULL;
- int i;
-
-
- edg_wll_SoapToEventsQueryRes(mydlo,out,&events);
-
- for ( i = 0; events && events[i].type != EDG_WLL_EVENT_UNDEF; i++ )
- {
- char *e = edg_wll_UnparseEvent(ctx,events+i);
- fputs(e,stdout);
- fputs("\n",stdout);
- free(e);
- }
-
- free_events(events);
- printf("\nFound %d events\n",i);
- }
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- {
- char *et,*ed;
-
- edg_wll_FaultToErr(mydlo,ctx);
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed);
- soap_end(mydlo);
- soap_done(mydlo); free(mydlo);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
- exit(1);
- }
- default:
- fprintf(stderr,"err = %d\n",err);
- soap_print_fault(mydlo,stderr);
- }
-
- soap_end(mydlo/*, out.events*/);
- soap_done(mydlo);
- free(mydlo);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
- return 0;
-}
-
-
-static void free_events(edg_wll_Event *events)
-{
- int i;
-
- if (events) {
- for (i=0; events[i].type != EDG_WLL_EVENT_UNDEF; i++)
- edg_wll_FreeEvent(&(events[i]));
- edg_wll_FreeEvent(&(events[i])); /* free last line */
- free(events);
- events = NULL;
- }
-}
+++ /dev/null
-#include <getopt.h>
-#include <stdsoap2.h>
-#include <expat.h>
-
-#include "soap_version.h"
-#include "glite/security/glite_gsplugin.h"
-#include "glite/security/glite_gscompat.h"
-#include "glite/lb/consumer.h"
-#include "glite/lb/xml_conversions.h"
-
-#include "bk_ws_H.h"
-#include "ws_typeref.h"
-#include "ws_fault.h"
-
-#if GSOAP_VERSION <= 20602
-#define soap_call___lb__JobStatus soap_call___ns1__JobStatus
-#endif
-
-#include "LoggingAndBookkeeping.nsmap"
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"server", 1, NULL, 'm'},
- {"jobid", 1, NULL, 'j'}
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-m, --server BK server address:port.\n"
- "\t-j, --jobid ID of requested job.\n"
- , me);
-}
-
-static void printstat(edg_wll_JobStat stat, int level);
-
-int main(int argc,char** argv)
-{
- edg_wll_Context ctx;
- glite_gsplugin_Context gsplugin_ctx;
- struct soap *mydlo = soap_new();
- struct _lbe__JobStatusResponse out;
- struct _lbe__JobStatus in;
- int opt, err;
- char *server = "http://localhost:9003/",
- *jobid = NULL,
- *name = NULL;
-
-
- name = strrchr(argv[0],'/');
- if (name) name++; else name = argv[0];
-
- while ((opt = getopt_long(argc, argv, "hm:j:", opts, NULL)) != EOF) switch (opt)
- {
- case 'h': usage(name); return 0;
- case 'm': server = optarg; break;
- case 'j': jobid = optarg; break;
- case '?': usage(name); return 1;
- }
-
- if ( !jobid )
- {
- printf("jobid should be given\n");
- usage(name);
- return 1;
- }
-
- edg_wll_InitContext(&ctx);
- soap_set_namespaces(mydlo, namespaces);
- glite_gsplugin_init_context(&gsplugin_ctx);
-
- if ( soap_register_plugin_arg(mydlo, glite_gsplugin, (void *)gsplugin_ctx) )
- {
- soap_print_fault(mydlo, stderr);
- return 1;
- }
-
- glite_gsplugin_set_udata(mydlo, ctx);
-
- in.jobid = soap_strdup(mydlo, jobid);
- in.flags = soap_malloc(mydlo, sizeof(*in.flags));
- edg_wll_JobStatFlagsToSoap(mydlo, 0, in.flags);
-
- switch (err = soap_call___lb__JobStatus(mydlo, server, "",&in,&out))
- {
- case SOAP_OK:
- {
- edg_wll_JobStat s;
-
- edg_wll_SoapToStatus(mydlo,out.stat,&s);
- printstat(s, 0);
- edg_wll_FreeStatus(&s);
- }
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- {
- char *et,*ed;
-
- edg_wll_FaultToErr(mydlo,ctx);
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed);
- exit(1);
- }
- default:
- fprintf(stderr,"err = %d\n",err);
- soap_print_fault(mydlo,stderr);
- }
-
- soap_end(mydlo);
- soap_done(mydlo);
- free(mydlo);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
-
-static void printstat(edg_wll_JobStat stat, int level)
-{
- char *s, *j1,*j2, ind[10];
- int i;
-
-
- for (i=0; i < level; i++)
- ind[i]='\t';
- ind[i]='\0';
-
- s = edg_wll_StatToString(stat.state);
-/* print whole flat structure */
- printf("%sstate : %s\n", ind, s);
- printf("%sjobId : %s\n", ind, j1 = edg_wlc_JobIdUnparse(stat.jobId));
- printf("%sowner : %s\n", ind, stat.owner);
- switch (stat.jobtype) {
- case EDG_WLL_STAT_SIMPLE:
- printf("%sjobtype : SIMPLE\n", ind);
- break;
- case EDG_WLL_STAT_DAG:
- printf("%sjobtype : DAG\n", ind);
- break;
- case EDG_WLL_STAT_COLLECTION:
- printf("%sjobtype : COLLECTION\n", ind);
- break;
- case EDG_WLL_STAT_PBS:
- printf("%sjobtype : PBS\n", ind);
- break;
- default:
- break;
- }
- printf("%sparent_job : %s\n", ind,
- j2 = edg_wlc_JobIdUnparse(stat.parent_job));
- if (stat.jobtype) {;
- printf("%sseed : %s\n", ind, stat.seed);
- printf("%schildren_num : %d\n", ind, stat.children_num);
- printf("%schildren :\n", ind);
- if (stat.children)
- for (i=0; stat.children[i]; i++)
- printf("%s\tchildren : %s\n", ind, stat.children[i]);
- printf("%schildren_states :\n", ind);
- if (stat.children_states)
- for (i=0; stat.children_states[i].state; i++)
- printstat(stat.children_states[i], level+1);
- printf("%schildren_hist :\n",ind);
- if (stat.children_hist)
- for (i=1; i<=stat.children_hist[0]; i++)
- printf("%s%14s %d\n", ind, edg_wll_StatToString(i-1),stat.children_hist[i]);
- }
- printf("%scondorId : %s\n", ind, stat.condorId);
- printf("%sglobusId : %s\n", ind, stat.globusId);
- printf("%slocalId : %s\n", ind, stat.localId);
- printf("%sjdl : %s\n", ind, stat.jdl);
- printf("%smatched_jdl : %s\n", ind, stat.matched_jdl);
- printf("%sdestination : %s\n", ind, stat.destination);
- printf("%snetwork server : %s\n", ind, stat.network_server);
- printf("%scondor_jdl : %s\n", ind, stat.condor_jdl);
- printf("%srsl : %s\n", ind, stat.rsl);
- printf("%sreason : %s\n", ind, stat.reason);
- printf("%slocation : %s\n", ind, stat.location);
- printf("%sce_node : %s\n", ind, stat.ce_node);
- printf("%ssubjob_failed : %d\n", ind, stat.subjob_failed);
- printf("%sdone_code : %s\n", ind, edg_wll_done_codeToString(stat.done_code));
- printf("%sexit_code : %d\n", ind, stat.exit_code);
- printf("%sresubmitted : %d\n", ind, stat.resubmitted);
- printf("%scancelling : %d\n", ind, stat.cancelling);
- printf("%scancelReason : %s\n", ind, stat.cancelReason);
- printf("%scpuTime : %d\n", ind, stat.cpuTime);
- printf("%suser_tags :\n",ind);
- if (stat.user_tags)
- for (i=0; stat.user_tags[i].tag; i++) printf("%s%14s = \"%s\"\n", ind,
- stat.user_tags[i].tag,stat.user_tags[i].value);
- printf("%sstateEnterTime : %ld.%06ld\n", ind, stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec);
- printf("%sstateEnterTimes : \n",ind);
- if (stat.stateEnterTimes)
- for (i=1; i<=stat.stateEnterTimes[0]; i++) {
- time_t st = stat.stateEnterTimes[i];
-
- printf("%s%14s %s", ind, edg_wll_StatToString(i-1), st == 0 ?
- " - not available -\n" : ctime(&st));
- }
- printf("%slastUpdateTime : %ld.%06ld\n", ind, stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec);
- printf("%sexpectUpdate : %d\n", ind, stat.expectUpdate);
- printf("%sexpectFrom : %s\n", ind, stat.expectFrom);
- printf("%sacl : %s\n", ind, stat.acl);
- printf("%spayload_running: %d\n", ind, stat.payload_running);
- if (stat.possible_destinations) {
- printf("%spossible_destinations : \n", ind);
- for (i=0; stat.possible_destinations[i]; i++)
- printf("%s\t%s \n", ind, stat.possible_destinations[i]);
- }
- if (stat.possible_ce_nodes) {
- printf("%spossible_ce_nodes : \n", ind);
- for (i=0; stat.possible_ce_nodes[i]; i++)
- printf("%s\t%s \n", ind, stat.possible_ce_nodes[i]);
- }
- /* PBS state section */
- if (stat.jobtype == EDG_WLL_STAT_PBS) {
- printf("%spbs_state : %s\n", ind, stat.pbs_state);
- printf("%spbs_queue : %s\n", ind, stat.pbs_queue);
- printf("%spbs_owner : %s\n", ind, stat.pbs_owner);
- printf("%spbs_name : %s\n", ind, stat.pbs_name);
- printf("%spbs_reason : %s\n", ind, stat.pbs_reason);
- printf("%spbs_scheduler : %s\n", ind, stat.pbs_scheduler);
- printf("%spbs_dest_host : %s\n", ind, stat.pbs_dest_host);
- printf("%spbs_pid : %d\n", ind, stat.pbs_pid);
- printf("%spbs_resource_usage : %s%s\n", ind,
- (stat.pbs_resource_usage) ? "\n" : "", stat.pbs_resource_usage);
- printf("%spbs_exit_status : %d\n", ind, stat.pbs_exit_status);
- printf("%spbs_error_desc : %s%s\n", ind,
- (stat.pbs_error_desc) ? "\n" : "", stat.pbs_error_desc);
- }
-
- printf("\n");
-
- free(j1);
- free(j2);
- free(s);
-}
-
+++ /dev/null
-#include <getopt.h>
-#include <stdsoap2.h>
-
-#include "glite/lb/consumer.h"
-
-#include "soap_version.h"
-#include "glite/security/glite_gsplugin.h"
-#include "glite/security/glite_gscompat.h"
-
-#include "bk_ws_H.h"
-#include "ws_fault.h"
-#include "ws_typeref.h"
-
-#if GSOAP_VERSION <= 20602
-#define soap_call___lb__QueryJobs soap_call___ns1__QueryJobs
-#endif
-
-#include "LoggingAndBookkeeping.nsmap"
-
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"server", 1, NULL, 'm'}
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-m, --server BK server address:port.\n"
- , me);
-}
-
-static void printstat(edg_wll_JobStat stat, int level);
-
-int main(int argc,char** argv)
-{
- edg_wll_Context ctx;
- glite_gsplugin_Context gsplugin_ctx;
- edg_wll_QueryRec **conditions = NULL;
- struct soap *soap = soap_new();
- struct _lbe__QueryJobs *qjobs = NULL;
- struct _lbe__QueryJobsResponse out;
- int opt, err;
- char *server = "http://localhost:9003/",
- *name = NULL;
- int i;
-
- name = strrchr(argv[0],'/');
- if (name) name++; else name = argv[0];
-
- while ((opt = getopt_long(argc, argv, "hm:", opts, NULL)) != EOF) switch (opt)
- {
- case 'h': usage(name); return 0;
- case 'm': server = optarg; break;
- case '?': usage(name); return 1;
- }
-
- edg_wll_InitContext(&ctx);
- glite_gsplugin_init_context(&gsplugin_ctx);
- soap_set_namespaces(soap, namespaces);
- if ( soap_register_plugin_arg(soap, glite_gsplugin, (void *)gsplugin_ctx) )
- {
- soap_print_fault(soap, stderr);
- return 1;
- }
-
- glite_gsplugin_set_udata(soap, ctx);
-
- conditions = (edg_wll_QueryRec **)calloc(3,sizeof(edg_wll_QueryRec *));
-
- conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
- conditions[0][0].attr = EDG_WLL_QUERY_ATTR_STATUS;
- conditions[0][0].op = EDG_WLL_QUERY_OP_UNEQUAL;
- conditions[0][0].value.i = EDG_WLL_JOB_DONE;
-
- conditions[1] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec));
- conditions[1][0].attr = EDG_WLL_QUERY_ATTR_OWNER;
-#warning FIXME: NULL should work, use optional in WSDL?
-// conditions[1][0].op = EDG_WLL_QUERY_OP_EQUAL;
-// conditions[1][0].value.c = NULL;
- conditions[1][0].op = EDG_WLL_QUERY_OP_UNEQUAL;
- conditions[1][0].value.c = "x";
-
- qjobs = soap_malloc(soap, sizeof(*qjobs));
- memset(qjobs, 0, sizeof(*qjobs));
- qjobs->flags = soap_malloc(soap, sizeof(*qjobs->flags));
- memset(qjobs->flags, 0, sizeof(*qjobs->flags));
- if (!qjobs->flags || edg_wll_QueryCondsExtToSoap(soap, (const edg_wll_QueryRec **)conditions, &qjobs->__sizeconditions, &qjobs->conditions)
- || edg_wll_JobStatFlagsToSoap(soap, EDG_WLL_STAT_CLASSADS || EDG_WLL_STAT_CHILDREN || EDG_WLL_STAT_CHILDSTAT, qjobs->flags) ) {
- char *et,*ed;
-
- fprintf(stderr, "%s: soap types conversion error...\n", argv[0]);
- edg_wll_FaultToErr(soap, ctx);
- edg_wll_Error(ctx, &et, &ed);
- fprintf(stderr, "%s: %s (%s)\n", argv[0], et, ed);
- exit(1);
- }
-
- for (i = 0; conditions[i]; i++) free(conditions[i]);
- free(conditions);
-
- err = soap_call___lb__QueryJobs(soap, server, "", qjobs, &out);
- switch ( err ) {
- case SOAP_OK: {
- int i;
-
- printf("Query succesfull...\n");
- printf("%-65s%s\n\n", "jobid", "state");
- for ( i = 0; i < out.__sizejobs; i++ ) {
- edg_wll_JobStatCode statCode;
-
-
- edg_wll_SoapToJobStatCode(GLITE_SECURITY_GSOAP_LIST_GET(out.states, i)->state, &statCode);
- char *s = edg_wll_StatToString(statCode);
- printf("%-65s%s\n", out.jobs[i], s);
- free(s);
- }
- }
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT: {
- char *et,*ed;
-
- edg_wll_FaultToErr(soap, ctx);
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed);
- exit(1);
- }
- default:
- fprintf(stderr,"err = %d\n",err);
- soap_print_fault(soap,stderr);
- }
-
- soap_end(soap);
- soap_done(soap);
- free(soap);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
-
- return 0;
-}
-
-static void printstat(edg_wll_JobStat stat, int level)
-{
- char *s, *j, ind[10];
- int i;
-
-
- for (i=0; i < level; i++)
- ind[i]='\t';
- ind[i]='\0';
-
- s = edg_wll_StatToString(stat.state);
-/* print whole flat structure */
- printf("%sstate : %s\n", ind, s);
- printf("%sjobId : %s\n", ind, j = edg_wlc_JobIdUnparse(stat.jobId));
- printf("%sowner : %s\n", ind, stat.owner);
- printf("%sjobtype : %s\n", ind, (stat.jobtype ? "DAG" : "SIMPLE") );
- printf("%sparent_job : %s\n", ind,
- j = edg_wlc_JobIdUnparse(stat.parent_job));
- if (stat.jobtype) {;
- printf("%sseed : %s\n", ind, stat.seed);
- printf("%schildren_num : %d\n", ind, stat.children_num);
- printf("%schildren :\n", ind);
- if (stat.children)
- for (i=0; stat.children[i]; i++)
- printf("%s\tchildren : %s\n", ind, stat.children[i]);
- printf("%schildren_states :\n", ind);
- if (stat.children_states)
- for (i=0; stat.children_states[i].state; i++)
- printstat(stat.children_states[i], level+1);
- printf("%schildren_hist :\n",ind);
- if (stat.children_hist)
- for (i=1; i<=stat.children_hist[0]; i++)
- printf("%s%14s %d\n", ind, edg_wll_StatToString(i-1),stat.children_hist[i]);
- }
- printf("%scondorId : %s\n", ind, stat.condorId);
- printf("%sglobusId : %s\n", ind, stat.globusId);
- printf("%slocalId : %s\n", ind, stat.localId);
- printf("%sjdl : %s\n", ind, stat.jdl);
- printf("%smatched_jdl : %s\n", ind, stat.matched_jdl);
- printf("%sdestination : %s\n", ind, stat.destination);
- printf("%snetwork server : %s\n", ind, stat.network_server);
- printf("%scondor_jdl : %s\n", ind, stat.condor_jdl);
- printf("%srsl : %s\n", ind, stat.rsl);
- printf("%sreason : %s\n", ind, stat.reason);
- printf("%slocation : %s\n", ind, stat.location);
- printf("%ssubjob_failed : %d\n", ind, stat.subjob_failed);
- printf("%sdone_code : %d\n", ind, stat.done_code);
- printf("%sexit_code : %d\n", ind, stat.exit_code);
- printf("%sresubmitted : %d\n", ind, stat.resubmitted);
- printf("%scancelling : %d\n", ind, stat.cancelling);
- printf("%scancelReason : %s\n", ind, stat.cancelReason);
- printf("%scpuTime : %d\n", ind, stat.cpuTime);
- printf("%suser_tags :\n",ind);
- if (stat.user_tags)
- for (i=0; stat.user_tags[i].tag; i++) printf("%s%14s = \"%s\"\n", ind,
- stat.user_tags[i].tag,stat.user_tags[i].value);
- printf("%sstateEnterTime : %ld.%06ld\n", ind, stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec);
- printf("%sstateEnterTimes : \n",ind);
- if (stat.stateEnterTimes)
- for (i=1; i<=stat.stateEnterTimes[0]; i++)
- printf("%s%14s %s", ind, edg_wll_StatToString(i-1), (stat.stateEnterTimes[i] == 0) ?
- " - not available -\n" : ctime((time_t *) &stat.stateEnterTimes[i]));
- printf("%slastUpdateTime : %ld.%06ld\n", ind, stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec);
- printf("%sexpectUpdate : %d\n", ind, stat.expectUpdate);
- printf("%sexpectFrom : %s\n", ind, stat.expectFrom);
- printf("%sacl : %s\n", ind, stat.acl);
- printf("\n");
-
- free(j);
- free(s);
-}
+++ /dev/null
-#include <assert.h>
-#include <getopt.h>
-#include <stdsoap2.h>
-
-#include "glite/security/glite_gsplugin.h"
-#include "glite/lb/consumer.h"
-
-#include "bk_ws_H.h"
-#include "ws_fault.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___lb__UserJobs soap_call___ns1__UserJobs
-#endif
-
-#include "glite/security/glite_gscompat.h"
-
-#include "LoggingAndBookkeeping.nsmap"
-
-static struct option opts[] = {
- {"help", 0, NULL, 'h'},
- {"server", 1, NULL, 'm'},
-};
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help Shows this screen.\n"
- "\t-m, --server BK server address:port.\n"
- , me);
-}
-
-//static void printstat(edg_wll_JobStat stat, int level);
-
-int main(int argc,char** argv)
-{
- edg_wll_Context ctx;
- glite_gsplugin_Context gsplugin_ctx;
- struct soap soap;
- struct _lbe__UserJobs in;
- struct _lbe__UserJobsResponse out;
- int opt, err, i;
- char *server = "http://localhost:9003/",
- *name = NULL,
- *st;
-
-
- name = strrchr(argv[0],'/');
- if (name) name++; else name = argv[0];
-
- while ((opt = getopt_long(argc, argv, "hm:", opts, NULL)) != EOF) switch (opt)
- {
- case 'h': usage(name); return 0;
- case 'm': server = optarg; break;
- case '?': usage(name); return 1;
- }
-
- edg_wll_InitContext(&ctx);
- glite_gsplugin_init_context(&gsplugin_ctx);
-
- soap_init(&soap);
- soap_set_namespaces(&soap, namespaces);
-
- if ( soap_register_plugin_arg(&soap, glite_gsplugin, (void *)gsplugin_ctx) )
- {
- soap_print_fault(&soap, stderr);
- return 1;
- }
-
- memset(&in, 0, sizeof(in));
- memset(&out, 0, sizeof(out));
- switch (err = soap_call___lb__UserJobs(&soap, server, "", &in, &out))
- {
- case SOAP_OK:
- printf("Server version: %p\n", &out);
- assert(out.__sizejobs == out.__sizestates);
- for (i = 0; i < out.__sizejobs; i++) {
- st = edg_wll_StatToString(GLITE_SECURITY_GSOAP_LIST_GET(out.states, i)->state);
- printf("\t%s\t%s\n", out.jobs[i], st);
- free(st);
- }
-
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- {
- char *et,*ed;
-
- edg_wll_FaultToErr(&soap,ctx);
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed);
- exit(1);
- }
- default:
- printf("???, err=%d\n", err);
- soap_print_fault(&soap, stderr);
- }
-
- soap_end(&soap);
- soap_done(&soap);
- glite_gsplugin_free_context(gsplugin_ctx);
- edg_wll_FreeContext(ctx);
-
- return 0;
-}