[IPython-user] ipython1 and farm tasking
Mon Feb 25 20:44:14 CST 2008
I just started using ipython1 do to distribute job on multiple cpu. I
am having some issue and I am not sure how it works.
I want to pass a function to be run by each task on each client.
In the following code, the function fold_package need to be run on each
packages_list=[ '3114', '3115','3116']
# create a remote controller instance
rc = kernel.RemoteController(('127.0.0.1',10105))
# create task controller instance
tc = kernel.TaskController(('127.0.0.1', 10113))
# commands won't block by default
rc.block = False
# get id of available engine
engines_id = rc.getIDs()
# process the list of packages by dispatching them to different computer
# create the task list
tasks = [kernel.Task("fold_package(%s)"%t) for t in packages_list]
# test task controller
taskIDs = [tc.run(t) for t in tasks]
when I run that code I get:
NameError: name 'fold_package' is not defined
My questions are;
How do you pass a function define in my script to the client engine?
Or Do I have to create a package that will contains my function and
installed it on each client?
Thanks for any advices and answers.
o Alexandre Gillet Ph.D. email: firstname.lastname@example.org
/ The Scripps Research Institute,
o Dept. Molecular Biology, MB-5,
\ 10550 North Torrey Pines Road,
o La Jolla, CA 92037-1000, USA.
/ tel: (858) 784-2053
o fax: (858) 784-2860
More information about the IPython-user