2003-08-19 06:44:58 +00:00
|
|
|
<?
|
|
|
|
require_once("docutil.php");
|
|
|
|
page_head("Generating work");
|
|
|
|
echo "
|
2002-05-24 04:29:10 +00:00
|
|
|
<p>
|
2002-08-19 18:43:10 +00:00
|
|
|
Workunits and results can be created using either a utility program
|
2002-11-07 19:31:34 +00:00
|
|
|
or a C++ function.
|
2003-01-09 21:48:33 +00:00
|
|
|
In either case you must first <a href=key_setup.html>generate a key pair</a>
|
|
|
|
for file upload authentication.
|
|
|
|
<hr>
|
2002-11-07 19:31:34 +00:00
|
|
|
The utility program is
|
2002-05-24 04:29:10 +00:00
|
|
|
<pre>
|
|
|
|
create_work
|
2002-11-07 19:31:34 +00:00
|
|
|
-appname name // application name
|
|
|
|
-wu_name name // workunit name
|
|
|
|
-wu_template filename // WU template filename
|
|
|
|
-result_template filename // result template filename
|
2003-08-08 17:35:18 +00:00
|
|
|
-redundancy n // # of results to create
|
2002-11-07 19:31:34 +00:00
|
|
|
-db_name x // database name
|
|
|
|
-db_passwd x // database password
|
|
|
|
-upload_url x // URL for output file upload
|
|
|
|
-download_url x // base URL for input file download
|
|
|
|
-download_dir x // where to move input files
|
|
|
|
-rsc_fpops x // est. # floating-point ops
|
|
|
|
-rsc_iops x // est. # integer ops
|
|
|
|
-rsc_memory x // est. RAM working set size, bytes
|
|
|
|
-rsc_disk x // est. disk space required
|
|
|
|
-keyfile x // path of upload private key
|
|
|
|
-delay_bound x // delay bound for result completion
|
|
|
|
infile_1 ... infile_m // input files
|
|
|
|
</pre>
|
2002-05-24 04:29:10 +00:00
|
|
|
<p>
|
2003-08-15 22:19:25 +00:00
|
|
|
The WU template file has the form
|
|
|
|
<pre>
|
|
|
|
[ <file_info>...</file_info> ]
|
|
|
|
[ ... ]
|
|
|
|
<workunit>
|
|
|
|
[ <command_line>-flags xyz</command_line> ]
|
|
|
|
[ <env_vars>name=val&name=val</env_vars> ]
|
|
|
|
[ <max_processing>...</max_processing> ]
|
|
|
|
[ <max_disk>...</max_disk> ]
|
|
|
|
[ <file_ref>...</file_ref> ]
|
|
|
|
[ ... ]
|
|
|
|
</workunit>
|
|
|
|
</pre>
|
|
|
|
The components are:
|
|
|
|
<table border=1 cellpadding=6>
|
|
|
|
<tr><td><command_line></td>
|
|
|
|
<td>The command-line arguments to be passed to the main program.
|
|
|
|
</td></tr>
|
|
|
|
<tr><td><env_vars></td>
|
|
|
|
<td>A list of environment variables in the form
|
|
|
|
name=value&name=value&name=value.
|
|
|
|
</td></tr>
|
|
|
|
<tr><td valign=top><max_processing></td>
|
|
|
|
<td>Maximum processing
|
|
|
|
(measured in <a href=credit.html>Cobblestones</a>).
|
|
|
|
An instance of the computation that exceeds this bound will be aborted.
|
|
|
|
This mechanism prevents an infinite-loop bug from
|
|
|
|
indefinitely incapacitating a host.
|
|
|
|
The default is determined by the client; typically it is 1.
|
|
|
|
</td></tr>
|
|
|
|
<tr><td><max_disk></td>
|
|
|
|
<td>Maximum disk usage (in bytes).
|
|
|
|
The default is determined by the client; typically it is 1,000,000.
|
|
|
|
</td></tr>
|
|
|
|
<tr><td><file_ref></td>
|
2003-08-19 06:44:58 +00:00
|
|
|
<td> describes a <a href=files.html>reference</a> to an input file,
|
|
|
|
each of which is described by a <b><file_info></b> element.
|
2003-08-15 22:19:25 +00:00
|
|
|
</td></tr></table>
|
|
|
|
<p>
|
2002-12-12 01:07:24 +00:00
|
|
|
The workunit template file is processed as follows:
|
2002-05-24 04:29:10 +00:00
|
|
|
<ul>
|
2002-08-19 18:43:10 +00:00
|
|
|
<li>
|
2002-12-12 01:07:24 +00:00
|
|
|
Within a <file_info> element,
|
|
|
|
<number>x</number> identifies the order of the file.
|
|
|
|
It is replaced with elements giving
|
|
|
|
the filename, download URL, MD5 checksum, and size.
|
2002-07-29 19:01:38 +00:00
|
|
|
file.
|
2002-08-19 18:43:10 +00:00
|
|
|
<li>
|
2002-12-12 01:07:24 +00:00
|
|
|
Within a <file_ref> element,
|
2003-01-09 21:48:33 +00:00
|
|
|
<file_number>x</file_number> is replaced with the filename.
|
2002-05-24 04:29:10 +00:00
|
|
|
</ul>
|
|
|
|
<p>
|
2002-11-07 19:31:34 +00:00
|
|
|
The result file template is macro-substituted as follows:
|
2002-05-24 04:29:10 +00:00
|
|
|
<ul>
|
2002-08-19 18:43:10 +00:00
|
|
|
<li>
|
2002-11-07 19:31:34 +00:00
|
|
|
<OUTFILE_n> is replaced with a string of the form
|
2003-08-19 06:44:58 +00:00
|
|
|
'wuname_resultnum_n' where wuname is the workunit name and resultnum is
|
2002-07-29 19:01:38 +00:00
|
|
|
the ordinal number of the result (0, 1, ...).
|
2002-08-19 18:43:10 +00:00
|
|
|
<li>
|
2002-11-07 19:31:34 +00:00
|
|
|
<UPLOAD_URL> is replaced with the upload URL.
|
2002-05-24 04:29:10 +00:00
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
<hr>
|
|
|
|
<p>
|
2003-01-09 21:48:33 +00:00
|
|
|
The C++ library (backend_lib.C,h) provides the functions:
|
2002-05-24 04:29:10 +00:00
|
|
|
<pre>
|
2003-01-09 21:48:33 +00:00
|
|
|
int read_key_file(char* path, R_RSA_PRIVATE_KEY& key);
|
|
|
|
|
2002-05-24 04:29:10 +00:00
|
|
|
int create_work(
|
2002-11-07 19:31:34 +00:00
|
|
|
WORKUNIT&,
|
2003-01-09 21:48:33 +00:00
|
|
|
char* wu_template, // contents, not path
|
|
|
|
char* result_template_filename, // path
|
2003-08-08 17:35:18 +00:00
|
|
|
int redundancy,
|
2003-01-09 21:48:33 +00:00
|
|
|
char* infile_dir, // where input files are
|
|
|
|
char** infiles, // array of input file names
|
2002-05-24 04:29:10 +00:00
|
|
|
int ninfiles
|
2003-01-09 21:48:33 +00:00
|
|
|
R_RSA_PRIVATE_KEY& key, // upload authentication key
|
2002-11-07 19:31:34 +00:00
|
|
|
char* upload_url,
|
|
|
|
char* download_url
|
2002-05-24 04:29:10 +00:00
|
|
|
);
|
2002-11-07 19:31:34 +00:00
|
|
|
</pre>
|
2002-05-24 04:29:10 +00:00
|
|
|
<p>
|
2003-01-09 21:48:33 +00:00
|
|
|
<b>read_key_file()</b> reads a private key from a file.
|
|
|
|
Use this to read the file upload authentication key.
|
|
|
|
<p>
|
|
|
|
<b>create_work()</b>
|
|
|
|
creates a workunit and one or more results.
|
2002-11-07 19:31:34 +00:00
|
|
|
The arguments are similar to those of the utility program;
|
2003-01-09 21:48:33 +00:00
|
|
|
some of the information is passed in the WORKUNIT structure,
|
|
|
|
namely the following fields:
|
|
|
|
<pre>
|
|
|
|
name
|
2003-01-14 23:50:33 +00:00
|
|
|
appid
|
|
|
|
batch
|
2003-01-09 21:48:33 +00:00
|
|
|
rsc_fpops
|
|
|
|
rsc_iops
|
|
|
|
rsc_memory
|
|
|
|
rsc_disk
|
|
|
|
delay_bound
|
|
|
|
</pre>
|
2003-01-14 23:50:33 +00:00
|
|
|
All other fields should be zeroed.
|
2003-08-19 06:44:58 +00:00
|
|
|
";
|
|
|
|
page_tail();
|
|
|
|
?>
|