- Timestamp:
- Oct 11, 2018, 4:30:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/service_internal_hpc.c
r877 r886 299 299 // then, set the configId key in the lenv section 300 300 char *serviceType; 301 map* mServiceType=getMap(s->content," serviceType");301 map* mServiceType=getMap(s->content,"confId"); 302 302 if(mServiceType!=NULL) 303 303 serviceType=mServiceType->value; … … 334 334 while(input!=NULL && input->content!=NULL){ 335 335 map* isInRequest=getMap(input->content,"inRequest"); 336 map* minNb=getMap(input->content,"min occurs");336 map* minNb=getMap(input->content,"minOccurs"); 337 337 if(getMaps(*real_outputs,input->name)==NULL && 338 338 ( (isInRequest!=NULL && strncasecmp(isInRequest->value,"true",4)==0) … … 397 397 if(getMap(input->content,"dataType")!=NULL){ 398 398 // For LitteralData, simply pass the value 399 map* val=getMap(input->content,"value"); 400 parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(val->value)+3)*sizeof(char)); 401 sprintf(parameters[parameters_cnt-1],"-%s %s",input->name,val->value); 399 map* length=getMap(input->content,"length"); 400 if(length!=NULL){ 401 char* value=NULL; 402 int len=atoi(length->value); 403 int i=0; 404 for(i=0;i<len;i++){ 405 map* val=getMapArray(input->content,"value",i); 406 if(val!=NULL){ 407 if(value==NULL){ 408 value=(char*)malloc((strlen(val->value)+3)*sizeof(char)); 409 sprintf(value,"\"%s\"",val->value); 410 } 411 else{ 412 value=(char*)realloc(value,(strlen(value)+strlen(val->value)+4)*sizeof(char)); 413 sprintf(value,"%s \"%s\"",value,val->value); 414 } 415 } 416 } 417 if(value!=NULL){ 418 parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(value)+3)*sizeof(char)); 419 sprintf(parameters[parameters_cnt-1],"-%s %s",input->name,value); 420 } 421 }else{ 422 map* val=getMap(input->content,"value"); 423 parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(val->value)+5)*sizeof(char)); 424 sprintf(parameters[parameters_cnt-1],"-%s \"%s\"",input->name,val->value); 425 } 402 426 } 403 427 } … … 888 912 dup2 (fileno (stderr), fileno (stdout)); 889 913 conf_read(filePath,m); 914 //dumpMaps(m); 890 915 fflush(stdout); 891 916 dup2 (saved_stdout, fileno (stdout)); … … 910 935 free(targetPath); 911 936 }else{ 912 map* hpcStdErr=getMapFromMaps(*main_conf,"henv","StdErr"); 913 if(hpcStdErr!=NULL && ssh_fetch(*main_conf,targetPath,hpcStdErr->value,ssh_get_cnt(m))==0){ 937 map* hpcStdErr=getMapFromMaps(*main_conf,"henv","StdErr"); 938 // Added for using sacct in place of scontrol 939 char *sourcePath=NULL; 940 if(hpcStdErr!=NULL){ 941 sourcePath=(char*)malloc((strlen(targetPathMap->value)+strlen(hpcStdErr->value)+2)*sizeof(char)); 942 sprintf(sourcePath,"%s/%s",targetPathMap->value,hpcStdErr->value); 943 } 944 if(hpcStdErr!=NULL && sourcePath!=NULL && ssh_fetch(*main_conf,targetPath,sourcePath,ssh_get_cnt(m))==0){ 945 free(sourcePath); 914 946 struct stat f_status; 915 947 int ts=stat(targetPath, &f_status); … … 925 957 free(fcontent); 926 958 }else{ 927 char *tmpStr=(char*)malloc((strlen( filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));928 sprintf(tmpStr,_("Unable to fetch the remote file for %s"), filename);959 char *tmpStr=(char*)malloc((strlen(targetPath)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char)); 960 sprintf(tmpStr,_("Unable to fetch the remote file for %s"),targetPath); 929 961 setMapInMaps(*main_conf,"lenv","message",tmpStr); 930 962 free(tmpStr); … … 939 971 return SERVICE_FAILED; 940 972 } 941 } 973 } 942 974 }else{ 943 975 map* generatedFile=getMap(input->content,"generated_file"); … … 981 1013 }else{ 982 1014 map* hpcStdErr=getMapFromMaps(*main_conf,"henv","StdErr"); 983 if(hpcStdErr!=NULL && ssh_fetch(*main_conf,targetPath,hpcStdErr->value,ssh_get_cnt(m))==0){ 1015 char *sourcePath=NULL; 1016 if(hpcStdErr!=NULL){ 1017 dumpMap(hpcStdErr); 1018 sourcePath=(char*)malloc((strlen(targetPathMap->value)+strlen(hpcStdErr->value)+2)*sizeof(char)); 1019 sprintf(sourcePath,"%s/%s",targetPathMap->value,hpcStdErr->value); 1020 } 1021 if(hpcStdErr!=NULL && sourcePath!=NULL && ssh_fetch(*main_conf,targetPath,sourcePath,ssh_get_cnt(m))==0){ 1022 free(sourcePath); 984 1023 struct stat f_status; 985 1024 int ts=stat(targetPath, &f_status); … … 995 1034 free(fcontent); 996 1035 }else{ 997 char *tmpStr=(char*)malloc((strlen( filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));998 sprintf(tmpStr,_("Unable to fetch the remote file for %s"), filename);1036 char *tmpStr=(char*)malloc((strlen(targetPath)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char)); 1037 sprintf(tmpStr,_("Unable to fetch the remote file for %s"),targetPath); 999 1038 setMapInMaps(*main_conf,"lenv","message",tmpStr); 1000 1039 free(tmpStr); 1001 1040 } 1002 1041 }else{ 1003 char *tmpStr=(char*)malloc((strlen( filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));1004 sprintf(tmpStr,_("Unable to fetch the remote file for %s"), filename);1042 char *tmpStr=(char*)malloc((strlen(sourcePath)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char)); 1043 sprintf(tmpStr,_("Unable to fetch the remote file for %s"),sourcePath); 1005 1044 setMapInMaps(*main_conf,"lenv","message",tmpStr); 1006 1045 free(tmpStr);
Note: See TracChangeset
for help on using the changeset viewer.