def start_input(self): """Get start input as a python object. This method iterates over the event history to find the WorkflowExecutionStarted event and unserializes its input attribute. The result is cached. """ if not hasattr(self, '_start_input'): started_event = self.most_recent('WorkflowExecutionStarted') input_attr = started_event.attrs['input'] self._start_input = serializing.loads(input_attr) return self._start_input
def __init__(self, result, caller): """ :param result: Result structure from the API. :param domain: A domain instance (optional). Needed for responses. """ self._caller = caller self._domain = caller._domain self.activity_id = result['activityId'] self.activity_type = ActivityType(result['activityType']) self.input = serializing.loads(result['input']) self.started_event_id = result['startedEventId'] self.task_token = result['taskToken'] self.workflow_execution = WorkflowExecution( result['workflowExecution'], self)
def attrs(result): """Get event attributes. :param result: An event structure returned from the API. :returns: The attributes dict. """ event_type = result['eventType'] attributes_key = _attr_key_lookup[event_type] ev_attrs = result[attributes_key] for key in _auto_unserialize_attrs.get(event_type, []): value = ev_attrs[key] try: ev_attrs[key] = serializing.loads(value) except TypeError: pass return ev_attrs