~ubuntu-branches/ubuntu/vivid/cctools/vivid

« back to all changes in this revision

Viewing changes to doc/workqueue.html

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2012-03-30 12:40:01 UTC
  • mfrom: (9.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120330124001-ze0lhxm5uwq2e3mo
Tags: 3.4.2-2
Added patch to handle a missing CFLAGS variable in Python's sysconfig
report (Closes: #661658).

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
as a starting point.  Here is a basic outline for a Work Queue master:
129
129
 
130
130
<pre>
131
 
q = work_queue_create(port,time);
 
131
q = work_queue_create(port);
132
132
 
133
133
    for(all tasks) {
134
134
         t = work_queue_task_create(command);
146
146
 
147
147
First create a queue that is listening on a particular TCP port:
148
148
<pre>
149
 
q = work_queue_create( port , time(0)+60 ); 
 
149
q = work_queue_create(port);
150
150
</pre>
151
151
 
152
152
The master then creates tasks to submit to the queue.
154
154
what data is needed, and what data will be produced by the command.
155
155
Input data can be provided in the form of a file or a local memory buffer.
156
156
Output data can be provided in the form of a file or the standard output of the program.
157
 
In the example, we specify a command that takes a single input file
158
 
and produces a single output file:
159
 
<pre>
160
 
t = work_queue_task_create("/usr/bin/gzip -9 < infile > outfile.gz");
161
 
work_queue_task_specify_input_file(t,"infile","infile");
162
 
work_queue_task_specify_output_file(t,"outfile.gz","outfile.gz");
 
157
It is also required to specify whether the data, input or output, need to be cached at
 
158
the worker site for later use. In the example, we specify a command that takes a 
 
159
single input file, produces a single output file, and requires both files to be
 
160
cached:
 
161
<pre>
 
162
t = work_queue_task_create("/usr/bin/gzip < infile > outfile.gz");
 
163
work_queue_task_specify_file(t,"infile","infile",WORK_QUEUE_INPUT,WORK_QUEUE_CACHE);
 
164
work_queue_task_specify_file(t,"outfile.gz","outfile.gz",WORK_QUEUE_OUTPUT,WORK_QUEUE_CACHE);
 
165
</pre>
 
166
 
 
167
If a file does not need to be cached at the execution site to avoid wasteful
 
168
strorage, it can be specified so:
 
169
<pre>
 
170
work_queue_task_specify_file(t,"outfile.gz","outfile.gz",WORK_QUEUE_OUTPUT,WORK_QUEUE_NOCACHE);
163
171
</pre>
164
172
 
165
173
You can also run a program that is not necessarily installed at the
168
176
and the plain remote path.  For example:
169
177
<pre>
170
178
t = work_queue_task_create("./my_compress_program < infile > outfile.gz");
171
 
work_queue_task_specify_input_file(t,"/usr/local/bin/my_compress_program","my_compress_program");
172
 
work_queue_task_specify_input_file(t,"infile","infile");
173
 
work_queue_task_specify_output_file(t,"outfile.gz","outfile.gz");
 
179
work_queue_task_specify_file(t,"/usr/local/bin/my_compress_program","my_compress_program",WORK_QUEUE_INPUT,WORK_QUEUE_CACHE);
 
180
work_queue_task_specify_file(t,"infile","infile",WORK_QUEUE_INPUT,WORK_QUEUE_CACHE);
 
181
work_queue_task_specify_file(t,"outfile.gz","outfile.gz",WORK_QUEUE_OUTPUT,WORK_QUEUE_CACHE);
174
182
</pre>
175
183
 
176
184
Once a task has been fully specified, it can be submitted to the queue:
228
236
to create local input files for each one.  If the master already has the necessary input
229
237
data in memory, it can pass the data directly to the remote task with <tt>work_queue_task_specify_input_buf</tt>.
230
238
<p>
 
239
<li><b>Environment Variables.</b>  If you have workers distributed across
 
240
multiple operating systems (such as Linux, Cygwin, Solaris) and/or architectures (such
 
241
as i686, x86_64) and have files specific to each of these systems, this feature 
 
242
will help. The variables $OS and $ARCH are available for use in the specification of input
 
243
file names. Work Queue will automatically resolve these variables to the operating system
 
244
and architecture of each connected worker and transfer the input file corresponding
 
245
to the resolved file name. For example:
 
246
<pre>
 
247
work_queue_task_specify_file(t,"infile.$OS.$ARCH","infile",WORK_QUEUE_INPUT,WORK_QUEUE_CACHE)
 
248
</pre>
 
249
This will transfer infile.Linux.x86_64 to workers running on a Linux system with an
 
250
x86_64 architecture and infile.Cygwin.i686 to workers on Cygwin with an i686
 
251
architecture. 
 
252
<p>
231
253
<li><b>Statistics.</b>  The queue tracks a fair number of statistics that count the number
232
254
of tasks, number of workers, number of failures, and so forth.  Obtain this data with <tt>work_queue_get_stats</tt>
233
255
in order to make a progress bar or other user-visible information.