Justin,<br><br>I didn't know about this bug. Thanks for the simply code that shows it. Can you file a bug report for this as a reminder for me to look at this:<br><br><a href="https://bugs.launchpad.net/ipython">https://bugs.launchpad.net/ipython</a><br>
<br>Cheers,<br><br>Brian<br><br><div class="gmail_quote">On Thu, Feb 4, 2010 at 12:46 PM, Justin MacCallum <span dir="ltr"><<a href="mailto:justin.maccallum@me.com">justin.maccallum@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have a parallel scientific code that runs on clusters. It currently uses my own (badly designed) parallel communication engine and I'm trying to transition to iPython's TaskClient interface. One part of my code uses the subprocess module to wrap a call to a different piece of software. Unfortunately, this seems to be causing problems for me. I'm running on OS X 10.6.2, with python 2.6.4 and ipython 0.10 as supplied by MacPorts. The following code snippet will reproduce the problem I'm having.<br>
<br>
-----<br>
#!/usr/bin/env python<br>
<br>
from IPython.kernel import client<br>
<br>
tc = client.TaskClient()<br>
<br>
@tc.parallel()<br>
def remote_test(input):<br>
import subprocess<br>
# I'm obviously not wrapping ls, but I have the same problem with the real binary I'm trying to call<br>
subprocess.check_call('ls')<br>
return input<br>
<br>
work = range(100)<br>
<br>
results = remote_test(work)<br>
-----<br>
<br>
<br>
The output of this program is:<br>
<br>
-----<br>
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-i386.egg/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead<br>
import sha<br>
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/clientconnector.py:43: DeprecationWarning: Importing class Tub directly from 'foolscap' is deprecated since Foolscap 0.4.3. Please import foolscap.api.Tub instead<br>
self.tub = Tub()<br>
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/taskfc.py:79: DeprecationWarning: Importing class Referenceable1 directly from 'foolscap' is deprecated since Foolscap 0.4.3. Please import foolscap.api.Referenceable instead<br>
class FCTaskControllerFromTaskController(Referenceable):<br>
Traceback (most recent call last):<br>
File "./test.py", line 15, in <module><br>
results = remote_test(work)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/parallelfunction.py", line 104, in call_function<br>
return self.mapper.map(self.func, *sequences)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/mapper.py", line 230, in map<br>
task_results = [self.task_controller.get_task_result(tid) for tid in task_ids]<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/taskclient.py", line 93, in get_task_result<br>
taskid, block)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/twistedutil.py", line 72, in blockingCallFromThread<br>
return twisted.internet.threads.blockingCallFromThread(reactor, f, *a, **kw)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-i386.egg/twisted/internet/threads.py", line 114, in blockingCallFromThread<br>
result.raiseException()<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-i386.egg/twisted/python/failure.py", line 326, in raiseException<br>
raise self.type, self.value, self.tb<br>
OSError: [Errno 4] Interrupted system call<br>
-----<br>
<br>
<br>
<br>
The ipcontroller log file looks like:<br>
<br>
-----<br>
2010-02-04 12:42:36-0800 [-] Running task 82 on worker 1<br>
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] Task completed: 82<br>
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] distributing Tasks<br>
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] Running task 83 on worker 1<br>
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] Task 83 failed on worker 1<br>
2010-02-04 12:42:36-0800 [-] distributing Tasks<br>
2010-02-04 12:42:36-0800 [-] Running task 84 on worker 0<br>
2010-02-04 12:42:36-0800 [Negotiation,0,192.168.0.194] Task 84 failed on worker 0<br>
2010-02-04 12:42:37-0800 [-] distributing Tasks<br>
2010-02-04 12:42:37-0800 [-] Running task 85 on worker 1<br>
2010-02-04 12:42:37-0800 [Negotiation,2,192.168.0.194] Task 85 failed on worker 1<br>
2010-02-04 12:42:37-0800 [-] distributing Tasks<br>
2010-02-04 12:42:37-0800 [-] Running task 86 on worker 0<br>
2010-02-04 12:42:37-0800 [Negotiation,0,192.168.0.194] Task 86 failed on worker 0<br>
2010-02-04 12:42:38-0800 [-] distributing Tasks<br>
2010-02-04 12:42:38-0800 [-] Running task 87 on worker 1<br>
-----<br>
<br>
Notice that a few of the tasks actually complete, while the majority fail with the strange interrupted system call error.<br>
<br>
I'd appreciate any help anyone can offer.<br>
<br>
Thanks,<br>
Justin<br>
<br>
-----<br>
Justin MacCallum<br>
Post Doctoral Fellow<br>
University of California San Francisco<br>
<br>
_______________________________________________<br>
IPython-user mailing list<br>
<a href="mailto:IPython-user@scipy.org">IPython-user@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
</blockquote></div><br>