Changeset - d1b199f51bbd
[Not reviewed]
default
0 2 0
ethanzonca@localhost.localdomain - 16 years ago 2009-11-24 00:07:50
ethanzonca@localhost.localdomain
Upload failure management
2 files changed with 18 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -176,7 +176,20 @@ int main(int argc, char *argv[])
 

	
 
        /* When blender is finished, run this... */
 
        fprintf(stderr, "Finished frame %d in job %d, uploading...", framenum, jobnum);
 
        curlpost(pathtoOutput, urltoOutput); /* uploads (HTML POST) the output at outputpath to the server at outputurl */
 
        if( !curlpost(pathtoOutput, urltoOutput)){ // Uploads output
 
          fprintf(stderr,"Upload successful, removing old output...\n");
 
          remove(pathtoOutput); // Delete the file after its uploaded
 
        }
 
        else{
 
          fprintf(stderr,"Upload failed. Check your network connection. Trying again...");
 
          int tries=0;
 
          while(tries<10 && curlpost(pathtoOutput, urltoOutput)){
 
              fprintf(stderr, "Upload failed. Trying again in 10 seconds... (attempt %d of 10)", tries);
 
              tries++;
 
              sleep(10);
 
          }
 
          // @TODO: Keep track of files that we were unable to upload, and upload them later
 
        }
 
        free(urltoOutput);
 
        free(pathtoOutput);
 

	
 
@@ -185,13 +198,14 @@ int main(int argc, char *argv[])
 
      }
 
    else
 
      fprintf(stderr,"Nothing to do. Idling...\n");
 

	
 
    // If the server says that every frame for the last jobnum is finished, OR if the data is getting old
 
    if(1 == 0){
 
      // Note: individual frames are already deleted after uploading,
 
      // except for ones that couldn't be uploaded
 
      delete_jobdata(jobnum, datadir);
 
    }
 

	
 

	
 

	
 
    sleep(5); // Poll 5 seconds. @TODO: Remove all polling
 
  }
 
  return 0;
src/server/slavefuncs.c
Show inline comments
 
@@ -156,7 +156,7 @@ int curlpost(char *filename, char *url){
 
    curl_formfree(formpost);
 
    curl_slist_free_all (headerlist);
 
  }
 
  return 0;
 
  return res;
 
}
 

	
 

	
0 comments (0 inline, 0 general)