mistral.engine.rpc_backend package

Submodules

mistral.engine.rpc_backend.base module

class mistral.engine.rpc_backend.base.RPCClient(conf)

Bases: object

async_call(ctx, method, target=None, **kwargs)

Asynchronous call of RPC method.

Does not block the thread, just send invoking data to the RPC server and immediately returns nothing.

sync_call(ctx, method, target=None, **kwargs)

Synchronous call of RPC method.

Blocks the thread and wait for method result.

class mistral.engine.rpc_backend.base.RPCServer(conf)

Bases: object

register_endpoint(endpoint)

Registers a new RPC endpoint.

Parameters:endpoint – an object containing methods which will be used as RPC methods.
run(executor='blocking')

Runs the RPC server.

mistral.engine.rpc_backend.rpc module

class mistral.engine.rpc_backend.rpc.EngineClient(rpc_conf_dict)

Bases: mistral.engine.base.Engine

RPC Engine client.

on_action_complete(*args, **kwargs)
on_task_state_change(task_ex_id, state, state_info=None)
pause_workflow(*args, **kwargs)
rerun_workflow(*args, **kwargs)
resume_workflow(*args, **kwargs)
rollback_workflow(*args, **kwargs)
start_action(*args, **kwargs)
start_workflow(*args, **kwargs)
stop_workflow(*args, **kwargs)
class mistral.engine.rpc_backend.rpc.EngineServer(engine)

Bases: object

RPC Engine server.

on_action_complete(rpc_ctx, action_ex_id, result_data, result_error, wf_action)

Receives RPC calls to communicate action result to engine.

Parameters:
  • rpc_ctx – RPC request context.
  • action_ex_id – Action execution id.
  • result_data – Action result data.
  • result_error – Action result error.
  • wf_action – True if given id points to a workflow execution.
Returns:

Action execution.

on_task_state_change(rpc_ctx, task_ex_id, state, state_info=None)
pause_workflow(rpc_ctx, execution_id)

Receives calls over RPC to pause workflows on engine.

Parameters:
  • rpc_ctx – Request context.
  • execution_id – Workflow execution id.
Returns:

Workflow execution.

rerun_workflow(rpc_ctx, task_ex_id, reset=True, env=None)

Receives calls over RPC to rerun workflows on engine.

Parameters:
  • rpc_ctx – RPC request context.
  • task_ex_id – Task execution id.
  • reset – If true, then purge action execution for the task.
  • env – Environment variables to update.
Returns:

Workflow execution.

resume_workflow(rpc_ctx, wf_ex_id, env=None)

Receives calls over RPC to resume workflows on engine.

Parameters:
  • rpc_ctx – RPC request context.
  • wf_ex_id – Workflow execution id.
  • env – Environment variables to update.
Returns:

Workflow execution.

rollback_workflow(rpc_ctx, execution_id)

Receives calls over RPC to rollback workflows on engine.

Parameters:rpc_ctx – RPC request context.
Returns:Workflow execution.
start_action(rpc_ctx, action_name, action_input, description, params)

Receives calls over RPC to start actions on engine.

Parameters:
  • rpc_ctx – RPC request context.
  • action_name – name of the Action.
  • action_input – input dictionary for Action.
  • description – description of new Action execution.
  • params – extra parameters to run Action.
Returns:

Action execution.

start_workflow(rpc_ctx, workflow_identifier, workflow_input, description, params)

Receives calls over RPC to start workflows on engine.

Parameters:
  • rpc_ctx – RPC request context.
  • workflow_identifier – Workflow definition identifier.
  • workflow_input – Workflow input.
  • description – Workflow execution description.
  • params – Additional workflow type specific parameters.
Returns:

Workflow execution.

stop_workflow(rpc_ctx, execution_id, state, message=None)

Receives calls over RPC to stop workflows on engine.

Sets execution state to SUCCESS or ERROR. No more tasks will be scheduled. Running tasks won’t be killed, but their results will be ignored.

Parameters:
  • rpc_ctx – RPC request context.
  • execution_id – Workflow execution id.
  • state – State assigned to the workflow. Permitted states are SUCCESS or ERROR.
  • message – Optional information string.
Returns:

Workflow execution.

class mistral.engine.rpc_backend.rpc.EventEngineClient(rpc_conf_dict)

Bases: mistral.engine.base.EventEngine

RPC EventEngine client.

create_event_trigger(trigger, events)
delete_event_trigger(trigger, events)
update_event_trigger(trigger)
class mistral.engine.rpc_backend.rpc.EventEngineServer(event_engine)

Bases: object

RPC EventEngine server.

create_event_trigger(rpc_ctx, trigger, events)
delete_event_trigger(rpc_ctx, trigger, events)
update_event_trigger(rpc_ctx, trigger)
class mistral.engine.rpc_backend.rpc.ExecutorClient(rpc_conf_dict)

Bases: mistral.engine.base.Executor

RPC Executor client.

run_action(action_ex_id, action_class_str, attributes, action_params, target=None, async=True, safe_rerun=False)

Sends a request to run action to executor.

Parameters:
  • action_ex_id – Action execution id.
  • action_class_str – Action class name.
  • attributes – Action class attributes.
  • action_params – Action input parameters.
  • target – Target (group of action executors).
  • async – If True, run action in asynchronous mode (w/o waiting for completion).
  • safe_rerun – If true, action would be re-run if executor dies during execution.
Returns:

Action result.

class mistral.engine.rpc_backend.rpc.ExecutorServer(executor)

Bases: object

RPC Executor server.

run_action(rpc_ctx, action_ex_id, action_class_str, attributes, params, safe_rerun)

Receives calls over RPC to run action on executor.

Parameters:
  • rpc_ctx – RPC request context dictionary.
  • action_ex_id – Action execution id.
  • action_class_str – Action class name.
  • attributes – Action class attributes.
  • params – Action input parameters.
  • safe_rerun – Tells if given action can be safely rerun.
Returns:

Action result.

Module contents

Table Of Contents

Project Source

This Page