source: branches/prototype-v0/zoo-project/zoo-kernel/service_internal_hpc.c @ 873

Last change on this file since 873 was 862, checked in by djay, 6 years ago

Add the capability to publish heatmap or any templated mapfile using the epecific msInclude and msLayer keys for an output. For MapServer? published output, define 4096 as the default maxsize and use pixel width or height for raster files. use the correct MapServer? imagemode depending on GDALGetRasterDataType (MS_IMAGEMODE_BYTE for GDT_Byte, MS_IMAGEMODE_INT16 for GDT_Int16 and MS_IMAGEMODE_FLOAT32 for GDT_Float32). Create a text file (.maps) listing every mapfiles created for a MapServer? published output (or inputs) using saveMapNames function. Fixes in ulinet, use uuid for naming temporary files. Add dialect input to the ogr2ogr service. Use the .maps file for removing a file from the DeleteData? service

  • Property svn:keywords set to Id
File size: 38.6 KB
Line 
1/*
2 * Author : Gérald FENOY
3 *
4 * Copyright (c) 2017 GeoLabs SARL
5 *
6 * This work was supported by public funds received in the framework of GEOSUD,
7 * a project (ANR-10-EQPX-20) of the program "Investissements d'Avenir" managed
8 * by the French National Research Agency
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 * THE SOFTWARE.
27 *
28 */
29
30#include "service_internal_hpc.h"
31#include "response_print.h"
32#include "server_internal.h"
33#include "service_callback.h"
34#include "mimetypes.h"
35#include <sys/un.h>
36
37typedef struct {
38  maps* conf;
39  char* local_file;
40  char* target_file;
41} local_params;
42
43/**
44 * Add nested outputs to every outputs that is geographic format
45 * @see isGeographic
46 * @param s the service current definition
47 */ 
48void addNestedOutputs(service** s){
49  if((*s)==NULL){
50    return;
51  }   
52  if(*s==NULL || (*s)->outputs==NULL){
53    return;
54  }
55  elements *out=(*s)->outputs;
56  elements* cur=out;
57  map* serviceType=getMap((*s)->content,"ServiceType");
58  if(strncmp(serviceType->value,"HPC",3)!=0)
59    return;
60  while(cur!=NULL && cur->defaults!=NULL){
61    map* mimeType=getMap(cur->defaults->content,"mimeType");
62    map* useMS=getMap(cur->defaults->content,"useMapserver");
63    if(mimeType!=NULL && useMS!=NULL && strncasecmp(useMS->value,"true",4)==0){
64      int geo=isGeographic(mimeType->value);
65      if(geo>0){
66        elements *tmp[3]={
67          dupElements(cur),
68          dupElements(cur),
69          dupElements(cur)
70        };
71        char *geoLink="wcs_link";
72        if(geo==2){
73          geoLink="wfs_link";
74        }
75        int i=0;
76        for(;i<3;i++){
77          if(tmp[i]->next!=NULL){
78            freeElements(&tmp[i]->next);
79            free(tmp[i]->next);
80            tmp[i]->next=NULL;
81          }
82          free(tmp[i]->name);
83          if(tmp[i]->format!=NULL)
84            free(tmp[i]->format);
85          tmp[i]->format=zStrdup("ComplexData");
86          freeMap(&tmp[i]->content);
87          free(tmp[i]->content);
88          tmp[i]->content=NULL;
89          switch(i){
90          case 0:
91            tmp[i]->name=zStrdup("download_link");
92            tmp[i]->content=createMap("Title",_("Download link"));
93            addToMap(tmp[i]->content,"Abstract",_("The download link"));
94            addToMap(tmp[i]->defaults->content,"useMapserver","false");
95            if(tmp[i]->supported!=NULL){
96              freeIOType(&tmp[i]->supported);
97              free(tmp[i]->supported);
98              tmp[i]->supported=NULL;
99            }
100            break;
101          case 1:
102            tmp[i]->name=zStrdup("wms_link");
103            tmp[i]->content=createMap("Title",_("WMS link"));
104            addToMap(tmp[i]->content,"Abstract",_("The WMS link"));
105            if(tmp[i]->supported!=NULL && tmp[i]->supported->next!=NULL){
106              freeIOType(&tmp[i]->supported->next);
107              free(tmp[i]->supported->next);
108              tmp[i]->supported->next=NULL;
109            }else{
110              if(tmp[i]->supported!=NULL)
111                addToMap(tmp[i]->supported->content,"useMapserver","true");
112              addToMap(tmp[i]->defaults->content,"useMapserver","true");
113            }
114            break;
115          case 2:
116            if(geo==2){
117              tmp[i]->name=zStrdup("wfs_link");
118              tmp[i]->content=createMap("Title",_("WFS link"));
119              addToMap(tmp[i]->content,"Abstract",_("The WFS link"));
120            }else{
121              tmp[i]->name=zStrdup("wcs_link");
122              tmp[i]->content=createMap("Title",_("WCS link"));
123              addToMap(tmp[i]->content,"Abstract",_("The WCS link"));
124            }
125            if(tmp[i]->supported!=NULL && tmp[i]->supported->next!=NULL &&
126               tmp[i]->supported->next->content!=NULL){
127              freeIOType(&tmp[i]->supported);
128              free(tmp[i]->supported);
129              tmp[i]->supported=NULL;
130              tmp[i]->supported=createIoType();
131              iotype* cnext=cur->supported->next;
132              tmp[i]->supported->content=createMap(cnext->content->name,cnext->content->value);
133              addMapToMap(&tmp[i]->supported->content,cnext->content->next);
134              addToMap(tmp[i]->supported->content,"useMapserver","true");
135            }else
136              addToMap(tmp[i]->defaults->content,"useMapserver","true");
137            break;
138          }
139        }
140        addToElements(&cur->child,tmp[0]);
141        addToElements(&cur->child,tmp[1]);
142        addToElements(&cur->child,tmp[2]);
143        free(cur->format);
144        cur->format=NULL;
145        if(cur->defaults!=NULL){
146          freeIOType(&cur->defaults);
147          free(cur->defaults);
148          cur->defaults=NULL;
149        }
150        if(cur->supported!=NULL){
151          freeIOType(&cur->supported);
152          free(cur->supported);
153          cur->supported=NULL;
154        }
155        freeElements(&tmp[2]);
156        free(tmp[2]);
157        freeElements(&tmp[1]);
158        free(tmp[1]);
159        freeElements(&tmp[0]);
160        free(tmp[0]);
161        //addToMap(cur->content,"internal","true");
162      }     
163    }
164    cur=cur->next;
165  }
166  //dumpElements((*s)->outputs);
167}
168
169/**
170 * Acquire a read lock on every files used as input for executing a service.
171 * @param conf the main configuration file map
172 * @return 0 if every file can be locked, -1 if one lock has failed.
173 */
174int addReadLocks(maps** conf){
175  map* queueLengthMap=getMapFromMaps(*conf,"uploadQueue","length");
176  maps* queueMaps=getMaps(*conf,"uploadQueue");
177  if(queueLengthMap!=NULL){
178    int cnt=atoi(queueLengthMap->value);
179    int i=0;
180    for(i=0;i<cnt;i++){
181      map* argv[2]={
182        getMapArray(queueMaps->content,"input",i),
183        getMapArray(queueMaps->content,"localPath",i)
184      };
185      zooLock* lck;
186      if((lck=lockFile(*conf,argv[1]->value,'r'))==NULL){
187        char* templateStr=_("Unable to lock the file for %s in read mode.");
188        char *tmpMessage=(char*)malloc((strlen(templateStr)+strlen(argv[0]->value)+1)*sizeof(char));
189        sprintf(tmpMessage,templateStr,argv[0]->value);
190        setMapInMaps(*conf,"lenv","message",tmpMessage);
191        free(tmpMessage);
192        return -1;
193      }else{
194        if(zoo_file_locks_cnt==0){
195          zoo_file_locks=(zooLock**)malloc(sizeof(zooLock*));
196        }
197        else{
198          zoo_file_locks=(zooLock**)realloc(zoo_file_locks,(zoo_file_locks_cnt+1)*sizeof(zooLock*));
199        }
200        zoo_file_locks[zoo_file_locks_cnt]=lck;
201        zoo_file_locks_cnt++;
202      }
203    }
204  }
205  return 0;
206}
207
208/**
209 * Remove all read locks set for files used as input for executing the service.
210 * @param conf the main configuration maps pointer
211 * @return 0 in case of success, -1 if any error occured. In case of error, one
212 * can refer to the message map array from the lenv section.
213 */
214int removeReadLocks(maps** conf){
215  int res=0;
216  int nberr=0;
217  map* queueLengthMap=getMapFromMaps(*conf,"uploadQueue","length");
218  maps* queueMaps=getMaps(*conf,"uploadQueue");
219  if(queueLengthMap!=NULL){
220    int cnt=atoi(queueLengthMap->value);
221    int i=0;
222    for(i=0;i<cnt;i++){
223      if(unlockFile(*conf,zoo_file_locks[i])<1){
224        map* argv=getMapArray(queueMaps->content,"input",i);
225        char* templateStr=_("Unable to unlock the file for %s after execution.");
226        char *tmpMessage=(char*)malloc((strlen(templateStr)+strlen(argv->value)+1)*sizeof(char));
227        sprintf(tmpMessage,templateStr,argv->value);
228        maps* lenv=getMaps(*conf,"lenv");
229        setMapArray(lenv->content,"message",nberr,tmpMessage);
230        free(tmpMessage);
231        res=-1;
232        nberr++;
233      }
234    }
235  }
236  free(zoo_file_locks);
237  return res;
238}
239
240/**
241 * Get the section name depending on number of features and/or pixels of each
242 * inputs and the threshold defined in a section.
243 * It supposes that your inputs has been published using MapServer support,
244 * implying that the number of features (nb_features), respectively pixels
245 * (nb_pixels), are defined. The section, identified by confId, should contain
246 * preview_max_features and preview_max_pixels defining the threshold values.
247 * @param conf the main configuration file maps pointer
248 * @param inputs the inputs maps pointer
249 * @param confId the section identifier
250 * @return "preview_conf" in case the numbers are lower than the threshold,
251 * "fullres_conf" in other cases.
252 */
253char* getConfiguration(maps** conf,maps** inputs,const char* confId){
254  maps* input=*inputs;
255  map* max_pixels=getMapFromMaps(*conf,confId,"preview_max_pixels");
256  map* max_features=getMapFromMaps(*conf,confId,"preview_max_features");
257  int i_max_pixels=atoi(max_pixels->value);
258  int i_max_features=atoi(max_features->value);
259  while(input!=NULL && input->content!=NULL){
260    map* tmpMap=getMap(input->content,"geodatatype");
261    if(tmpMap!=NULL){
262      map* currentNb;
263      if(strcasecmp(tmpMap->value,"raster")==0 ){
264        currentNb=getMap(input->content,"nb_pixels");
265        if(atoi(currentNb->value)>i_max_pixels)
266          return "fullres_conf";
267      }else{
268        if(strcasecmp(tmpMap->value,"vector")==0 ){
269          currentNb=getMap(input->content,"nb_features");
270          if(atoi(currentNb->value)>i_max_features)
271            return "fullres_conf";
272        }
273      }
274    }
275    input=input->next;
276  }
277  return "preview_conf";
278}
279
280/**
281 * Load and run a HPC Application corresponding to the service.
282 *
283 * @param main_conf the conf maps containing the main.cfg settings
284 * @param request the map containing the HTTP request
285 * @param s the service structure
286 * @param real_inputs the maps containing the inputs
287 * @param real_outputs the maps containing the outputs
288 * @return SERVICE_SUCCEEDED in case of success, -1 or SERVICE_FAILED when failing.
289 */
290int zoo_hpc_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
291  maps* m=*main_conf;
292  maps* inputs=*real_inputs;
293  maps* outputs=*real_outputs;
294  map* tmp0=getMapFromMaps(*main_conf,"lenv","cwd");
295  char *ntmp=tmp0->value;
296  map* tmp=NULL;
297  int res=-1;
298  // Get the configuration id depending on service type and defined thresholds
299  // then, set the configId key in the lenv section
300  char *serviceType;
301  map* mServiceType=getMap(s->content,"serviceType");
302  if(mServiceType!=NULL)
303    serviceType=mServiceType->value;
304  else
305    serviceType="HPC";
306  map* tmpPath=getMapFromMaps(*main_conf,"main","tmpPath");
307  map* uuid=getMapFromMaps(*main_conf,"lenv","usid");
308  map* confMap=getMapFromMaps(*main_conf,serviceType,getConfiguration(main_conf,real_inputs,serviceType));
309  char * configurationId=confMap->value;
310  setMapInMaps(*main_conf,"lenv","configId",configurationId);
311  // Dump lenv maps again after having set the configId ...
312  char *flenv =
313    (char *)
314    malloc ((strlen (tmpPath->value) + 
315             strlen (uuid->value) + 12) * sizeof (char));
316  sprintf (flenv, "%s/%s_lenv.cfg", tmpPath->value, uuid->value);
317  maps* lenvMaps=getMaps(m,"lenv");
318  dumpMapsToFile(lenvMaps,flenv,0);
319  free(flenv);
320
321  map* targetPathMap=getMapFromMaps(*main_conf,configurationId,"remote_data_path");
322 
323  pthread_t threads_pool[50];
324  // Force the HPC services to be called asynchronously
325  map* isAsync=getMapFromMaps(*main_conf,"lenv","async");
326  if(isAsync==NULL){
327    errorException(*main_conf,_("The synchronous mode is not supported by this type of service"),"NoSuchMode",s->name);
328    return -1;
329  }
330
331  maps* input=*real_inputs;
332  char **parameters=NULL;
333  int parameters_cnt=0;
334  while(input!=NULL && input->content!=NULL){
335    map* isInRequest=getMap(input->content,"inRequest");
336    map* minNb=getMap(input->content,"minoccurs");
337    if(getMaps(*real_outputs,input->name)==NULL &&
338       ( (isInRequest!=NULL && strncasecmp(isInRequest->value,"true",4)==0)
339         || (minNb!=NULL && atoi(minNb->value)>0) ) ){
340      parameters_cnt+=1;
341      if(parameters_cnt==1)
342        parameters=(char**)malloc(parameters_cnt*sizeof(char*));
343      else
344        parameters=(char**)realloc(parameters,parameters_cnt*sizeof(char*));
345      if(getMap(input->content,"mimeType")!=NULL){
346        // Input is ComplexData
347        if(getMap(input->content,"cache_file")==NULL){
348          // Input data has been passed by value
349          // TODO: publish input through MapServer / use output publication
350          dumpMapsValuesToFiles(main_conf,&input);
351          addToMap(input->content,"toPublish","true");
352          //addToMap(input->content,"useMapserver","true");
353        }
354        if(getMap(input->content,"cache_file")!=NULL){
355          map* length=getMap(input->content,"length");
356          if(length==NULL){
357            addToMap(input->content,"length","1");
358            length=getMap(input->content,"length");
359          }
360          int len=atoi(length->value);
361          int i=0;
362          for(i=0;i<len;i++){
363            map* tmp=getMapArray(input->content,"cache_file",i);
364            char* targetName=strrchr(tmp->value,'/');
365            char *targetPath=(char*)malloc((strlen(targetPathMap->value)+strlen(targetName)+2)*sizeof(char));
366            sprintf(targetPath,"%s/%s",targetPathMap->value,targetName);
367            setMapArray(input->content,"targetPath",i,targetPath);
368            setMapArray(input->content,"localPath",i,tmp->value);
369            map* tmp1=getMapArray(input->content,"value",i);
370            if(tmp1!=NULL){
371              free(tmp1->value);
372              tmp1->value=strdup("empty");
373            }
374            if(i==0){
375              parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(targetPath)+3)*sizeof(char));
376              sprintf(parameters[parameters_cnt-1],"-%s %s",input->name,targetPath);
377            }else{
378              fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
379              fflush(stderr);
380              char *tmpStr=zStrdup(parameters[parameters_cnt-1]);
381              parameters[parameters_cnt-1]=(char*)realloc(parameters[parameters_cnt-1],(strlen(tmpStr)+strlen(targetPath)+2)*sizeof(char));
382              sprintf(parameters[parameters_cnt-1],"%s %s",tmpStr,targetPath);
383              free(tmpStr);
384              fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
385              fflush(stderr);
386            }
387            free(targetPath);
388          }
389          addToUploadQueue(main_conf,input);
390        }else{
391          // ???
392          fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
393          fflush(stderr);
394        }
395      }else{
396        // LitteralData and BboxData
397        if(getMap(input->content,"dataType")!=NULL){
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);
402        }
403      }
404    }
405    input=input->next;
406  }
407
408#ifdef HPC_DEBUG
409  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
410#endif
411  invokeCallback(m,inputs,NULL,1,1);
412  invokeCallback(m,inputs,NULL,2,0);
413  if(getMapFromMaps(m,"lenv","mapError")!=NULL){
414    invokeCallback(*main_conf,inputs,NULL,7,0);
415    return -1;
416  }
417#ifdef HPC_DEBUG
418  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
419  dumpMaps(inputs);
420#endif
421
422  // Upload data on HPC
423  if(runUpload(main_conf)==false){
424    errorException (*main_conf, _("Unable to lock the file for upload!"),
425                    "InternalError", NULL);
426#ifdef HPC_DEBUG
427    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
428#endif
429    invokeCallback(*main_conf,inputs,NULL,7,0);
430#ifdef HPC_DEBUG
431    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
432#endif
433    return -1;
434  }
435#ifdef HPC_DEBUG
436  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
437#endif
438  invokeCallback(m,inputs,NULL,2,1);
439#ifdef HPC_DEBUG
440  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
441#endif
442
443  // Add the filename to generate for every output to parameters
444  input=*real_outputs;
445#ifdef HPC_DEBUG
446  dumpMaps(input);
447#endif
448  while(input!=NULL){
449    // Parse all outputs including inner outputs if required.
450    if(input->child==NULL){
451      // Name every files that should be produced by the service execution
452      map* mime=getMap(input->content,"mimeType");
453      char* targetName;
454      if(mime!=NULL){
455        bool hasExt=false;
456        map* fileExt=getFileExtensionMap(mime->value,&hasExt);
457        targetName=(char*)malloc((strlen(s->name)+strlen(input->name)+strlen(uuid->value)+strlen(fileExt->value)+11)*sizeof(char));
458        sprintf(targetName,"output_%s_%s_%s.%s",s->name,input->name,uuid->value,fileExt->value);
459        freeMap(&fileExt);
460        free(fileExt);
461      }else{
462        targetName=(char*)malloc((strlen(s->name)+strlen(input->name)+strlen(uuid->value)+14)*sizeof(char));
463        sprintf(targetName,"output_%s_%s_%s.tif",s->name,input->name,uuid->value);
464      }
465      char *targetPath=(char*)malloc((strlen(targetPathMap->value)+strlen(targetName)+2)*sizeof(char));
466      sprintf(targetPath,"%s/%s",targetPathMap->value,targetName);
467      map *tmpUrl=getMapFromMaps(*main_conf,"main","tmpUrl");
468      char *targetUrl=(char*)malloc((strlen(tmpUrl->value)+strlen(targetName)+2)*sizeof(char));
469      sprintf(targetUrl,"%s/%s",tmpUrl->value,targetName);
470      free(targetName);
471      setMapInMaps(*real_outputs,input->name,"generated_file",targetPath);
472      addToMap(input->content,"generated_url",targetUrl);
473      free(targetUrl);
474      {
475        parameters_cnt+=1;
476        if(parameters_cnt==1)
477          parameters=(char**)malloc(parameters_cnt*sizeof(char*));
478        else
479          parameters=(char**)realloc(parameters,parameters_cnt*sizeof(char*));
480        // We should verify if any optional tag for output is required
481        // (i.e. -out output.tiff *int8*), meaning that we should search
482        // for a corresponding inputs name.
483        map* inValue=getMapFromMaps(*real_inputs,input->name,"value");
484        if(inValue!=NULL){
485          parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(targetPath)+strlen(inValue->value)+4)*sizeof(char));
486          sprintf(parameters[parameters_cnt-1],"-%s %s %s",input->name,targetPath,inValue->value);
487        }else{
488          parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(targetPath)+3)*sizeof(char));
489          sprintf(parameters[parameters_cnt-1],"-%s %s",input->name,targetPath);
490        }
491      }
492      free(targetPath);
493    }// In other case it means we need to return the cache_file as generated_file
494    else{
495      // Name every files that should be produced by the service execution
496      map* mime=getMap(input->child->content,"mimeType");
497      char* targetName;
498      if(mime!=NULL){
499        bool hasExt=false;
500        map* fileExt=getFileExtensionMap(mime->value,&hasExt);
501        targetName=(char*)malloc((strlen(s->name)+strlen(input->name)+strlen(uuid->value)+strlen(fileExt->value)+11)*sizeof(char));
502        sprintf(targetName,"output_%s_%s_%s.%s",s->name,input->name,uuid->value,fileExt->value);
503        freeMap(&fileExt);
504        free(fileExt);
505      }else{
506        targetName=(char*)malloc((strlen(s->name)+strlen(input->name)+strlen(uuid->value)+14)*sizeof(char));
507        sprintf(targetName,"output_%s_%s_%s.tif",s->name,input->name,uuid->value);
508      }
509      char *targetPath=(char*)malloc((strlen(targetPathMap->value)+strlen(targetName)+2)*sizeof(char));
510      sprintf(targetPath,"%s/%s",targetPathMap->value,targetName);
511      map *tmpUrl=getMapFromMaps(*main_conf,"main","tmpUrl");
512      char *targetUrl=(char*)malloc((strlen(tmpUrl->value)+strlen(targetName)+2)*sizeof(char));
513      sprintf(targetUrl,"%s/%s",tmpUrl->value,targetName);
514      free(targetName);
515      addToMap(input->content,"generated_file",targetPath);
516      addToMap(input->content,"storage",targetPath);
517      addToMap(input->content,"generated_url",targetUrl);
518      free(targetUrl);
519      if(strcasecmp(input->name,"wms_link")!=0&&
520         strcasecmp(input->name,"wcs_link")!=0 &&
521         strcasecmp(input->name,"wfs_link")!=0){
522        parameters_cnt+=1;
523        if(parameters_cnt==1)
524          parameters=(char**)malloc(parameters_cnt*sizeof(char*));
525        else
526          parameters=(char**)realloc(parameters,parameters_cnt*sizeof(char*));
527        // We should verify if any optional tag for output is required
528        // (i.e. -out output.tiff *int8*), meaning that we should search
529        // for a corresponding inputs name.
530        map* inValue=getMapFromMaps(*real_inputs,input->name,"value");
531        if(inValue!=NULL){
532          parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(targetPath)+strlen(inValue->value)+4)*sizeof(char));
533          sprintf(parameters[parameters_cnt-1],"-%s %s %s",input->name,targetPath,inValue->value);
534        }else{
535          parameters[parameters_cnt-1]=(char*)malloc((strlen(input->name)+strlen(targetPath)+3)*sizeof(char));
536          sprintf(parameters[parameters_cnt-1],"-%s %s",input->name,targetPath);
537        }
538      }
539      free(targetPath);
540    }
541    input=input->next;
542  }
543  // Produce the SBATCH File locally
544  char *scriptPath=(char*)malloc((strlen(s->name)+strlen(tmpPath->value)+strlen(uuid->value)+10)*sizeof(char));
545  sprintf(scriptPath,"%s/zoo_%s_%s.sh",tmpPath->value,s->name,uuid->value);
546  setMapInMaps(*main_conf,"lenv","local_script",scriptPath);
547#ifdef HPC_DEBUG
548  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
549  fflush(stderr);
550#endif
551  invokeCallback(m,inputs,NULL,3,0);
552#ifdef HPC_DEBUG
553  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
554  fflush(stderr);
555#endif
556  FILE* scriptFile=fopen(scriptPath,"w+");
557  map* headerMap=getMapFromMaps(*main_conf,configurationId,"jobscript_header");
558  if(headerMap!=NULL){
559    // Use the header file if defined in the HPC section of the main.cfg file
560    struct stat f_status;
561    int s=stat(headerMap->value, &f_status);
562    if(s==0){
563      char* fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
564      FILE* f=fopen(headerMap->value,"rb");
565      fread(fcontent,f_status.st_size,1,f);
566      int fsize=f_status.st_size;
567      fcontent[fsize]=0;
568      fclose(f);
569      fprintf(scriptFile,"%s\n### --- ZOO-Service HEADER end --- ###\n\n",fcontent);
570      free(fcontent);
571    }else
572      fprintf(scriptFile,"#!/bin/bash\n\n### *** Default ZOO-Service HEADER (no header found) *** ###\n\n");
573  }else
574    fprintf(scriptFile,"#!/bin/bash\n\n### *** Default ZOO-Service HEADER *** ###\n\n");
575  maps* hpc_opts=getMaps(*main_conf,configurationId);
576  if(hpc_opts!=NULL){
577    map* hpc_opts_content=hpc_opts->content;
578    while(hpc_opts_content!=NULL){
579      if(strncasecmp(hpc_opts_content->name,"sbatch_options_",15)==0)
580        fprintf(scriptFile,"#SBATCH --%s=%s\n",strstr(hpc_opts_content->name,"sbatch_options_")+15,hpc_opts_content->value);
581      hpc_opts_content=hpc_opts_content->next;
582    }
583  }
584  fprintf(scriptFile,"#SBATCH --job-name=ZOO-Project_%s_%s\n\n",uuid->value,s->name);
585  map* mods=getMap(s->content,"hpcModules");
586  if(mods!=NULL)
587    fprintf(scriptFile,"#SBATCH --export=MODULES=%s\n",mods->value);
588
589  map* bodyMap=getMapFromMaps(*main_conf,configurationId,"jobscript_body");
590  if(bodyMap!=NULL){
591    // Use the header file if defined in the HPC section of the main.cfg file
592    struct stat f_status;
593    int s=stat(bodyMap->value, &f_status);
594    if(s==0){
595      char* fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
596      FILE* f=fopen(bodyMap->value,"rb");
597      fread(fcontent,f_status.st_size,1,f);
598      int fsize=f_status.st_size;
599      fcontent[fsize]=0;
600      fclose(f);
601      fprintf(scriptFile,"%s\n### --- ZOO-Service BODY end --- ###\n\n",fcontent);
602      free(fcontent);
603    }else
604      fprintf(scriptFile,"\n### *** Default ZOO-Service BODY (no body found) *** ###\n\n");
605  }else
606    fprintf(scriptFile,"\n### *** Default ZOO-Service BODY *** ###\n\n");
607
608  map* sp=getMap(s->content,"serviceProvider");
609 
610  // Require to produce the command line to be executed
611  fprintf(scriptFile,"\n\necho \"Job started at: $(date)\"\n");
612  fprintf(scriptFile,"echo \"Running service: [%s]\"\n",sp->value);
613  fprintf(scriptFile,"%s ",sp->value);
614  for(int i=0;i<parameters_cnt;i++){
615    fprintf(scriptFile," %s",parameters[i]);
616  }
617  for(int i=parameters_cnt-1;i>=0;i--){
618    free(parameters[i]);
619  }
620  free(parameters);
621  fprintf(scriptFile,"\n");
622  fprintf(scriptFile,"echo \"Job finished at: $(date)\"\n");
623  fflush(scriptFile);
624  fclose(scriptFile);
625#ifdef HPC_DEBUG
626  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
627#endif
628  invokeCallback(m,inputs,NULL,3,1);
629#ifdef HPC_DEBUG
630  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
631#endif
632
633  // Upload the SBATCH File to the remote host
634#ifdef HPC_DEBUG
635  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
636#endif
637  invokeCallback(m,inputs,NULL,4,0);
638#ifdef HPC_DEBUG
639  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
640#endif
641  targetPathMap=getMapFromMaps(*main_conf,configurationId,"remote_work_path");
642  if(targetPathMap==NULL){
643    setMapInMaps(*main_conf,"lenv","message",_("There is no remote_work_path defined in your section!"));
644    setMapInMaps(*main_conf,"lenv","status","failed");
645    errorException (*main_conf, _("There is no remote_work_path defined in your section!"),
646                    "InternalError", NULL);
647#ifdef HPC_DEBUG
648    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
649    fflush(stderr);
650#endif
651    invokeCallback(*main_conf,NULL,NULL,7,0);
652#ifdef HPC_DEBUG
653    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
654    fflush(stderr);
655#endif
656    return SERVICE_FAILED;
657  }
658  char* targetName=strrchr(scriptPath,'/');
659  char *targetPath=(char*)malloc((strlen(targetPathMap->value)+strlen(targetName)+2)*sizeof(char));
660  sprintf(targetPath,"%s/%s",targetPathMap->value,targetName);
661  setMapInMaps(*main_conf,"lenv","remote_script",targetPath);
662  SSHCON *test=ssh_connect(*main_conf);
663  int copy0=ssh_copy(*main_conf,scriptPath,targetPath,ssh_get_cnt(*main_conf));
664  unlink(scriptPath);
665  free(scriptPath);
666  if(copy0!=true){
667    setMapInMaps(*main_conf,"lenv","message",_("Unable to upload the script"));
668    invokeCallback(*main_conf,NULL,NULL,7,0);
669    errorException(*main_conf,_("Unable to upload the script"),"NoApplicableCode",NULL);
670    return -1;
671  }
672  // Execute the SBATCH script remotely
673  addReadLocks(main_conf);
674  map* subStr=getMapFromMaps(*main_conf,configurationId,"sbatch_substr");
675  char *command=(char*)malloc((strlen(targetPath)+strlen(targetPathMap->value)+strlen(subStr->value)+strlen(uuid->value)+137)*sizeof(char));
676  sprintf(command,"sbatch %s 2> %s/error_%s.log | sed \"s:%s::g\"",targetPath,targetPathMap->value,uuid->value,subStr->value);
677  if(ssh_exec(*main_conf,command,ssh_get_cnt(m))<=0){
678    // The sbatch command has failed!
679    // Download the error log file from the HPC server
680    char tmpS[1024];
681    free(command);
682    command=(char*)malloc((strlen(targetPathMap->value)+strlen(uuid->value)+11)*sizeof(char));
683    sprintf(command,"%s/error_%s.log",targetPathMap->value,uuid->value);
684    targetName=strrchr(command,'/');
685    free(targetPath);
686    targetPath=(char*)malloc((strlen(tmpPath->value)+strlen(targetName)+2)*sizeof(char));
687    sprintf(targetPath,"%s/%s",tmpPath->value,targetName);
688    if(ssh_fetch(*main_conf,targetPath,command,ssh_get_cnt(m))==0){
689      struct stat f_status;
690      int ts=stat(targetPath, &f_status);
691      if(ts==0) {
692        char* fcontent = NULL;
693        fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
694        FILE* f=fopen(targetPath,"rb");
695        fread(fcontent,f_status.st_size,1,f);
696        int fsize=f_status.st_size;
697        fcontent[fsize]=0;
698        fclose(f);
699        setMapInMaps(*main_conf,"lenv","message",fcontent);
700        free(fcontent);
701      }else
702        setMapInMaps(*main_conf,"lenv","message",_("No message provided"));
703    }else
704      setMapInMaps(*main_conf,"lenv","message",_("Unable to fetch the remote error log file"));
705    tmpPath=getMapFromMaps(m,"lenv","message");
706#ifdef HPC_DEBUG
707    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
708    fflush(stderr);
709#endif
710    invokeCallback(*main_conf,NULL,NULL,7,0);
711#ifdef HPC_DEBUG
712    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
713    fflush(stderr);
714#endif
715    sprintf(tmpS, "Cannot execute the HPC ZOO-Service %s using %s: %s", s->name, configurationId, tmpPath->value);
716    errorException(*main_conf,tmpS,"NoApplicableCode",NULL);
717    free(command);
718    free(targetPath);
719    ssh_close(*main_conf);
720    removeReadLocks(main_conf);
721    return -1;
722  }
723  free(targetPath);
724#ifdef HPC_DEBUG
725  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
726  fflush(stderr);
727#endif
728  invokeCallback(m,NULL,NULL,4,1);
729#ifdef HPC_DEBUG
730  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
731  fflush(stderr);
732#endif
733  free(command);
734#ifdef HPC_DEBUG
735  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
736  fflush(stderr);
737#endif
738
739  struct sockaddr_un addr;
740  memset(&addr, 0, sizeof(addr));
741  addr.sun_family = AF_UNIX;
742  int rc, cl, fd = socket(AF_UNIX, SOCK_STREAM, 0);
743  char *sname=(char*)malloc((strlen(tmpPath->value)+strlen(uuid->value)+20));
744  sprintf(sname,"%s/.wait_socket_%s.sock",tmpPath->value,uuid->value);
745  strncpy(addr.sun_path, sname, sizeof(addr.sun_path)-1);
746 
747  if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
748    perror("bind error");
749    setMapInMaps(*main_conf,"lenv","message",_("Unable to bind socket!"));
750    errorException (*main_conf, _("Unable to bind socket!"),
751                    "InternalError", NULL);
752#ifdef HPC_DEBUG
753    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
754    fflush(stderr);
755#endif
756    invokeCallback(*main_conf,NULL,NULL,7,0);
757    removeReadLocks(main_conf);
758#ifdef HPC_DEBUG
759    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
760    fflush(stderr);
761#endif
762    return -1;
763  }
764#ifdef HPC_DEBUG
765  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
766  fflush(stderr);
767#endif
768  if (listen(fd, 5) == -1) {
769    setMapInMaps(*main_conf,"lenv","message",_("Listen error"));
770    errorException (*main_conf, _("Listen error"),
771                    "InternalError", NULL);
772#ifdef HPC_DEBUG
773    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
774    fflush(stderr);
775#endif
776    invokeCallback(*main_conf,NULL,NULL,7,0);
777    removeReadLocks(main_conf);
778#ifdef HPC_DEBUG
779    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
780    fflush(stderr);
781#endif
782    return -1;
783  }
784  if ( (cl = accept(fd, NULL, NULL)) == -1) {
785    setMapInMaps(*main_conf,"lenv","message",_("Accept error"));
786    errorException (*main_conf, _("Accept error"),
787                    "InternalError", NULL);
788#ifdef HPC_DEBUG
789    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
790    fflush(stderr);
791#endif
792    invokeCallback(*main_conf,NULL,NULL,7,0);
793    removeReadLocks(main_conf);
794#ifdef HPC_DEBUG
795    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
796    fflush(stderr);
797#endif
798    return -1;
799  }else{
800#ifdef HPC_DEBUG
801    fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
802    fflush(stderr);
803#endif
804    int hasPassed=-1;
805    char buf[11];
806    memset(&buf,0,11);
807    while ( (rc=read(cl,buf,10)) ) {     
808      if(rc==0){
809        setMapInMaps(*main_conf,"lenv","message",_("Read closed"));
810        errorException (*main_conf, _("Read closed"),
811                        "InternalError", NULL);
812#ifdef HPC_DEBUG
813        fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
814        fflush(stderr);
815#endif
816        invokeCallback(*main_conf,NULL,NULL,7,0);
817        removeReadLocks(main_conf);
818#ifdef HPC_DEBUG
819        fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
820        fflush(stderr);
821#endif
822        return -1;
823      }else{
824        if(rc<0){
825          setMapInMaps(*main_conf,"lenv","message",_("Read error"));
826          errorException (*main_conf, _("Read error"),
827                          "InternalError", NULL);
828#ifdef HPC_DEBUG
829          fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
830          fflush(stderr);
831#endif
832          invokeCallback(*main_conf,NULL,NULL,7,0);
833          removeReadLocks(main_conf);
834#ifdef HPC_DEBUG
835          fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
836          fflush(stderr);
837#endif
838          return -1;
839        }
840      }
841      hasPassed=1;
842      res=atoi(buf);
843      unlink(sname);
844      free(sname);
845      removeReadLocks(main_conf);
846 
847      if(res==3){
848#ifdef HPC_DEBUG
849        fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
850        fflush(stderr);
851#endif
852        invokeCallback(m,NULL,outputs,5,0);
853#ifdef HPC_DEBUG
854        fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
855        fflush(stderr);
856#endif
857
858        // Read informations provided by FinalizeHPC as a configuration file
859        // then, remove the file.
860        map* jobid=getMapFromMaps(*main_conf,"lenv","usid");
861        map* tmpPath=getMapFromMaps(*main_conf,"main","tmpPath");
862        char *filePath=(char*)malloc((strlen(tmpPath->value)+strlen(jobid->value)+15)*sizeof(char));
863        sprintf(filePath,"%s/exec_status_%s",tmpPath->value,jobid->value);
864        maps* m = (maps *) malloc (MAPS_SIZE);
865        m->child=NULL;
866        m->next=NULL;
867        int saved_stdout = dup (fileno (stdout));
868        dup2 (fileno (stderr), fileno (stdout));
869        conf_read(filePath,m);
870        fflush(stdout);
871        dup2 (saved_stdout, fileno (stdout));
872        close(saved_stdout);
873        unlink(filePath);
874        free(filePath);
875        addMapsToMaps(main_conf,m);
876        freeMaps(&m);
877        free(m);
878
879        input=*real_outputs;
880        while(input!=NULL){
881          if(input->child==NULL){
882            map* generatedFile=getMap(input->content,"generated_file");
883            if(generatedFile!=NULL){
884              char* filename=strrchr(generatedFile->value,'/');
885              char* targetPath=(char*)malloc((strlen(tmpPath->value)+strlen(filename)+2)*sizeof(char));
886              sprintf(targetPath,"%s/%s",tmpPath->value,filename);
887              test=ssh_connect(*main_conf);
888              if(ssh_fetch(*main_conf,targetPath,generatedFile->value,ssh_get_cnt(m))==0){
889                setMapInMaps(*real_outputs,input->name,"generated_file",targetPath);
890                free(targetPath);
891              }else{
892                map* hpcStdErr=getMapFromMaps(*main_conf,"henv","StdErr");
893                if(hpcStdErr!=NULL && ssh_fetch(*main_conf,targetPath,hpcStdErr->value,ssh_get_cnt(m))==0){
894                  struct stat f_status;
895                  int ts=stat(targetPath, &f_status);
896                  if(ts==0) {
897                    char* fcontent = NULL;
898                    fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
899                    FILE* f=fopen(targetPath,"rb");
900                    fread(fcontent,f_status.st_size,1,f);
901                    int fsize=f_status.st_size;
902                    fcontent[fsize]=0;
903                    fclose(f);
904                    setMapInMaps(*main_conf,"lenv","message",fcontent);
905                    free(fcontent);
906                  }else{
907                    char *tmpStr=(char*)malloc((strlen(filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));
908                    sprintf(tmpStr,_("Unable to fetch the remote file for %s"),filename);
909                    setMapInMaps(*main_conf,"lenv","message",tmpStr);
910                    free(tmpStr);
911                  }
912                }else{
913                  char *tmpStr=(char*)malloc((strlen(filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));
914                  sprintf(tmpStr,_("Unable to fetch the remote file for %s"),filename);
915                  setMapInMaps(*main_conf,"lenv","message",tmpStr);
916                  free(tmpStr);
917                }
918                invokeCallback(*main_conf,NULL,NULL,7,0);
919                return SERVICE_FAILED;
920              }
921            }       
922          }else{
923            map* generatedFile=getMap(input->content,"generated_file");
924            map* generatedUrl=getMap(input->content,"generated_url");
925            if(generatedFile!=NULL){
926              char* filename=strrchr(generatedFile->value,'/');
927              char* targetPath=(char*)malloc((strlen(tmpPath->value)+strlen(filename)+2)*sizeof(char));
928              sprintf(targetPath,"%s/%s",tmpPath->value,filename);
929              test=ssh_connect(*main_conf);
930              if(ssh_fetch(*main_conf,targetPath,generatedFile->value,ssh_get_cnt(m))==0){
931                maps* tmp=getMaps(*real_outputs,input->name);
932                char serviceName[9];
933                freeMap(&tmp->content);
934                free(tmp->content);
935                tmp->content=NULL;
936                maps* output=getMaps(*real_outputs,input->name);
937                setMapInMaps(output->child,"download_link","generated_file",targetPath);
938                setMapInMaps(output->child,"download_link","generated_url",generatedUrl->value);
939                setMapInMaps(output->child,"download_link","storage",targetPath);
940                setMapInMaps(output->child,"download_link","useMapserver","false");
941                setMapInMaps(output->child,"download_link","replicateStorageNext","true");
942                setMapInMaps(output->child,"download_link","asReference","true");
943                setMapInMaps(output->child,"download_link","inRequest","true");
944                setMapInMaps(output->child,"wms_link","generated_file",targetPath);
945                setMapInMaps(output->child,"wms_link","storage",targetPath);
946                setMapInMaps(output->child,"wms_link","useMapserver","true");
947                setMapInMaps(output->child,"wms_link","msOgc","WMS");
948                setMapInMaps(output->child,"wms_link","requestedMimeType","image/png");
949                setMapInMaps(output->child,"wms_link","asReference","true");
950                if(getMaps(output->child,"wcs_link")!=NULL){
951                  sprintf(serviceName,"wcs_link");
952                  setMapInMaps(output->child,"wcs_link","msOgc","WCS");
953                }else{
954                  sprintf(serviceName,"wfs_link");
955                  setMapInMaps(output->child,"wfs_link","msOgc","WFS");
956                }
957                setMapInMaps(output->child,serviceName,"storage",targetPath);
958                setMapInMaps(output->child,serviceName,"generated_file",targetPath);
959                setMapInMaps(output->child,serviceName,"useMapserver","true");
960                setMapInMaps(output->child,serviceName,"asReference","true");
961              }else{
962                map* hpcStdErr=getMapFromMaps(*main_conf,"henv","StdErr");
963                if(hpcStdErr!=NULL && ssh_fetch(*main_conf,targetPath,hpcStdErr->value,ssh_get_cnt(m))==0){
964                  struct stat f_status;
965                  int ts=stat(targetPath, &f_status);
966                  if(ts==0) {
967                    char* fcontent = NULL;
968                    fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
969                    FILE* f=fopen(targetPath,"rb");
970                    fread(fcontent,f_status.st_size,1,f);
971                    int fsize=f_status.st_size;
972                    fcontent[fsize]=0;
973                    fclose(f);
974                    setMapInMaps(*main_conf,"lenv","message",fcontent);
975                    free(fcontent);
976                  }else{
977                    char *tmpStr=(char*)malloc((strlen(filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));
978                    sprintf(tmpStr,_("Unable to fetch the remote file for %s"),filename);
979                    setMapInMaps(*main_conf,"lenv","message",tmpStr);
980                    free(tmpStr);
981                  }
982                }else{
983                  char *tmpStr=(char*)malloc((strlen(filename)+strlen(_("Unable to fetch the remote file for %s"))+1)*sizeof(char));
984                  sprintf(tmpStr,_("Unable to fetch the remote file for %s"),filename);
985                  setMapInMaps(*main_conf,"lenv","message",tmpStr);
986                  free(tmpStr);
987                }
988                invokeCallback(*main_conf,NULL,NULL,7,0);
989                return SERVICE_FAILED;
990              }
991              free(targetPath);
992            }
993          }
994          input=input->next;
995        }
996
997      }else{
998        // Try to access remotely to the log file and return a more relevant error message
999        setMapInMaps(*main_conf,"lenv","message",_("HPC Execution failed!"));
1000        errorException (*main_conf, _("HPC Execution failed!"),
1001                        "InternalError", NULL);
1002#ifdef HPC_DEBUG
1003        fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
1004        fflush(stderr);
1005#endif
1006        invokeCallback(*main_conf,NULL,NULL,7,0);
1007#ifdef HPC_DEBUG
1008        fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
1009        fflush(stderr);
1010#endif
1011      }
1012    }
1013    if(hasPassed<0){
1014      perror("Failed to read");
1015      setMapInMaps(*main_conf,"lenv","message",_("Unable to parse the value returned by remote execution"));
1016      errorException (*main_conf, _("Unable to parse the value returned by remote execution"),
1017                      "InternalError", NULL);
1018#ifdef HPC_DEBUG
1019      fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
1020      fflush(stderr);
1021#endif
1022      invokeCallback(*main_conf,NULL,NULL,7,0);
1023#ifdef HPC_DEBUG
1024      fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
1025      fflush(stderr);
1026#endif
1027      return SERVICE_FAILED;
1028    }
1029  }
1030#ifdef HPC_DEBUG
1031  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
1032  fflush(stderr);
1033#endif
1034  ssh_close(*main_conf);
1035#ifdef HPC_DEBUG
1036  fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
1037  fflush(stderr);
1038#endif
1039  return res;
1040}
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png