2002-11-07 19:31:34 +00:00
|
|
|
<title>Generating work</title>
|
2002-08-20 23:54:17 +00:00
|
|
|
<body bgcolor=ffffff>
|
2002-11-07 19:31:34 +00:00
|
|
|
<h2>Generating work</h2>
|
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
|
|
|
|
-nresults n // # of results to create
|
|
|
|
-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>
|
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
|
2002-07-29 19:01:38 +00:00
|
|
|
"wuname_resultnum_n" where wuname is the workunit name and resultnum is
|
|
|
|
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
|
2002-05-24 04:29:10 +00:00
|
|
|
int nresults,
|
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
|
|
|
|
rsc_fpops
|
|
|
|
rsc_iops
|
|
|
|
rsc_memory
|
|
|
|
rsc_disk
|
|
|
|
delay_bound
|
|
|
|
</pre>
|