#include #include #include #include #include #include #include #include #include #include #define CHAR_BUFFER 256 #define FILE_LENGTH 1024 int main(int argc, char *argv[]) { char * name=NULL; enum StepState step_state; int rc; int obj_count,err_code; LL_element * job=NULL,*data=NULL,*step=NULL; char **host_list; job = ll_query(JOBS); if (!job) { printf("Query JOBS: ll_query() returns NULL.\n"); exit(1); } host_list = (char **)malloc(2*sizeof(char *)); host_list[0] = argv[1];//"l4f1n03.16525"; host_list[1] = NULL; rc = ll_set_request(job,QUERY_JOBID,host_list,ALL_DATA); if (rc) { printf("Query JOBS: ll_set_request() return code is non-zero.\n"); exit(1); } data = ll_get_objs(job, LL_SCHEDD, NULL, &obj_count, &err_code); if (data == NULL) { printf("Query JOBS: ll_get_objs() returns NULL. Error code = %d\n", err_code); } //printf("Number of jobs objects returned = %d\n", obj_count); name=(char*)malloc(256*sizeof(char *)); ll_get_data(data, LL_JobGetFirstStep, &step); while(data) { int n; rc = ll_get_data(data, LL_JobName,&name); if (!rc) { printf("Job name: %s\n",name); free(name); } rc = ll_get_data(data, LL_JobStepCount, &n); printf("Job count: %d\n",n); //free(step_state); rc = ll_get_data(step, LL_StepState,&step_state); if (rc) { printf("Query MACHINES: ll_get_data() return code is non-zero.\n"); exit(1); } if(!rc) { printf("State: %d\n",step_state); } data = ll_next_obj(job); } ll_free_objs(job); ll_deallocate(job); return 0; }