Q) How to check that execution of a task has been completed?A) Task object, returned by
submit call, has an argument
finished which indicates status of the task:
task = job_server.submit(f1, (a,b,c))
if task.finished:
print "The task is done!"
else
print "Still working on it ..."
Q) I would like to perform an action at the time of completion for each individual task. Is it possible?A) Yes, you need to setup
callback argument of
submit method, see
PP callback example
Q) Is it possible to use Psyco with PP?A) Yes it is definitely possible.
This post explains how to incorporate Psyco in PP.
Q) I do not want to run any tasks on my local computer. How do I do that?A)
ncpus argument of the
pp.Server specifies the number of local ppworkers to use. If you do not specify this argument PP uses the numbers of ppworkers equal to the number of effective processors on your local host. If you set it to 0, three will be no local execution of tasks.
Q) How can I use pp.Template class in my program?A) The purpose of Template class is to simplify submission of similar pp-tasks, which execute the same function with different arguments. There are two steps in using the Template class.
1) Creating a template which glues together a function with its dependencies and given instance of pp.Server:
fn = pp.Template(job_server, sum_primes, (isprime,), ("math",))2) Using the template to submit jobs with different arguments:
job1 = fn.submit(100)
job2 = fn.submit(200)
Please look at the following
example for further clarification.
Q) How to use PP on a PBS cluster?A) PP can be used with PBS with or without autodiscovery.
Without autodiscovery you simply need to start ppserver.py on all nodes assigned to a job and then add all of them to a ppserver variable in the client Python application.
With autodiscovery you need to run ppserver.py with -a switch (./ppserver.py -a ) and then set ppservers = ("*",) in the client application.
In both cases it is useful to use
-t switch to automatically kill all ppservers when client exits.
(to be continued)
Please feel free to suggest question and answers for this FAQ in replies to the post.