Esempio n. 1
0
 def __init__(self,
              parent,
              name,
              times=None,
              times_attribute=None,
              **kwargs):
     """
     Constructor.
     
     :type  parent: L{SpiffWorkflow.specs.WorkflowSpec}
     :param parent: A reference to the parent (usually a workflow).
     :type  name: string
     :param name: A name for the task.
     :type  times: int or None
     :param times: The number of tasks to create.
     :type  times_attribute: str or None
     :param times_attribute: The name of an attribute that specifies
                             the number of outgoing tasks.
     :type  kwargs: dict
     :param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
     """
     if not times_attribute and not times:
         raise ValueError('require times or times_attribute argument')
     TaskSpec.__init__(self, parent, name, **kwargs)
     self.times_attribute = times_attribute
     self.times = times
     self.thread_starter = ThreadStart(parent, **kwargs)
     self.outputs.append(self.thread_starter)
     self.thread_starter._connect_notify(self)
Esempio n. 2
0
 def __init__(self,
              parent,
              name,
              times=None,
              times_attribute=None,
              suppress_threadstart_creation=False,
              **kwargs):
     """
     Constructor.
     
     :type  parent: L{SpiffWorkflow.specs.WorkflowSpec}
     :param parent: A reference to the parent (usually a workflow).
     :type  name: string
     :param name: A name for the task.
     :type  times: int or None
     :param times: The number of tasks to create.
     :type  times_attribute: str or None
     :param times_attribute: The name of a data field that specifies
                             the number of outgoing tasks.
     :type  suppress_threadstart_creation: bool
     :param suppress_threadstart_creation: Don't create a ThreadStart, because
                                           the deserializer is about to.
     :type  kwargs: dict
     :param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
     """
     if not times_attribute and not times:
         raise ValueError('require times or times_attribute argument')
     TaskSpec.__init__(self, parent, name, **kwargs)
     self.times_attribute = times_attribute
     self.times = times
     if not suppress_threadstart_creation:
         self.thread_starter = ThreadStart(parent, **kwargs)
         self.outputs.append(self.thread_starter)
         self.thread_starter._connect_notify(self)
     else:
         self.thread_starter = None
 def _deserialize_thread_start(self, wf_spec, s_state):
     # specs/__init__.py deliberately hides this: forcibly import it
     from SpiffWorkflow.specs.ThreadStart import ThreadStart
     spec = ThreadStart(wf_spec)
     self._deserialize_task_spec(wf_spec, s_state, spec=spec)
     return spec