API Reference

Generation of Queue Items

Generic Queue Item

BItem

A helper class that generates dictionary with queue item parameters.

BItem.to_dict

The method returns the copy of the dictionary with item parameters, which is ready to be passed to the server.

BItem.from_dict

The method copies item parameters from a dictionary.

BItem.item_type

The property for read-write access to the item type.

BItem.name

The property for read-write access to the item name.

BItem.args

The read-write property sets or gets the list of item args.

BItem.kwargs

The read-write property sets or gets the copy of the dictionary of item kwargs.

BItem.meta

The read-write property that sets or gets the item metadata.

BItem.item_uid

The property for read-write access to the item uid.

BItem.dict_ref

The property returns reference to iternal item dictionary.

BItem.recognized_item_types

The read-only property returns the list of item types recognized by the queue server.

Type-Specific Queue Items

BPlan

The helper class for creating dictionary representing a plan.

BInst

The helper class for creating dictionary representing an instruction.

BFunc

The helper class for creating dictionary representing a function.

Miscellaneous API

WaitMonitor

Creates monitor object for wait_... operations, such as wait_for_idle.

WaitMonitor.cancel

Cancel the currently running operation.

WaitMonitor.is_cancelled

Checks if the monitor was cancelled.

WaitMonitor.time_start

Time when the operation started (seconds).

WaitMonitor.time_elapsed

Time since the operation started (seconds).

WaitMonitor.timeout

Timeout (seconds).

WaitMonitor.set_timeout

Modify timeout for the current operation (seconds).

WaitMonitor.add_cancel_callback

Each callbacks is called only once before the operation is cancelled.

Synchronous Communication with 0MQ Server

zmq.REManagerAPI

API for communication with RE Manager using 0MQ protocol.

zmq.REManagerAPI.close

Close RE Manager client.

Configuration of REManagerAPI

zmq.REManagerAPI.user

Get and set the default user name.

zmq.REManagerAPI.user_group

Get and set the default user group name.

zmq.REManagerAPI.set_user_name_to_login_name

Set the default user name to 'login name'.

Low-Level API

zmq.REManagerAPI.send_request

Send request to RE Manager and receive the response.

API for controlling RE Manager

zmq.REManagerAPI.status

Load status of RE Manager.

zmq.REManagerAPI.ping

Current implementation of the API loads status of RE Manager, but this may change in future releases.

zmq.REManagerAPI.config_get

Returns config info for RE Manager.

zmq.REManagerAPI.wait_for_idle

Wait for RE Manager to return to "idle" state.

zmq.REManagerAPI.wait_for_idle_or_paused

Wait for RE Manager to switch to idle or paused state.

zmq.REManagerAPI.wait_for_idle_or_running

Wait for RE Manager to switch to idle or executing_queue state.

zmq.REManagerAPI.wait_for_condition

The function periodically checks RE Manager status and blocks until the condition callable returns True and can be used to wait for arbitrary conditions based on RE Manager status and/or user-provided data.

API for controlling RE Environment

zmq.REManagerAPI.environment_open

Open RE Worker environment.

zmq.REManagerAPI.environment_close

Close RE Worker environment.

zmq.REManagerAPI.environment_destroy

Destroy RE Worker environment.

zmq.REManagerAPI.environment_update

Update RE Worker environment cache.

API for Monitoring Available Resources

zmq.REManagerAPI.permissions_reload

Generate the new lists of allowed plans and devices based on current user group permissions and the lists of existing plans and devices.

zmq.REManagerAPI.permissions_get

Download the dictionary of user group permissions currently used by RE Manager.

zmq.REManagerAPI.permissions_set

Uploads the dictionary of user group permissions.

zmq.REManagerAPI.plans_allowed

Returns the list (dictionary) of allowed plans.

zmq.REManagerAPI.devices_allowed

Returns the list (dictionary) of allowed devices.

zmq.REManagerAPI.plans_existing

Returns the list (dictionary) of existing plans.

zmq.REManagerAPI.devices_existing

Returns the list (dictionary) of existing devices.

API for management of RE Queue

zmq.REManagerAPI.queue_get

Returns the list of items (plans and instructions) in the plan queue and currently running plan.

zmq.REManagerAPI.queue_clear

Remove all items from the plan queue.

zmq.REManagerAPI.item_add

Add item to the queue.

zmq.REManagerAPI.item_add_batch

Add a batch of items to the queue.

zmq.REManagerAPI.item_update

Update an existing item in the queue.

zmq.REManagerAPI.item_get

Load an existing queue item.

zmq.REManagerAPI.item_remove

Remove an item from the queue.

zmq.REManagerAPI.item_remove_batch

Remove a batch of items from the queue.

zmq.REManagerAPI.item_move

Move an item to a different position in the queue.

zmq.REManagerAPI.item_move_batch

Move a batch of items to a different position in the queue.

zmq.REManagerAPI.item_execute

Immediately execute the submitted item.

zmq.REManagerAPI.queue_start

Start execution of the queue.

zmq.REManagerAPI.queue_stop

Request RE Manager to stop execution of the queue after completion of the currently running plan.

zmq.REManagerAPI.queue_stop_cancel

Cancel the pending request to stop execution of the queue after the currently running plan.

zmq.REManagerAPI.queue_mode_set

Set parameters that define the mode of plan queue execution.

zmq.REManagerAPI.queue_autostart

Enable/disable autostart mode.

API for Controlling RE History

zmq.REManagerAPI.history_get

Returns the list of plans in the history.

zmq.REManagerAPI.history_clear

Remove all items from the history.

API for Locking RE Manager

zmq.REManagerAPI.lock

Lock RE Manager with a lock key.

zmq.REManagerAPI.lock_environment

Locks the environment in RE Manager.

zmq.REManagerAPI.lock_queue

Locks the queue in RE Manager.

zmq.REManagerAPI.lock_all

Locks the environment and the queue in RE Manager.

zmq.REManagerAPI.unlock

Unlock RE Manager.

zmq.REManagerAPI.lock_info

Returns status information of the current lock.

zmq.REManagerAPI.lock_key

Get/set current lock key.

zmq.REManagerAPI.enable_locked_api

Enable/disable access to locked API.

zmq.REManagerAPI.get_default_lock_key

Returns the default lock key.

zmq.REManagerAPI.set_default_lock_key

Set the default lock key.

zmq.REManagerAPI.default_lock_key_path

Get/set path of the file with the default lock key.

API for Executing Tasks

zmq.REManagerAPI.script_upload

Upload and execute script in RE Worker namespace.

zmq.REManagerAPI.function_execute

Start execution of a function in RE Worker namespace.

zmq.REManagerAPI.task_status

Returns the status of one or more tasks executed by the worker process.

zmq.REManagerAPI.task_result

Get the status and results of task execution.

zmq.REManagerAPI.wait_for_completed_task

Wait for one or multiple tasks to be completed.

API for controlling Run Engine

zmq.REManagerAPI.re_runs

Request the list of active runs generated by the currently executed plans.

zmq.REManagerAPI.re_pause

Request Run Engine to pause currently running plan.

zmq.REManagerAPI.re_resume

Request Run Engine to resume paused plan.

zmq.REManagerAPI.re_stop

Request Run Engine to stop paused plan.

zmq.REManagerAPI.re_abort

Request Run Engine to abort paused plan.

zmq.REManagerAPI.re_halt

Request Run Engine to halt paused plan.

API for controlling IPython kernel

zmq.REManagerAPI.kernel_interrupt

Send interrupt request (Ctrl-C) to the running IPython kernel.

API for monitoring console output of RE manager

Each instance of REManagerAPI holds a reference to a Console Monitor. The reference is accessible using the console_monitor property. The Console Monitor is initialized as part of REManagerAPI instantiation and ready for use.

zmq.REManagerAPI.console_monitor

Reference to a console_monitor.

The package implements multiple console monitors (synchronous/asynchronous monitors for 0MQ and HTTP communication), which expose identical API. The class for monitoring console output using 0MQ for synchronous applications:

console_monitor.ConsoleMonitor_ZMQ_Threads

Console Monitor API (0MQ).

console_monitor.ConsoleMonitor_ZMQ_Threads.enabled

Indicates if monitoring is enabled.

console_monitor.ConsoleMonitor_ZMQ_Threads.enable

Enable monitoring of the console output.

console_monitor.ConsoleMonitor_ZMQ_Threads.disable

Disable monitoring of the console output.

console_monitor.ConsoleMonitor_ZMQ_Threads.disable_wait

Disable monitoring and wait for completion.

console_monitor.ConsoleMonitor_ZMQ_Threads.clear

Clear the message buffer.

console_monitor.ConsoleMonitor_ZMQ_Threads.next_msg

Returns the next message from the buffer.

console_monitor.ConsoleMonitor_ZMQ_Threads.text_max_lines

Get/set the maximum size of the text buffer.

console_monitor.ConsoleMonitor_ZMQ_Threads.text_uid

Returns UID of the current text buffer.

console_monitor.ConsoleMonitor_ZMQ_Threads.text

Returns text representation of console output.

Other console monitor classes support identical API:

console_monitor.ConsoleMonitor_ZMQ_Async

Console Monitor API (0MQ).

console_monitor.ConsoleMonitor_HTTP_Threads

Console Monitor API (HTTP).

console_monitor.ConsoleMonitor_HTTP_Async

Console Monitor API (HTTP).

Asynchronous Communication with 0MQ Server

zmq.aio.REManagerAPI

API for communication with RE Manager using 0MQ protocol.

Synchronous Communication with HTTP Server

http.REManagerAPI

API for communication with RE Manager using HTTP (RESTful API) protocol.

API for authentication and authorization (HTTP)

http.REManagerAPI.auth_method

Returns authorization method (API key, token or none).

http.REManagerAPI.auth_key

Returns authorization key.

http.REManagerAPI.set_authorization_key

Set default authorization key(s) for HTTP requests.

http.REManagerAPI.login

Parameters:

http.REManagerAPI.session_refresh

Refresh session using valid refresh token.

http.REManagerAPI.session_revoke

Revoke session for an authorized user.

http.REManagerAPI.apikey_new

Generate a new API key for authorized user.

http.REManagerAPI.apikey_info

Get information about an API key.

http.REManagerAPI.apikey_delete

Delete an API key for the authorized principal. The API key is identified by first eight characters. For example, an API key ::.

http.REManagerAPI.whoami

Returns full information about the principal.

http.REManagerAPI.principal_info

Returns full information on all principals or one principal.

http.REManagerAPI.api_scopes

Returns API scopes for an authorized user.

http.REManagerAPI.logout

Log out.

ASynchronous Communication with HTTP Server

http.aio.REManagerAPI

API for communication with RE Manager using HTTP (RESTful API) protocol.