Asynchronous Actions (cyclus.actions)

Cyclus actions.

This file cannot be Cythonized due to current errors in Cython async handling. – scopatz 2017-01-02, for more information see. see https://github.com/cython/cython/issues/1573

cyclus.actions.action(f)

Decorator for declaring async functions as actions.

cyclus.actions.agent_annotations(state, spec)

Returns agent annotations for a given spec.

Parameters:

spec : str

The agent specification, e.g. “:agents:NullRegion”

cyclus.actions.agent_annotations_as_json(state, spec)

Returns the agent annotations as a JSON string.

cyclus.actions.deregister_tables(state, tables)

Remove table names to the in-memory backend registry. The lone argument here may either be a str (single table), or a set or sequence of strings (many tables) to add.

cyclus.actions.echo(state, s)

Simple asyncronous echo.

cyclus.actions.ensure_tables(tables)

Ensures that the input is a set of strings suitable for use as table names.

cyclus.actions.load(state)

Loads the simulation from the input file and starts executing it.

cyclus.actions.pause(state)

Asynchronous pause.

cyclus.actions.register_tables(state, tables)

Add table names to the in-memory backend registry. The lone argument here may either be a str (single table), or a set or sequence of strings (many tables) to add.

async cyclus.actions.send_message(state, event, params=None, data='null')

Formats and puts a message on the send queue.

Parameters:

state : SimState

The state to put the message in

event : str

The name of event to send.

params : dict or None, optional

A params dict that the event was called with. This will be converted to JSON.

data : str, optional

The payload to send, this should already be in JSON form.

async cyclus.actions.send_registry(state)

Sends the current value of the registry of the in-memory backend.

cyclus.actions.send_registry_action(state)
cyclus.actions.send_table_data(state, table, conds=None, orient='split')

Sends all table data in JSON format.

Parameters:

table : str

The name of the table to send

conds : list of str or None, optional

The query conditions for the table. See the queryable backend for more information.

orient : str, optional

The orientation of the JSON representation of the data. See the pandas.DataFrame.to_json() method documentation for more information.

cyclus.actions.send_table_names(state)

Send the table names from the file-system backend.

cyclus.actions.shutdown(state, when='empty')

Shuts down the server.

Parameters:

when : str, optional

When to shutdown the server. Options are “empty” for when the action queue is empty, and “now” for right now. Default is empty.

cyclus.actions.sleep(state, n)

Asynchronously sleeps for n seconds.

cyclus.actions.table_data_as_json(state, table, conds, orient)

Obtains table data as a JSON string.

cyclus.actions.unpause(state)

Cancels and removes the pause action.