poolaction

This module is part of the Python Pool libray. It defines the class for an abstract action over a set of pool elements

Functions

Classes

get_thread_pool()[source]

Returns the global pool of threads for Sardana

Return type:

ThreadPool

Returns:

the global pool of threads object

PoolAction

Inheritance diagram of PoolAction
class PoolAction(main_element, name='GlobalAction')[source]

Bases: Logger

A generic class to handle any type of operation (like motion or acquisition)

OperationContextClass

alias of OperationContext

get_main_element()[source]

Returns the main element for this action

Returns:

sardana.pool.poolelement.PoolElement

property main_element

Returns the main element for this action

Returns:

sardana.pool.poolelement.PoolElement

get_pool()[source]

Returns the pool object for this action

Returns:

sardana.pool.pool.Pool

property pool

Returns the pool object for this action

Returns:

sardana.pool.pool.Pool

clear_elements()[source]

Clears all elements from this action

add_element(element)[source]

Adds a new element to this action.

Parameters:

element (PoolElement) – the new element to be added

Return type:

None

remove_element(element)[source]

Removes an element from this action. If the element is not part of this action, a ValueError is raised.

Parameters:

element (PoolElement) – the new element to be removed

Raises:

ValueError

Return type:

None

get_elements(copy_of=False)[source]

Returns a sequence of all elements involved in this action.

Parameters:

copy_of (bool) – If False (default) the internal container of elements is returned. If True, a copy of the internal container is returned instead

Return type:

Sequence[PoolElement]

Returns:

a sequence of all elements involved in this action.

get_pool_controller_list()[source]

Returns a list of all controller elements involved in this action.

Return type:

List[PoolController]

Returns:

a list of all controller elements involved in this action.

get_pool_controllers()[source]

Returns a dict of all controller elements involved in this action.

Return type:

Dict[PoolController, Sequence[PoolElement]]

Returns:

a dict of all controller elements involved in this action.

property pool_controllers: Dict[PoolController, Sequence[PoolElement]]

Returns a dict of all controller elements involved in this action.

Returns:

a dict of all controller elements involved in this action.

is_running()[source]

Determines if this action is running or not

Return type:

bool

Returns:

True if action is running or False otherwise

run(*args, **kwargs)[source]

Runs this action

start_action(*args, **kwargs)[source]

Start procedure for this action. Default implementation raises NotImplementedError

Raises:

NotImplementedError

set_finish_hooks(hooks)[source]

Set finish hooks for this action.

Parameters:

hooks (Optional[OrderedDict]) – an ordered dictionary where keys are the hooks and values is a flag if the hook is permanent (not removed after the execution)

Return type:

None

add_finish_hook(hook, permanent=True)[source]

Append one finish hook to this action.

Parameters:
  • hook (Callable) – hook to be appended

  • permanent (bool) – flag if the hook is permanent (not removed after the execution)

Return type:

None

remove_finish_hook(hook)[source]

Remove finish hook.

finish_action()[source]

Finishes the action execution. If a finish hook is defined it safely executes it. Otherwise nothing happens

stop_action(*args, **kwargs)[source]

Stop procedure for this action.

abort_action(*args, **kwargs)[source]

Aborts procedure for this action

release_action()[source]
emergency_break()[source]

Tries to execute a stop. If it fails try an abort

was_stopped()[source]

Determines if the action has been stopped from outside

Return type:

bool

Returns:

True if action has been stopped from outside or False otherwise

was_aborted()[source]

Determines if the action has been aborted from outside

Return type:

bool

Returns:

True if action has been aborted from outside or False otherwise

was_released()[source]

Determines if the action has been released from outside

Return type:

bool

Returns:

True if action has been released from outside or False otherwise

was_action_interrupted()[source]

Determines if the action has been interruped from outside (either from an abort or a stop).

Return type:

bool

Returns:

True if action has been interruped from outside or False otherwise

action_loop()[source]

Action loop for this action. Default implementation raises NotImplementedError

Raises:

NotImplementedError

read_state_info(ret=None, serial=False)[source]

Reads state information of all elements involved in this action

Parameters:
  • ret (Optional[Dict]) – output map parameter that should be filled with state information. If None is given (default), a new map is created an returned

  • serial (bool) – If False (default) perform controller HW state requests in parallel. If True, access is serialized.

Return type:

Dict[PoolElement, Any]

Returns:

a map containing state information per element

raw_read_state_info(ret=None, serial=False)[source]

Unsafe. Reads state information of all elements involved in this action

Parameters:
  • ret (Optional[Dict]) – output map parameter that should be filled with state information. If None is given (default), a new map is created an returned

  • serial (bool) – If False (default) perform controller HW state requests in parallel. If True, access is serialized.

Return type:

Dict[PoolElement, Any]

Returns:

a map containing state information per element

get_read_value_ctrls()[source]
read_value(ret=None, serial=False)[source]

Reads value information of all elements involved in this action

Parameters:
  • ret (Optional[Dict]) – output map parameter that should be filled with value information. If None is given (default), a new map is created an returned

  • serial (bool) – If False (default) perform controller HW value requests in parallel. If True, access is serialized.

Return type:

Dict[PoolElement, SardanaValue]

Returns:

a map containing value information per element (value object, Exception or None)>

raw_read_value(ret=None, serial=False)[source]

Unsafe. Reads value information of all elements involved in this action

Parameters:
  • ret (Optional[Dict]) – output map parameter that should be filled with value information. If None is given (default), a new map is created an returned

  • serial (bool) – If False (default) perform controller HW value requests in parallel. If True, access is serialized.

Return type:

Dict[PoolElement, SardanaValue]

Returns:

a map containing value information per element sardana.sardanavalue.SardanaValue >

get_read_value_loop_ctrls()[source]
read_value_loop(ret=None, serial=False)[source]

Reads value information of all elements involved in this action

Parameters:
  • ret (Optional[Dict]) – output map parameter that should be filled with value information. If None is given (default), a new map is created an returned

  • serial (bool) – If False (default) perform controller HW value requests in parallel. If True, access is serialized.

Return type:

Dict[PoolElement, SardanaValue]

Returns:

a map containing value information per element (value object, Exception or None)>

raw_read_value_loop(ret=None, serial=False)[source]

Unsafe. Reads value information of all elements involved in this action

Parameters:
  • ret (Optional[Dict]) – output map parameter that should be filled with value information. If None is given (default), a new map is created an returned

  • serial (bool) – If False (default) perform controller HW value requests in parallel. If True, access is serialized.

Return type:

Dict[PoolElement, SardanaValue]

Returns:

a map containing value information per element sardana.sardanavalue.SardanaValue >

OperationInfo

Inheritance diagram of OperationInfo
class OperationInfo[source]

Bases: object

Stores synchronization data for a certain operation

init(count)[source]

Initializes this operation with a certain count

wait(timeout=None)[source]

waits for the operation to finish

finish_one()[source]

Notifies this operation that one step was finished

acquire()[source]

Acquires this operation lock

release()[source]

Releases this operation lock

PoolActionItem

Inheritance diagram of PoolActionItem
class PoolActionItem(element)[source]

Bases: object

The base class for an atomic action item

get_element()[source]

Returns the element associated with this item

set_element(element)[source]

Sets the element for this item

property element

Returns the element associated with this item

ActionContext

Inheritance diagram of ActionContext
class ActionContext(pool_action)[source]

Bases: object

Stores an atomic action context

enter()[source]

Enters operation

exit()[source]

Leaves operation