From 0d2d908e29ffa992d99cb6d55e223cf258fa8774 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Fri, 6 Jun 2008 13:15:35 +0000 Subject: [PATCH] - don't ignore errors on storing tags in RecordTag - working example and implementation of RecortMultiTags - dummy implementation of glite_jpps_match_attr_multi() --- org.glite.jp.primary/examples/recordmultitags.pl | 2 +- org.glite.jp.primary/src/feed.c | 11 ++++++++ org.glite.jp.primary/src/soap_ops.c | 34 +++++++----------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/org.glite.jp.primary/examples/recordmultitags.pl b/org.glite.jp.primary/examples/recordmultitags.pl index 8a7317f..3372f4d 100755 --- a/org.glite.jp.primary/examples/recordmultitags.pl +++ b/org.glite.jp.primary/examples/recordmultitags.pl @@ -44,7 +44,7 @@ while ($_ = shift) { push @a, SOAP::Data->name(attributes=>\SOAP::Data->value( SOAP::Data->name(name=>$name), - SOAP::Data->name(value=> SOAP::Data->name(string=>$value)) + SOAP::Data->name(value=> \SOAP::Data->value(SOAP::Data->name(string=>$value))) )) } } diff --git a/org.glite.jp.primary/src/feed.c b/org.glite.jp.primary/src/feed.c index f0d5d2f..29a7b18 100644 --- a/org.glite.jp.primary/src/feed.c +++ b/org.glite.jp.primary/src/feed.c @@ -272,6 +272,17 @@ int glite_jpps_match_attr_multi( ) { /* TODO */ + int i,j; + + puts(__FUNCTION__); + for (i=0; jobs[i]; i++) { + printf("job %s\n",jobs[i]); + + for (j=0; attrs[i][j].name; j++) { + printf("\t%s = %s\n",attrs[i][j].name,attrs[i][j].value); + } + } + return 0; } diff --git a/org.glite.jp.primary/src/soap_ops.c b/org.glite.jp.primary/src/soap_ops.c index 359f9a4..aaa5ba3 100644 --- a/org.glite.jp.primary/src/soap_ops.c +++ b/org.glite.jp.primary/src/soap_ops.c @@ -228,26 +228,7 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag( attr[0].origin_detail = NULL; /* XXX */ attr[1].name = NULL; - /*if (glite_jppsbe_open_file(ctx,in->jobid,"tags",NULL, - O_RDWR|O_CREAT,&file_be) - // XXX: tags need reading to check magic number - ) { - err2fault(ctx,soap); - return SOAP_FAULT; - } - - if (glite_jppsbe_close_file(ctx,file_be)) - { - err2fault(ctx,soap); - return SOAP_FAULT; - }*/ - glite_jppsbe_append_tags(ctx,in->jobid,attr); - - /*if (tag_append(ctx,file_be,attr)) - { - err2fault(ctx,soap); - return SOAP_FAULT; - }*/ + if (glite_jppsbe_append_tags(ctx,in->jobid,attr)) goto err; /* XXX: ignore errors but don't fail silenty */ glite_jpps_match_attr(ctx,in->jobid,attr); @@ -275,12 +256,9 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordMultiTags( memset(meta,0,sizeof meta); meta[0].name = strdup(GLITE_JP_ATTR_OWNER); -printf(__FUNCTION__); for (i=0; i__sizejobs; i++) { struct jptype__jobRecord *jr = GLITE_SECURITY_GSOAP_LIST_GET(in->jobs,i); -printf("jobid: %s\n",jr->jobid); - if (glite_jppsbe_get_job_metadata(ctx,jr->jobid,meta)) { ret = SOAP_FAULT; goto cleanup; @@ -297,7 +275,8 @@ printf("jobid: %s\n",jr->jobid); jobs[i+1] = NULL; attrs = realloc(attrs,sizeof(*attrs) * (i+2)); - attrs[i+1] = attrs[i] = NULL; + attrs[i] = calloc(jr->__sizeattributes+1,sizeof attrs[i][0]); + attrs[i+1] = NULL; for (j=0; j < jr->__sizeattributes; j++) { struct jptype__attrValue *a = GLITE_SECURITY_GSOAP_LIST_GET(jr->attributes,j); @@ -317,6 +296,11 @@ printf("jobid: %s\n",jr->jobid); attrs[i][j].timestamp = time(NULL); attrs[i][j].origin_detail = NULL; } + if (glite_jppsbe_append_tags(ctx,jobs[i],attrs[i])) { + err2fault(ctx,soap); + ret = SOAP_FAULT; + goto cleanup; + } } /* XXX: ignore error */ @@ -331,7 +315,7 @@ cleanup: free(jobs); glite_jp_attrval_free(meta,0); - err2fault(ctx,soap); + if (ret == SOAP_FAULT) err2fault(ctx,soap); return ret; } -- 1.8.2.3