workunit represents the inputs to a computation. The steps in creating a workunit are:
During the testing phase of a project, you can use the make_work daemon to replicate a given workunit as needed to maintain a constant supply of work. This is useful while testing and debugging the application.
A workunit template file has the form
",htmlspecialchars("The components are: "; list_start(); list_item(htmlspecialchars("[ ... ] 0 [, other attributes] "), " [ ... ] [ 0 NAME -flags xyz ] [x ] [x ] [x ] [x ] [x ] [x ] [x ] [x ] [x ] [x ]
A result template file has the form
", htmlspecialchars("32768 "), " result.sah
The result file template is macro-substituted as follows:
dir_hier_path( const char* filename, const char* root, // root of download directory int fanout, // from config.xml bool new_hash, // use true here char* result // path of file in hierarchy );If you're using scripts, you can invoke the program
dir_hier_path filenameIt prints the full pathname. Run this in the project's root directory. For example:
cp test_workunits/12ja04aa `bin/dir_hier_path 12ja04aa`copies an input file from the test_workunits directory to the download directory hierarchy.
Workunits can be created using either a script
(using the create_work
program)
or a program (using the create_work()
function).
The input files must already be in the download hierarchy.
The utility program is
create_work -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 [ -batch n ] [ -priority n ] // The following are normally supplied in the WU template: [ -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 ] infile_1 ... infile_m // input filesThe workunit parameters are documented here. The program must be run in the project root directory.
The C++ library (crypt.C, backend_lib.C,h) provides the functions:
int read_key_file(char* path, R_RSA_PRIVATE_KEY& key); int create_work( 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 int ninfiles R_RSA_PRIVATE_KEY& key, // upload authentication key SCHED_CONFIG& );
read_key_file() reads a private key from a file. Use this to read the file upload authentication key.
create_work() creates a workunit and one or more results. The arguments are similar to those of the utility program; some of the information is passed in the WORKUNIT structure, namely the following fields:
name appid batch rsc_fpops rsc_iops rsc_memory rsc_disk delay_boundAll other fields should be zeroed. "; page_tail(); ?>