Friday, June 15, 2007

批量执行任务 batch jobs


It is based on a format used all over the place in Mac OS X, called the 'plist' format.

The format is very picky on commas, semi-columns and brackets, but if you are careful, you should be able to easily modify it and expand it. The example above shows how you would write a batch file for one job with just 2 tasks. For both tasks, this will result in the execution of the command

/Users/Shared/fasta-tutorial/fasta

with the following 3 arguments for the first task (and similar for the second task)

-q
/Users/Shared/fasta-tutorial/magic-worm-gene.seq
/Users/Shared/fasta-tutorial/chromosomeX.fa

Submitting the batch format

Save the specification file and save it to the Desktop. Then,
xgrid -h localhost -job batch ~/Desktop/fasta-job.txt

取回结果:

xgrid -h localhost -job results -id 6752 -out ~/result_files/

A very useful trick is to use xgrid itself to generate examples of well-formed plist files. Here is for instance what you could do in the Terminal:

xgrid -h localhost -job submit /usr/bin/cal 10 2005
{jobIdentifier = 412; }
xgrid -h localhost -job specification -id 412 > ~/Desktop/xgrid-cal-job.xml
Now, you have a fresh new file on your Desktop called 'xgrid-cal-job.xml', perfectly formatted and ready to be tweaked for your own purposes. In fact, the specification of any job submitted to Xgrid can be retrieved back this way