int main(int argc,char *argv[])
{
- char *server = "http://localhost:8902";
+ //char *server = "http://localhost:8902";
+ char *server = "http://localhost:10005";
struct soap *soap = soap_new();
soap_init(soap);
cond = soap_malloc(soap, sizeof(*cond));
memset(cond, 0, sizeof(*cond));
- cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner");
+ cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
cond->origin = NULL;
cond->__sizerecord = 1;
cond->record = soap_malloc(soap, sizeof(*(cond->record)));
memset(rec, 0, sizeof(*rec));
rec->op = jptype__queryOp__EQUAL;
rec->value = soap_malloc(soap, sizeof(*(rec->value)));
- rec->value->string = soap_strdup(soap, "/O=CESNET/O=Masaryk University/CN=Milos Mulac");
+ rec->value->string = soap_strdup(soap, "Cancelled");
rec->value->blob = NULL;
*(cond->record) = rec;
in.attributes = soap_malloc(soap,
in.__sizeattributes *
sizeof(*(in.attributes)));
- in.attributes[0] = soap_strdup(soap, "owner");
- in.attributes[1] = soap_strdup(soap, "date");
- in.attributes[2] = soap_strdup(soap, "location");
+ in.attributes[0] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner");
+ in.attributes[1] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:jobId");
+ in.attributes[2] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
memset(&out, 0, sizeof(out));
// lb.server/build/jp_job_attrs.h (created when build plugin)
// jp.common/interfaces/known_attr.h
- conf->attrs = calloc(4, sizeof(*conf->attrs));
+ conf->attrs = calloc(5, sizeof(*conf->attrs));
conf->attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner");
conf->attrs[1] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:jobId");
conf->attrs[2] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
+ conf->attrs[3] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
conf->indexed_attrs = calloc(3, sizeof(*conf->indexed_attrs));
conf->indexed_attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner");
static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in, char ***jobids, char *** ps_list)
{
- char *qa = NULL, *qb = NULL, *qop = NULL,
+ char *qa = NULL, *qb = NULL, *qop = NULL, *attr_md5,
*qwhere = NULL, *query = NULL, *res[2],
**jids = NULL, **pss = NULL, **attr_tables = NULL;
int i, j, ret;
for (i=0; i < in->__sizeconditions; i++) {
+ attr_md5 = str2md5(in->conditions[i]->attr);
trio_asprintf(&qa,"%s jobs.jobid = attr_%|Ss.jobid AND (",
- (i ? "AND" : ""), str2md5(in->conditions[i]->attr));
+ (i ? "AND" : ""), attr_md5);
for (j=0; j < in->conditions[i]->__sizerecord; j++) {
if (get_op(in->conditions[i]->record[j]->op, &qop)) goto err;
- add_attr_table(str2md5(in->conditions[i]->attr), &attr_tables);
+ add_attr_table(attr_md5, &attr_tables);
if (in->conditions[i]->record[j]->value->string) {
attr.name = in->conditions[i]->attr;
glite_jpis_SoapToAttrOrig(soap,
in->conditions[i]->origin, &(attr.origin));
trio_asprintf(&qb,"%s %s attr_%|Ss.value %s \"%|Ss\" ",
- qa, (j ? "OR" : ""), str2md5(in->conditions[i]->attr), qop,
+ qa, (j ? "OR" : ""), attr_md5, qop,
glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255));
free(qop);
free(qa); qa = qb; qb = NULL;
glite_jpis_SoapToAttrOrig(soap,
in->conditions[i]->origin, &(attr.origin));
trio_asprintf(&qb,"%s %s attr_%|Ss.value %s \"%|Ss\" ",
- qa, (j ? "OR" : ""), str2md5(in->conditions[i]->attr), qop,
+ qa, (j ? "OR" : ""), attr_md5, qop,
glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255));
free(qop);
free(qa); qa = qb; qb = NULL;
}
+ free(attr_md5);
}
trio_asprintf(&qb,"%s)",qa);
free(qa); qa = qb; qb = NULL;
qa = strdup("");
for (i=0; (attr_tables && attr_tables[i]); i++) {
- trio_asprintf(&qb,"%s, %s", qa, attr_tables[i]);
+ trio_asprintf(&qb,"%s, attr_%s", qa, attr_tables[i]);
free(qa); qa = qb; qb = NULL;
}