ironic_python_agent.extensions.base module¶
-
class
ironic_python_agent.extensions.base.
AgentCommandStatus
[source]¶ Bases:
object
Mapping of agent command statuses.
-
FAILED
= 'FAILED'¶
-
RUNNING
= 'RUNNING'¶
-
SUCCEEDED
= 'SUCCEEDED'¶
-
VERSION_MISMATCH
= 'CLEAN_VERSION_MISMATCH'¶
-
-
class
ironic_python_agent.extensions.base.
AsyncCommandResult
(command_name, command_params, execute_method, agent=None)[source]¶ Bases:
ironic_python_agent.extensions.base.BaseCommandResult
A command that executes asynchronously in the background.
-
is_done
()[source]¶ Checks to see if command is still RUNNING.
- Returns
True if command is done, False if still RUNNING
-
join
(timeout=None)[source]¶ Block until command has completed, and return result.
- Parameters
timeout – float indicating max seconds to wait for command to complete. Defaults to None.
-
-
class
ironic_python_agent.extensions.base.
BaseCommandResult
(command_name, command_params)[source]¶ Bases:
ironic_python_agent.encoding.SerializableComparable
Base class for command result.
-
is_done
()[source]¶ Checks to see if command is still RUNNING.
- Returns
True if command is done, False if still RUNNING
-
serializable_fields
= ('id', 'command_name', 'command_status', 'command_error', 'command_result')¶
-
-
class
ironic_python_agent.extensions.base.
SyncCommandResult
(command_name, command_params, success, result_or_error)[source]¶ Bases:
ironic_python_agent.extensions.base.BaseCommandResult
A result from a command that executes synchronously.
-
ironic_python_agent.extensions.base.
async_command
(command_name, validator=None)[source]¶ Will run the command in an AsyncCommandResult in its own thread.
command_name is set based on the func name and command_params will be whatever args/kwargs you pass into the decorated command. Return values of type str or unicode are prefixed with the command_name parameter when returned for consistency.
-
ironic_python_agent.extensions.base.
sync_command
(command_name, validator=None)[source]¶ Decorate a method to wrap its return value in a SyncCommandResult.
For consistency with @async_command() can also accept a validator which will be used to validate input, although a synchronous command can also choose to implement validation inline.