2004-06-09 19:09:16 +00:00
|
|
|
<?php
|
2003-08-19 06:44:58 +00:00
|
|
|
require_once("docutil.php");
|
|
|
|
page_head("Generating work");
|
|
|
|
echo "
|
2004-02-15 19:22:01 +00:00
|
|
|
Workunits and results can be created using either a utility program
|
|
|
|
or a C++ function.
|
2002-05-24 04:29:10 +00:00
|
|
|
<p>
|
2004-02-09 05:11:05 +00:00
|
|
|
Workunits and results are described by <b>template files</b>,
|
2004-02-15 19:22:01 +00:00
|
|
|
with placeholders for their input and output files.
|
|
|
|
|
|
|
|
<h3>Workunit template files</h3>
|
2002-05-24 04:29:10 +00:00
|
|
|
<p>
|
2004-02-09 05:11:05 +00:00
|
|
|
A WU template file has the form
|
|
|
|
<pre>",htmlspecialchars("
|
2004-02-15 19:22:01 +00:00
|
|
|
<file_info>
|
|
|
|
<number>0</number>
|
2004-04-13 23:55:05 +00:00
|
|
|
[ <sticky/>, other attributes]
|
2004-02-15 19:22:01 +00:00
|
|
|
</file_info>
|
2003-08-15 22:19:25 +00:00
|
|
|
[ ... ]
|
2004-02-09 05:11:05 +00:00
|
|
|
<workunit>
|
2004-02-15 19:22:01 +00:00
|
|
|
<file_ref>
|
2004-04-13 23:55:05 +00:00
|
|
|
<file_number>0</file_number>
|
2004-02-15 19:22:01 +00:00
|
|
|
<open_name>NAME</open_name>
|
|
|
|
</file_ref>
|
|
|
|
[ ... ]
|
2004-02-09 05:11:05 +00:00
|
|
|
[ <command_line>-flags xyz</command_line> ]
|
2004-04-13 23:55:05 +00:00
|
|
|
[ <rsc_fpops_est>x</rsc_fpops_est> ]
|
|
|
|
[ <rsc_fpops_bound>x</rsc_fpops_bound> ]
|
|
|
|
[ <rsc_memory_bound>x</rsc_memory_bounds> ]
|
|
|
|
[ <rsc_disk_bound>x</rsc_disk_bounds> ]
|
|
|
|
[ <delay_bound>x</delay_bound> ]
|
|
|
|
[ <min_quorum>x</min_quorum> ]
|
|
|
|
[ <target_nresults>x</target_nresults> ]
|
|
|
|
[ <max_error_results>x</max_error_results> ]
|
|
|
|
[ <max_total_results>x</max_total_results> ]
|
2004-02-09 05:11:05 +00:00
|
|
|
</workunit>
|
|
|
|
"), "
|
2003-08-15 22:19:25 +00:00
|
|
|
</pre>
|
|
|
|
The components are:
|
2004-02-09 05:11:05 +00:00
|
|
|
";
|
|
|
|
list_start();
|
2004-02-15 19:22:01 +00:00
|
|
|
list_item(htmlspecialchars("<file_info>, <file_ref>"),
|
2004-04-13 23:55:05 +00:00
|
|
|
"Each pair describes an <a href=files.php>input file</a>");
|
2004-02-09 05:11:05 +00:00
|
|
|
list_item(htmlspecialchars("<command_line>"),
|
|
|
|
"The command-line arguments to be passed to the main program.");
|
2004-04-13 23:55:05 +00:00
|
|
|
list_item("Other elements",
|
|
|
|
"<a href=work.php>Work unit attributes</a>"
|
|
|
|
);
|
2004-02-09 05:11:05 +00:00
|
|
|
list_end();
|
|
|
|
echo"
|
|
|
|
When a workunit is created, the 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-08-19 18:43:10 +00:00
|
|
|
<li>
|
2002-12-12 01:07:24 +00:00
|
|
|
Within a <file_ref> element,
|
2004-04-13 23:55:05 +00:00
|
|
|
<file_number>x</file_number> is replaced with an element
|
|
|
|
giving the filename.
|
2002-05-24 04:29:10 +00:00
|
|
|
</ul>
|
2004-02-15 19:22:01 +00:00
|
|
|
<h3>Result template files</h3>
|
|
|
|
<p>
|
|
|
|
A result template file has the form
|
|
|
|
<pre>", htmlspecialchars("
|
|
|
|
<file_info>
|
|
|
|
<name><OUTFILE_0/></name>
|
|
|
|
<generated_locally/>
|
|
|
|
<upload_when_present/>
|
|
|
|
<max_nbytes>32768</max_nbytes>
|
|
|
|
<url><UPLOAD_URL/></url>
|
|
|
|
</file_info>
|
|
|
|
<result>
|
|
|
|
<file_ref>
|
|
|
|
<file_name><OUTFILE_0/></file_name>
|
|
|
|
<open_name>result.sah</open_name>
|
|
|
|
</file_ref>
|
|
|
|
</result>
|
|
|
|
"), "</pre>
|
2002-05-24 04:29:10 +00:00
|
|
|
<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>
|
2004-04-13 21:31:55 +00:00
|
|
|
<a name=cmdline>
|
2004-02-09 05:11:05 +00:00
|
|
|
<h3>Command-line interface</h3>
|
|
|
|
<p>
|
|
|
|
The utility program is
|
|
|
|
<pre>
|
|
|
|
create_work
|
2004-07-10 07:27:00 +00:00
|
|
|
-appname name // application name
|
|
|
|
-wu_name name // workunit name
|
|
|
|
-wu_template filename // WU template filename
|
|
|
|
// relative to project root
|
|
|
|
-result_template filename // result template filename
|
|
|
|
// relative to project root
|
2004-04-13 23:55:05 +00:00
|
|
|
|
|
|
|
// The following are normally supplied in the WU template:
|
2004-02-15 19:22:01 +00:00
|
|
|
[ -rsc_fpops_est x ]
|
|
|
|
[ -rsc_fpops_bound x ]
|
|
|
|
[ -rsc_memory_bound x ]
|
|
|
|
[ -rsc_disk_bound x ]
|
|
|
|
[ -delay_bound x ]
|
|
|
|
[ -min_quorum x ]
|
|
|
|
[ -target_nresults x ]
|
|
|
|
[ -max_error_results x ]
|
|
|
|
[ -max_total_results x ]
|
|
|
|
[ -max_success_results x ]
|
2004-04-13 23:55:05 +00:00
|
|
|
|
2004-02-09 05:11:05 +00:00
|
|
|
infile_1 ... infile_m // input files
|
|
|
|
</pre>
|
2004-02-15 19:22:01 +00:00
|
|
|
The workunit parameters are documented <a href=work.php>here</a>.
|
2004-07-10 07:27:00 +00:00
|
|
|
The program must be run in the project root directory;
|
|
|
|
it looks for <b>config.xml</b> there, and uses its contents.
|
2004-02-15 19:22:01 +00:00
|
|
|
|
2004-02-09 05:11:05 +00:00
|
|
|
<h3>C++ function interface</h3>
|
2002-05-24 04:29:10 +00:00
|
|
|
<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(
|
2004-07-10 07:27:00 +00:00
|
|
|
DB_WORKUNIT&,
|
|
|
|
const char* wu_template, // contents, not path
|
|
|
|
const char* result_template_filename, // relative to project root
|
|
|
|
const char* result_template_filepath, // absolute,
|
|
|
|
// or relative to current dir
|
|
|
|
const char* infile_dir, // where input files are
|
|
|
|
const 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
|
2004-07-10 07:27:00 +00:00
|
|
|
const char* upload_url,
|
|
|
|
const 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.
|
2004-04-13 21:31:55 +00:00
|
|
|
|
2004-04-13 23:55:05 +00:00
|
|
|
<hr>
|
2004-04-13 21:31:55 +00:00
|
|
|
<a name=make_work>
|
|
|
|
<h3>Make_work</h3>
|
|
|
|
<p>
|
2004-04-13 23:55:05 +00:00
|
|
|
The daemon program
|
2004-04-13 21:31:55 +00:00
|
|
|
<pre>
|
|
|
|
make_work -wu_name name -cushion N
|
|
|
|
</pre>
|
|
|
|
can be used to create an endless supply of work.
|
|
|
|
It will create copies of the given work unit
|
|
|
|
as needed to maintain a supply of at least N unsent results.
|
2003-08-19 06:44:58 +00:00
|
|
|
";
|
2004-04-13 21:31:55 +00:00
|
|
|
|
2003-08-19 06:44:58 +00:00
|
|
|
page_tail();
|
|
|
|
?>
|