[IPython-dev] async taskclient
ellisonbg.net at gmail.com
Fri Jun 20 10:08:12 EDT 2008
> I have a question about how to use the async task client.
> Given the following code:
> def job_runner(code):
> def submit(task_client, cmd):
> t1 = Task(cmd, clear_before=True, clear_after=True, pull=['a'])
> d = task_client.run(t1)
> d.addCallback(lambda tid:
> task_client.get_task_result(taskid=tid, block=True))
> d = asyncclient.get_task_client()
> d.addCallback(lambda tc: submit(tc, code))
> where code is some python code in a string.
> Is it ok to get a new instance of async task client for every
> job I want to submit?
You can do this but for each new client there will be a new connection
to the controller. Thus it is best for performance reasons to use a
single TaskClient instance for all of your tasks in a sessions.
Is there a reason you want to use a TaskClient for each task?
More information about the IPython-dev