[IPython-user] Parallel w/ scikits.timeseries dates

Robert Ferrell ferrell@diablotech....
Wed Dec 9 16:33:24 CST 2009


I want to do a task parallel computation for each date in a  
timeseries.DateArray.  My naive attempt produces:

	PicklingError: Can't pickle <type 'timeseries.Date'>: import of  
module timeseries failed

Should I take this at face value?  I know pickling of timeseries.Date  
objects doesn't work, so should I transform the dates into strings?   
(This is my first foray into IPython's parallel world.)

thanks,
-robert

Here are the details:

Bear$ ipython
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import scikits.timeseries as ts

In [2]: import IPython

In [3]: from IPython.kernel import client
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/ 
python/twisted/python/filepath.py:12: DeprecationWarning: the sha  
module is deprecated; use the hashlib module instead
   import sha
/Library/Python/2.6/site-packages/foolscap-0.4.2-py2.6.egg/foolscap/ 
banana.py:2: DeprecationWarning: the sets module is deprecated

In [4]: tc = client.TaskClient()

In [5]: dA = ts.date_array(start_date='2009-01-01', length=10)

In [6]: @tc.parallel()
    ...: def parD(dt):
    ...:     return dt
    ...:

In [7]: parD(dA)
---------------------------------------------------------------------------
PicklingError                             Traceback (most recent call  
last)

/Users/Shared/Develop/Financial/Lakshmi/<ipython console> in <module>()

/Library/Python/2.6/site-packages/IPython/kernel/parallelfunction.pyc  
in call_function(*sequences)
     102         self.func = func
     103         def call_function(*sequences):
--> 104             return self.mapper.map(self.func, *sequences)
     105         return call_function
     106

/Library/Python/2.6/site-packages/IPython/kernel/mapper.pyc in  
map(self, func, *sequences)
     225                 clear_after=self.clear_after,  
retries=self.retries,
     226                 recovery_task=self.recovery_task,  
depend=self.depend)
--> 227             task_ids.append(self.task_controller.run(task))
     228         if self.block:
     229             self.task_controller.barrier(task_ids)

/Library/Python/2.6/site-packages/IPython/kernel/taskclient.pyc in  
run(self, task, block)
      72             `get_task_result` to get the `TaskResult` object.
      73         """
---> 74         tid = blockingCallFromThread(self.task_controller.run,  
task)
      75         if block:
      76             return self.get_task_result(tid, block=True)

/Library/Python/2.6/site-packages/IPython/kernel/twistedutil.pyc in  
blockingCallFromThread(f, *a, **kw)
      70         @raise: any error raised during the callback chain.
      71         """
---> 72         return  
twisted.internet.threads.blockingCallFromThread(reactor, f, *a, **kw)
      73
      74 else:

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/ 
python/twisted/internet/threads.pyc in blockingCallFromThread(reactor,  
f, *a, **kw)
     112     result = queue.get()
     113     if isinstance(result, failure.Failure):
--> 114         result.raiseException()
     115     return result
     116

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/ 
python/twisted/python/failure.pyc in raiseException(self)
     324         information if available.
     325         """
--> 326         raise self.type, self.value, self.tb
     327
     328

PicklingError: Can't pickle <type 'timeseries.Date'>: import of module  
timeseries failed

In [8]:



More information about the IPython-user mailing list