def _broadcast_state(self, state, target_state, transaction_state): project_config = self._project.get_config() states = [] for party in project_config.participants: client = RpcClient(project_config, party) resp = client.update_workflow_state(self._workflow.name, state, target_state, transaction_state) if resp.status.code == common_pb2.STATUS_SUCCESS: states.append(TransactionState(resp.transaction_state)) else: states.append(None) return states
def _broadcast_state(self, state, target_state, transaction_state): project_config = self._project.get_config() states = [] for party in project_config.participants: client = RpcClient(project_config, party) forked_from_uuid = Workflow.query.filter_by( id=self._workflow.forked_from).first( ).uuid if self._workflow.forked_from else None resp = client.update_workflow_state( self._workflow.name, state, target_state, transaction_state, self._workflow.uuid, forked_from_uuid, self._workflow.extra) if resp.status.code == common_pb2.STATUS_SUCCESS: if resp.state == WorkflowState.INVALID: self._workflow.invalidate() self._reload() raise RuntimeError('Peer workflow invalidated. Abort.') states.append(TransactionState(resp.transaction_state)) else: states.append(None) return states