A nice script written by Marc Hulsman to submit and monitor jobs in Life Science Grid.
-
Add LFC_HOME and LFC_HOST to your environment. e.g. Add to you .bashrc something like:
export LFC_HOME='/grid/lsgrid/marc/' export LFC_HOST=lfc.grid.sara.nl
-
Run
startGridSession lsgrid. This script will:
- Generate a proxy certificate,
- Store it in the Myproxy server
- Delegate it to the WMS with your user name as the delegation ID (DID).
- install 'cluster_manager' using Enhance (see github.com/mhulsman).
If grid is going to be used, use <enhance_dir>/upload file to upload environment to grid (note: this should be done everytime you update enhance environment):
./upload grid:/<choose_a_name>.dist (e.g. ipengine.dist)-
Adapt load_env_worker.sh
-
If you need extra files, put them in the work directory (<enhance_dir>/sys_enhance/work) and update environment (last paragraph)
-
If you use ipengine_loadenv.jdl, change XXNJOBXX to the number of jobs you want to run
-
To submit jobs use:
glite-wms-job-submit -d <delegation_id> -o <jobid_file> ipengine_loadenv.jdl
-
First, make sure ports are open on that were given during install.
-
Then, go to your python directory from which you run your project:
- cd <your_project>
- <environment_dir>/cluster.py
- start controllers and engines from interface
-
ipython
- start tasks
e.g.:
from IPython.kernel import client #METHOD 1 mec = client.MultiEngineClient() mec['b'] = 2 #sets b in all clients mec.execute("a = b * 2") print mec['a'] #prints for each client: 4 #METHOD 2 tc = client.TaskClient() strtask = """a = b * 2""" b = 1 task = client.StringTask(strtask, ('a',), {'b':2}) task_id = tc.run(task) tres = tc.get_task_result(task_id,block=True) print tres['a'] #prints 2
- start tasks
e.g.:
For sending large files to/from engines, make use of submit / receive functions in cluster_storage.py:
-
Somewhere on grid, do:
id = submit(your_object) #or, with fixed id: id = submit(your_object,"your_id")
-
Somewhere else on grid, do:
object = receive(id) #clean up destroy(id)