Issuing orders

Orders are dispatched in so-called sections. Section is a bunch of orders that can be thought to execute in parallel.

class smok.pathpoint.Section(orders: Optional[List[smok.pathpoint.orders.Order]] = None, disposition: smok.pathpoint.orders.Disposition = Disposition.JOINABLE)

A collection of orders.

Parameters
  • orders – a list of orders

  • disposition – if Disposition.JOINABLE then this section can be joined with other sections. If Disposition.CANNOT_JOIN then all orders from this section will be executed before proceeding to next one

Variables

future – a future that completes upon this section being finished. If this future is cancelled, and section did not start executing, it will be.

cancel() None

Cancel the order

mark_as_being_executed() bool

Mark this section as executed right now

Returns

whether is should be executed (False if cancelled)

mark_as_done() None

Should be invoked by your custom executor when executing this section completes.

class smok.pathpoint.ReadOrder(pathpoint: str, advise: smok.pathpoint.orders.AdviseLevel)

An order to read a pathpoint

Parameters
  • pathpoint – pathpoint to read

  • advise – advise level

fail() bool

Fail this order.

Return whether to requeue it

class smok.pathpoint.WriteOrder(pathpoint: str, value: Union[int, float, str], advise: smok.pathpoint.orders.AdviseLevel, stale_after: Optional[float] = None)

Order to write a target value to target pathpoint

Parameters
  • pathpoint – name of pathpoint to write to

  • value – value to write

  • advise – advise level

  • stale_after – optional timestamp in seconds, after which this write will be discarded

fail() bool

Fail this order.

Return whether to requeue it

class smok.pathpoint.WaitOrder(period: float)

Order to wait a given amount of seconds

Parameters

period – seconds to wait

class smok.pathpoint.SysctlOrder(op_type: str, op_args: str)

A sysctl order. These are completely user-defined.

class smok.pathpoint.MessageOrder(uuid: str)

A message order. Best executed with smok.client.SMOKDevice._execute_message_order()

Note that all of the:

Will return you a smok.pathpoint.Section that represents what needs to be done in order to carry out your command. You need to execute with smok.client.SMOKDevice.execute() in order for them to take any effect.