Commit 10465221 authored by Hardik Juneja's avatar Hardik Juneja

CMFActivity: move Base_callSafeFunction from script to a method _callSafeFunction on activity_tool

parent f79085ca
......@@ -660,6 +660,10 @@ class ActivityTool (Folder, UniqueObject):
for activity in activity_dict.itervalues():
activity.initialize(self, clear=False)
def _callSafeFunction(self, batch_function):
result = batch_function()
return ActiveResult(result=result)
security.declareProtected(Permissions.manage_properties, 'isSubscribed')
def isSubscribed(self):
"""
......
......@@ -99,7 +99,7 @@ else:
if not resultDict.has_key(sig):
joblib_result = portal_activities.activate(activity='SQLJoblib',
tag="joblib_%s" % active_process_id,
active_process=self.active_process).Base_callSafeFunction(JoblibSafeFunction(batch))
active_process=self.active_process)._callSafeFunction(JoblibSafeFunction(batch))
if joblib_result is None:
joblib_result = CMFActivityResult(self.active_process, sig, callback)
return joblib_result
......@@ -108,8 +108,6 @@ else:
"""Reconfigure the backend and return the number of workers. This
makes it possible to reuse an existing backend instance for successive
independent calls to Parallel with different parameters."""
LOG("CMFActivityBackend", INFO, 'n_jobs={}'.format(n_jobs))
LOG("CMFActivityBackend", INFO, 'parallel={}'.format(parallel))
if n_jobs == 1:
raise FallbackToBackend(SequentialBackend())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment