bobocep.cep.engine.decider.run.BoboRun

class bobocep.cep.engine.decider.run.BoboRun(run_id: str, phenomenon_name: str, pattern: BoboPattern, block_index: int, history: BoboHistory)[source]

Bases: object

A run that tracks the progress of a partially completed complex event.

__init__(run_id: str, phenomenon_name: str, pattern: BoboPattern, block_index: int, history: BoboHistory)[source]
Parameters:
  • run_id – An ID for the run.

  • phenomenon_name – A phenomenon name associated with the run.

  • pattern – A pattern associated with the run.

  • block_index – An index which indicates where in the pattern to start the run.

  • history – A history of events for the run.

Raises:
  • BoboRunError – Run ID length is equal to 0.

  • BoboRunError – Process name length is equal to 0.

  • BoboRunError – Block index is less than 1.

  • BoboRunError – History does not have enough events in it to cover all blocks up to the block index.

property block_index: int
Returns:

The current block index of the run.

halt() None[source]

Halts the run.

history() BoboHistory[source]
Returns:

The run history.

is_complete() bool[source]
Returns:

True if run is completed; False otherwise.

is_halted() bool[source]
Returns:

True if run has halted; False otherwise.

property pattern: BoboPattern
Returns:

The pattern associated with the run.

property phenomenon_name: str
Returns:

The phenomenon name associated with the run.

process(event: BoboEvent) bool[source]
Parameters:

event – An event for the run to process.

Returns:

True if the event caused a state change in the run; False otherwise.

property run_id: str
Returns:

The run ID.

serialize() BoboRunSerial[source]
Returns:

A serializable representation of the run.

set_block(block_index: int, history: BoboHistory) None[source]

Updates the run’s block to a new index and history.

Parameters:
  • block_index – The new block index.

  • history – The new history.

Raises:

BoboRunError: New block index is less than 1.

Raises:

BoboRunError: New history does not have enough events in it to cover all blocks up to the new block index.