Changeset - 8c97631a877d
[Not reviewed]
default
0 2 0
Ethan Zonca (ethanzonca) - 15 years ago 2010-09-03 00:11:31
e@ethanzonca.com
Cleaned up cmdline output
2 files changed with 13 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/server/simpleslave.c
Show inline comments
 
@@ -199,26 +199,26 @@ if(updateConf){
 
	  _web_setrenderpower(slavekey, password, renderPower);
 
	  return 0;
 
	}
 
    }
 

	
 
  if(!DEBUG)
 
    fprintf(stderr, "Running..");
 
    fprintf(stderr, "Running...");
 
  // Main loop
 
  while(!quit)
 
    {
 

	
 
    // request work
 
    if(DEBUG)
 
      fprintf(stderr,"Requesting work from %s...\n", hostname);
 
    haveWork = _web_getwork(slavekey, password, &jobnum, &framenum);
 

	
 
    /* If we got a frame */
 
    if(haveWork)
 
      {
 
        fprintf(stderr,"Got work from server...\n");
 
        fprintf(stderr,"\nGot work from server...\n");
 
        if(DEBUG)
 
          fprintf(stderr, "Preparing to render frame %d in job %d\n", framenum, jobnum);
 

	
 
        prepareJobPaths(jobnum, framenum, outputExt, datadir, &urltoTar, &pathtoTar, &pathtoTardir, &pathtoJob, &pathtoJobfile, &urltoJobfile, &urltoOutput, &pathtoOutput, &pathtoRenderOutput, &pathtoOutdir);
 
        //free(outputExt);
 
        mkdir(pathtoTardir, 0700);
src/server/slavefuncs.c
Show inline comments
 
@@ -373,25 +373,26 @@ int downloadTar(char *url, char *destina
 
      else if(ret == 1){
 
        fprintf(stderr, "Downloading job data from %s failed. Check your network connection.\n",url);
 
        free(url);
 
        return 1; // Eventually make a retry loop
 
      }
 
    }
 
  fprintf(stderr, "Tar at %s already exists! Download cancelled.\n", destinationPath);
 
  if(DEBUG)
 
    fprintf(stderr, "Tar at %s already exists! Download cancelled.\n", destinationPath);
 
  return 2;
 
}
 

	
 

	
 
int uploadOutput(char *pathtoOutput, char *urltoOutput, int jobnum, int framenum, int slavekey){
 
  //fprintf(stderr,"Uploading output %s to url %s for job %d and frame %d for slavekey %d", pathtoOutput, urltoOutput, jobnum, framenum, slavekey);
 
  if( !curlpost(pathtoOutput, urltoOutput, jobnum, framenum, slavekey)) // Uploads output
 
    {
 
      if(DEBUG)
 
        fprintf(stderr,"Upload successful, removing old output...\n");
 
      else
 
        fprintf(stderr,"Upload completed\n");
 
        fprintf(stderr,"Uploaded\n");
 

	
 
      remove(pathtoOutput); // Delete the file after its uploaded
 
      return 0;
 
    }
 
  else
 
    {
 
@@ -612,38 +613,41 @@ struct _web_memorystruct _web_getrequest
 
void _web_finishframe(int slavekey, char *slavepass, int jobnum, int framenum){
 
  char *url;
 
  _distren_asprintf(&url,"http://distren.org/slave/act.php?mode=finishframe&slavekey=%d&slavepass=%s&jobnum=%d&framenum=%d", slavekey, slavepass, jobnum, framenum);
 
  struct _web_memorystruct data = _web_getrequest(url);
 
  free(url);
 

	
 
  fprintf(stderr,"%s\n", data.memory);
 
  if(DEBUG)
 
    fprintf(stderr,"%s\n", data.memory);
 
  if(data.memory)
 
    free(data.memory);
 
}
 

	
 
void _web_resetframe(int slavekey, char *slavepass, int jobnum, int framenum){
 
  fprintf(stderr,"Resetting frame %d in job %d on server... ",framenum,jobnum);
 
  char *url;
 
  _distren_asprintf(&url,"http://distren.org/slave/act.php?mode=resetframe&slavekey=%d&slavepass=%s&jobnum=%d&framenum=%d", slavekey, slavepass, jobnum, framenum);
 
  struct _web_memorystruct data = _web_getrequest(url);
 
  free(url);
 

	
 
  fprintf(stderr,"%s\n", data.memory);
 
  if(DEBUG)
 
    fprintf(stderr,"%s\n", data.memory);
 
  if(data.memory)
 
    free(data.memory);
 
}
 

	
 
void _web_startframe(int slavekey, char *slavepass, int jobnum, int framenum){
 
  if(DEBUG)
 
    fprintf(stderr,"Marking frame %d started on server... ",framenum);
 
  char *url;
 
  _distren_asprintf(&url,"http://distren.org/slave/act.php?mode=startframe&slavekey=%d&slavepass=%s&jobnum=%d&framenum=%d", slavekey, slavepass, jobnum, framenum);
 
  struct _web_memorystruct data = _web_getrequest(url);
 
  free(url);
 

	
 
  fprintf(stderr,"%s\n", data.memory);
 
  if(DEBUG)
 
    fprintf(stderr,"%s\n", data.memory);
 
  if(data.memory)
 
    free(data.memory);
 
}
 

	
 
int _web_getwork(int slavekey, char *slavepass, int *jobnum, int *framenum){
 
  char *url;
 
@@ -703,13 +707,14 @@ void _web_setrenderpower(int slavekey, c
 
  fprintf(stderr,"Setting render power on server... ");
 
  char *url;
 
  _distren_asprintf(&url,"http://distren.org/slave/act.php?mode=setrenderpower&slavekey=%d&slavepass=%s&renderpower=%d", slavekey, slavepass, renderpower);
 
  struct _web_memorystruct data = _web_getrequest(url);
 
  free(url);
 

	
 
  fprintf(stderr,"%s\n", data.memory);
 
  if(DEBUG)
 
    fprintf(stderr,"%s\n", data.memory);
 
  if(data.memory)
 
    free(data.memory);
 
}
 

	
 
int slaveBenchmark(char *datadir, int *benchmarkTime, int *renderPower){
 
  int ret;
0 comments (0 inline, 0 general)