Changeset - 60d3bb17d7d3
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 16 years ago 2009-05-23 21:16:17
ohnobinki@ohnopublishing.net
fixed distren_submit_file declaration, added sample calls to libdistren
2 files changed with 16 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/client/distren.c
Show inline comments
 
@@ -35,27 +35,31 @@
 
#include <stdlib.h> /* malloc, free */
 
#include <unistd.h> /* getopt */
 
#include <libxml/tree.h> /* Happy fun XML time */
 
#include <libxml/xmlwriter.h>
 
#include <confuse.h>
 
#include <string.h> // for strcat
 

	
 

	
 
int main(int argc, char *argv[])
 
{
 
  char *input;
 
  char *output;
 
  char *jobid;
 
  
 
  char curopt;
 

	
 
  distren_t distren;
 
  distren_job_t distren_job;
 

	
 
  struct options_common *options;
 

	
 
  cfg_t *cfg;
 

	
 
  cfg_opt_t cfg_opts[] =
 
    {
 
      CFG_STR_LIST("render_types", NULL, 0),
 
      CFG_STR("username", NULL, 0),
 
      CFG_STR("name", NULL, 0),
 
      CFG_STR("email", NULL, 0),
 
      CFG_END()
 
    };
 
@@ -109,24 +113,34 @@ int main(int argc, char *argv[])
 
     give this error after the general arguments parsing so that
 
     the general help from options_init can have effect 
 
  */
 
  if(!input
 
     || !output)
 
    {
 
      fprintf(stderr, "Input and output files must be specified\n");
 
      return 1;
 
    }
 

	
 
  fprintf(stderr, "reading from %s\nwriting to %s\n", input, output);
 
  
 
  distren_init_mf(&distren, &malloc, &free);
 
  
 
  distren_submit_file(distren, &distren_job, input);
 
  
 
  distren_job_getid(distren_job, &jobid);
 
  fprintf(stdout, "jobid: %s\n", jobid);
 
  
 
  distren_job_free(distren_job);
 
  
 
  distren_free(distren);
 
  
 

	
 
  // Please find a better way of doing this :( you can't strcat multiple strings.. meh
 
  // use something like sprintf
 
  //char *username = cfg_getstr(cfg, "username");
 
  //char *hostname = cfg_getstr(cfg, "hostname");
 
  //strcat(username, "@");
 
  //strcat(username, hostname);
 

	
 
  // SSH's to client machine with the username speficied.
 
    char buf[10];
 
    struct execio *testrem;
src/client/distren.h
Show inline comments
 
@@ -39,27 +39,27 @@ typedef struct distren_job *distren_job_
 
 to be passed.
 
*/
 
int distren_init_mf(distren_t *handle, distren_malloc_t mymalloc, distren_free_t myfree);
 

	
 
/**
 
 Initializes a libdistren handle using the system malloc() and free() implementation.
 
*/
 
int distren_init(distren_t *handle);
 

	
 
/**
 
 Submits a file to distren.
 
 @param job must not refer to a valid job.
 
 TODO: create a stream-based interface
 
 @TODO create a stream-based interface
 
*/
 
int distren_submit_file(distren_job_t *job, const char *filename);
 
int distren_submit_file(distren_t handle, distren_job_t *job, const char *filename);
 

	
 
/**
 
   Retrieve a job-ID that can be used to refer to the job after the client's process has recycled. Currently, this will be the only way to retrieve a job handle (a distren_job_t) and, consequently, the only way to retrieve a finished render.
 
   A job ID is representable using a character string. Hopefully, they will be kept at a reasonably small length. It should be made up of alphanumeric characters so as to be useful in most situations. 
 
   @param jobid This will be set to a string allocated by the specified malloc implementation
 
   @param job The distren_job_t from which to retrieve a jobid
 
*/
 
int distren_job_getid(distren_job_t job, char **jobid);
 

	
 
/*
 
 TODO: extraction of a job-ID, retrieving job handle by job-ID, getting information
 
 for a job handle, retrieving results of a job, callbacks for progress (i.e., job_is_finished callback)
0 comments (0 inline, 0 general)