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): ...@@ -660,6 +660,10 @@ class ActivityTool (Folder, UniqueObject):
for activity in activity_dict.itervalues(): for activity in activity_dict.itervalues():
activity.initialize(self, clear=False) activity.initialize(self, clear=False)
def _callSafeFunction(self, batch_function):
result = batch_function()
return ActiveResult(result=result)
security.declareProtected(Permissions.manage_properties, 'isSubscribed') security.declareProtected(Permissions.manage_properties, 'isSubscribed')
def isSubscribed(self): def isSubscribed(self):
""" """
......
...@@ -99,7 +99,7 @@ else: ...@@ -99,7 +99,7 @@ else:
if not resultDict.has_key(sig): if not resultDict.has_key(sig):
joblib_result = portal_activities.activate(activity='SQLJoblib', joblib_result = portal_activities.activate(activity='SQLJoblib',
tag="joblib_%s" % active_process_id, 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: if joblib_result is None:
joblib_result = CMFActivityResult(self.active_process, sig, callback) joblib_result = CMFActivityResult(self.active_process, sig, callback)
return joblib_result return joblib_result
...@@ -108,8 +108,6 @@ else: ...@@ -108,8 +108,6 @@ else:
"""Reconfigure the backend and return the number of workers. This """Reconfigure the backend and return the number of workers. This
makes it possible to reuse an existing backend instance for successive makes it possible to reuse an existing backend instance for successive
independent calls to Parallel with different parameters.""" 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: if n_jobs == 1:
raise FallbackToBackend(SequentialBackend()) 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