TriggerBucket#

class eclypse.workflow.trigger.bucket.TriggerBucket[source]#

Bases: object

A class to represent a bucket of triggers for an event.

Methods

__init__([triggers, condition, max_triggers])

Initialize the trigger.

logger()

Get the logger for the event.

prepare()

Prepare the trigger for use.

reset()

Reset the trigger state.

trigger([trigger_event])

Check if the trigger should fire.

__init__(triggers=None, condition='any', max_triggers=1000000000)[source]#

Initialize the trigger.

Parameters:
  • triggers (Trigger | list[Trigger] | None) – A single trigger or a list of triggers that can activate the event. Defaults to None.

  • condition (str) – The condition for the triggers to fire the event. If “any”, the event fires if any trigger is active. If “all”, the event fires only if all triggers are active. Defaults to “any”.

  • max_triggers (int | None) – The maximum number of times the trigger can be called. Defaults to no limit.

prepare()[source]#

Prepare the trigger for use.

This method can be overridden in subclasses to perform any necessary initialization before the trigger is used.

trigger(trigger_event=None)[source]#

Check if the trigger should fire.

Returns:

True if the trigger should fire, False otherwise.

Return type:

bool

Parameters:

trigger_event (EclypseEvent | None)

reset()[source]#

Reset the trigger state.

logger()[source]#

Get the logger for the event.

Returns:

The logger for the event if it exists, otherwise None.

Return type:

Logger