# HG changeset patch # User ethanzonca@localhost.localdomain # Date 2009-06-28 18:08:48 # Node ID d6e050f635ca7361d00847abdfd38f8edd44962e # Parent 1a764fbbcb7b9ab356eb9958bf74d264f0e33cdd Removed non-uploader stuff from client.c, added some master/slave blender code that needs to be fleshed out alot, along with some mysql stuff that should be moved to common eventually. diff --git a/INSTALL b/INSTALL --- a/INSTALL +++ b/INSTALL @@ -2,15 +2,15 @@ Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007, 2008 Free Software Foundation, Inc. +2006, 2007 Free Software Foundation, Inc. - This file is free documentation; the Free Software Foundation gives +This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== - Briefly, the shell commands `./configure; make; make install' should +Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. @@ -73,9 +73,9 @@ The simplest way to compile this package Compilers and Options ===================== - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -88,7 +88,7 @@ is an example: Compiling For Multiple Architectures ==================================== - You can compile the package for more than one kind of computer at the +You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run @@ -100,24 +100,10 @@ architecture at a time in the source cod installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - Installation Names ================== - By default, `make install' installs the package's commands under +By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. @@ -140,7 +126,7 @@ option `--program-prefix=PREFIX' or `--p Optional Features ================= - Some packages pay attention to `--enable-FEATURE' options to +Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -152,36 +138,14 @@ find the X include and library files aut you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - Specifying the System Type ========================== - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -207,9 +171,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -218,7 +182,7 @@ A warning: not all `configure' scripts l Defining Variables ================== - Variables not defined in a site shell script can be set in the +Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -237,19 +201,11 @@ an Autoconf bug. Until the bug is fixed `configure' Invocation ====================== - `configure' recognizes the following options to control how it -operates. +`configure' recognizes the following options to control how it operates. `--help' `-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. + Print a summary of the options to `configure', and exit. `--version' `-V' @@ -276,16 +232,6 @@ operates. Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. -`--prefix=DIR' - Use DIR as the installation prefix. *Note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. diff --git a/src/client/distren.c b/src/client/distren.c --- a/src/client/distren.c +++ b/src/client/distren.c @@ -18,6 +18,9 @@ */ +/* This code is meant to submit files to the distren server(s). Let's say server for now. And let's state file purpose in each file just so we don't get screwed up! */ + + /* Ideas for php-side stuff: * * PHP adds the users... has captcha and email confirmation wth a pseudo-random number that @@ -37,6 +40,8 @@ int main(int argc, char *argv[]) { + + char *input; char *output; char *jobid; @@ -67,26 +72,26 @@ int main(int argc, char *argv[]) fprintf(stderr, "\t-i\tSpecifies the input file\n\ \t-o\tSpecifies the output file\n\ \t-h\tShows this help message\n"); - /* - don't return here because options_init will have an overall - options help page - */ + + // don't return here because options_init will have an overall + // options help page + } else if(curopt == 'i') - /* - TODO: is strdup good or bad? what about - the idea that all libs should allow plugging different - malloc/free implementations in? - */ + + // TODO: is strdup good or bad? what about + // the idea that all libs should allow plugging different + // malloc/free implementations in? + input = strdup(optarg); else if(curopt == 'o') output = strdup(optarg); } - /* - give this error after the general arguments parsing so that - the general help from options_init can have effect - */ + + // give this error after the general arguments parsing so that + // the general help from options_init can have effect + if(!input || !output) { @@ -121,88 +126,11 @@ int main(int argc, char *argv[]) return 1; } - /* if these following lines fail, it'll be reported as a core dump ;-) */ + // if these following lines fail, it'll be reported as a core dump ;-) distren_job_free(distren_job); distren_free(distren); - -// !!! Killed for now because I'm doing other randomness !!! // - // 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; - char *execargv[] = - { - "ssh", - "username", //cfg_getstr(cfg, "username") . "@" . cfg_getstr(cfg, "hostname"), - "-i guest.rsa", //yeaaaah any better ideas? - "sh", - "-c", - "\"echo hello from ${HOSTNAME}\"", // "\"useradd -M -c" strcat( cfg_getstr(cfg, "name") cfg_getstr(cfg, "email")) "-d /home/distren --gid 537" cfg_getstr(cfg, "username") "\"", - (char *)NULL - }; - - size_t readlen; - fprintf(stderr, "execio madness is occuring!"); - fprintf(stderr, "execio_open returns %d\n", execio_open(&testrem, "ssh", execargv)); - buf[9] = '\0'; */ - /* - while(!execio_read(testrem, buf, 9, &readlen)) - { - if(readlen > 9 ) - { - fprintf(stderr, "execio_read doesn't set readlen correctly or read() is messed up\n"); - return 1; - } - buf[readlen] = '\0'; - fprintf(stderr, "read \"%s\"\n", buf); - } - execio_close(testrem); - */ - // Can we prune off some of this code up here^? I'm not exactly sure how execio returns output, but it seems like more could be happening in execio itself, and less happening where it is actually called. - // We need some code to ssh, and if the SSH fails, tell the user to register. - // Killed the user reg code, as the php interface will take care of this. Although it should check for users... - - - - // ------------------------------ - // Ok, this is just to do something to keep distren aliveish... Kill if needed/wanted/meh'd. Borrowed some code from matt's blender.c - - -// Vars to fill: - int os=1; - unsigned int frame_to_render; // initialize this somewhere else... - frame_to_render = 10; // temporary, the number 10 will be replaced with a function call - char *filename; - - - if(os == 1){char *bin[44] = "blender.exe";} - else{char *bin[28] = "blender";} // mac/*nix - - // Placeholders? figure out what the last one is... - char *format = "%s -b \"%s\" -o %s -f %d -F JPEG -x 1",bin,input,output; /* the format string to pass to sprintf */ - size_t blenderstrlen; - - // This seems pretty ridik. Just sayin'. We gotta switch this up. - blenderstrlen = strlen(format) - 2 * 2 /* format string minus placeholders */ + strlen(filename) + intstrlen(frame_to_render) + 1 /* NULL terminator */; - char *blendercmd = malloc(blenderstrlen); - snprintf(blendercmd, blenderstrlen, format, filename, frame_to_render); - - fprintf(stderr, "will run job num. %s ``%s''\n",jobid,blendercmd); - free(blendercmd); - - - // -------------End cruddy code that will eventually compose blender.c----------------- - - return 0; }; diff --git a/src/common/options.c b/src/common/options.c --- a/src/common/options.c +++ b/src/common/options.c @@ -17,6 +17,8 @@ along with DistRen. If not, see . */ +/* The purpose of this file is to... */ + #include "options.h" #include diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -87,3 +87,52 @@ int main(int argc, char *argv[]) return 0; } + + +/* Blender Rendering Code: + +/////////////////////// MASTER /////////////////////////////// + +// MySQL Setup Code (put in common maybe) +#include +MYSQL *conn; +MYSQL_RES *res; +MYSQL_ROW row; +// + char *server = "localhost"; // change if/when we do the multiserver setup... then distributed mysql with ssl? haha + char *user = "mysql"; + char *password = "mysql"; // heh + char *database = "distrend"; // check... I think this exists already on my server(s) +// +conn = mysql_init(NULL); +if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); return (0); } + + + + +// Queuer +void queue(char *filename, int priority, char name, char submitter, char contact) { + +// Todo... store frame status in mysql tables, along with table with list of jobs/submitters/contact info/whatever else we want + +} + + + +///////////////////////// SLAVE /////////////////////////////// + + +// Execution Function +void blendrend(char *input, char *output, int sframe, int eframe) { + int ret; + char *cmd[] = { "blender", "-b", "-o", output, input, "-s", sframe, "-e", eframe, (char *)0 }; + ret = execv ("/usr/bin/blender", cmd); + // fprintf(stderr, "blender -b -o %s %s -s %d -e %d \n",output,input,sframe,eframe); +} +blendrend(input,output,100, 206); // arbitrary example referencing the function + + + + + + */