def __init__(self, workflow_spec, deserializing=False, **kwargs):
assert workflow_spec is not None<EOL>LOG.debug("<STR_LIT>" % self.__str__())<EOL>self.spec = workflow_spec<EOL>self.data = {}<EOL>self.outer_workflow = kwargs.get('<STR_LIT>', self)<EOL>self.locks = {}<EOL>self.last_task = None<EOL>if deserializing:<EOL><INDENT>assert '<STR_LIT>' in workflow_spec.task_specs<EOL>root = workflow_spec.task_specs['<STR_LIT>']  <EOL><DEDENT>else:<EOL><INDENT>if '<STR_LIT>' in workflow_spec.task_specs:<EOL><INDENT>root = workflow_spec.task_specs['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>root = specs.Simple(workflow_spec, '<STR_LIT>')<EOL><DEDENT><DEDENT>self.task_tree = Task(self, root)<EOL>self.success = True<EOL>self.debug = False<EOL>self.completed_event = Event()<EOL>self.task_tree.state = Task.COMPLETED<EOL>start = self.task_tree._add_child(self.spec.start, state=Task.FUTURE)<EOL>self.spec.start._predict(start)<EOL>if '<STR_LIT>' not in kwargs:<EOL><INDENT>start.task_spec._update(start)<EOL><DEDENT>
Constructor.

:type workflow_spec: specs.WorkflowSpec
:param workflow_spec: The workflow specification.
:type deserializing: bool
:param deserializing: set to true when deserializing to avoid
  generating tasks twice (and associated problems with multiple
  hierarchies of tasks)