Пример #1
0
    def really_start(*args, **kwargs):
        """Use this function to start a workflow by passing in the args."""
        swf = swf_client if swf_client is not None else SWFClient()
        l_wid = wid  # closure hack
        if l_wid is None:
            l_wid = uuid.uuid4()
        if serialize_input is None:
            input_data = Proxy.serialize_input(*args, **kwargs)
        else:
            input_data = serialize_input(*args, **kwargs)
        if len(input_data) > INPUT_SIZE:
            logger.error(
                "Input too large: %s/%s" % (len(input_data), INPUT_SIZE))
            raise ValueError('Input too large.')
        try:
            r = swf.start_workflow_execution(
                domain, l_wid, name, version, input=input_data,
                priority=priority, task_list=task_list,
                execution_start_to_close_timeout=task_duration,
                task_start_to_close_timeout=workflow_duration,
                child_policy=child_policy, tags=tags, lambda_role=lambda_role)
        except ClientError as e:
            logger.exception('Error while starting the workflow:')
            raise e

        return r['runId']
Пример #2
0
 def really_start(*args, **kwargs):
     """Use this function to start a workflow by passing in the args."""
     l1 = layer1 if layer1 is not None else Layer1()
     l_wid = wid  # closue hack
     if l_wid is None:
         l_wid = uuid.uuid4()
     if serialize_input is None:
         input_data = Proxy.serialize_input(*args, **kwargs)
     else:
         input_data = serialize_input(*args, **kwargs)
     if len(input_data) > INPUT_SIZE:
         logger.error("Input too large: %s/%s" % (len(input_data), INPUT_SIZE))
         raise ValueError('Input too large.')
     try:
         r = l1.start_workflow_execution(
             str(domain), str(l_wid), str(name), str(version),
             task_list=str_or_none(task_list),
             execution_start_to_close_timeout=str_or_none(workflow_duration),
             task_start_to_close_timeout=str_or_none(decision_duration),
             input=str(input_data),
             child_policy=cp_encode(child_policy),
             tag_list=tags_encode(tags))
     except SWFResponseError:
         logger.exception('Error while starting the workflow:')
         raise RuntimeError('Cannot start the workflow.')
     return r['runId']
Пример #3
0
 def run(self, *args, **kwargs):
     wait = kwargs.pop('_wait', False)
     tracer = None
     if kwargs.pop('_trace', False):
         tracer = ExecutionTracer()
     a_executor = self.executor(max_workers=self.activity_workers)
     w_executor = self.executor(max_workers=self.workflow_workers)
     input_data = Proxy.serialize_input(*args, **kwargs)
     wr = RootWorkflowRunner(self, w_executor, a_executor, input_data,
                             tracer=tracer)
     return wr.run(wait=wait)
Пример #4
0
 def run(self, *args, **kwargs):
     wait = kwargs.pop('_wait', False)
     tracer = None
     if kwargs.pop('_trace', False):
         tracer = ExecutionTracer()
     a_executor = self.executor(max_workers=self.activity_workers)
     w_executor = self.executor(max_workers=self.workflow_workers)
     input_data = Proxy.serialize_input(*args, **kwargs)
     wr = RootWorkflowRunner(self,
                             w_executor,
                             a_executor,
                             input_data,
                             tracer=tracer)
     return wr.run(wait=wait)
Пример #5
0
 def __call__(self, decision, execution_history, rate_limit):
     """Instantiate Proxy."""
     task_exec_hist = SWFTaskExecutionHistory(execution_history, self.identity)
     task_decision = SWFWorkflowTaskDecision(decision, execution_history, self, rate_limit)
     return Proxy(task_exec_hist, task_decision, self.retry,
                  self.serialize_input, self.deserialize_result)
Пример #6
0
 def __call__(self, decision, history, tracer):
     th = TaskHistory(history, self.identity)
     wd = WorkflowDecision(decision, self.identity, self.f)
     if tracer is None:
         return Proxy(th, wd)
     return TracingProxy(tracer, self.identity, th, wd)
Пример #7
0
 def __call__(self, decision, history, tracer):
     th = TaskHistory(history, self.identity)
     ad = ActivityDecision(decision, self.identity, self.f)
     if tracer is None:
         return Proxy(th, ad)
     return TracingProxy(tracer, self.identity, th, ad)