Using Triggers in Algoreus

In the Genesis, it's possible to set up triggers on a batch data axon, prompting it to execute upon the completion of one or more other axon runs. These axons are referred to as downstream and upstream axons. A trigger is created on the downstream axon, enabling it to run once one or more upstream axons have finished.


Benefits of using Triggers

  • Cleanse your data once, making it accessible to several downstream axons for usage.

  • Share details such as runtime arguments and plugin configurations between axons, a process known as payload configuration.

  • Maintain a collection of dynamic axons that can execute using data of the current hour/day/week/month, as opposed to a static axon requiring updates for each run.

Moreover, since the downstream axon consumes the output of the upstream axon, you may want to specify that when the downstream axon runs using this trigger, it also receives the input directory to read from (the directory where the upstream axon generated its output). This process, known as passing payload configuration, is defined using runtime arguments and allows you to maintain a set of dynamic axons running based on the data of the hour/day/week/month, in contrast to a static axon that needs constant updates for each run.

Note: Schedule Lifecycle Microservices can also be used to create inbound triggers.

Before you begin, you'll need to deploy the axons serving as your upstream and downstream axons within the Genesis.

Optional: If you'd like to pass payload configuration as runtime arguments, you should set the runtime arguments for your upstream axon:

  1. Navigate to the List page. In the Deployed tab, click on the name of the upstream axon. This will open the Deploy view for that axon.

  2. Click the arrow next to the Run button.

  3. Click the '+' button and fill in the Key and Value for your runtime argument.

  4. Click Save.


To create an inbound trigger on a downstream axon

  1. Deploy both the upstream and downstream axons.

  2. From the List > Deployed axon page, click the name of the downstream axon to open it in Deploy mode.

  3. On the left side of the page, click Inbound triggers. This will display a list of available axons.

  4. Select the namespace for the upstream axons in the "View axons in namespace" field.

  5. In the Trigger Type field, choose between "Trigger on any selected event (OR)" or "Wait for all events (AND)".

  6. In the Trigger Name field, enter a unique name for the trigger.

  7. Select the upstream axon by clicking the arrow to the left of the axon name. You can also search for axons to use in the trigger.

  8. Select when to trigger the downstream axon to run. This can be when the upstream axon Succeeds, Stops, and/or Fails. More than one option can be selected.

  9. If you do not want to pass any payload configuration between these axons, click the checkbox to the right of the axon name and click Enable Trigger.


Payload Configuration

Payload configuration allows you to pass relevant information such as the output directory, the format of the data, and the day for which it was run from the upstream axon to the downstream axon. The downstream axon can then use this information to make decisions, such as picking the correct dataset to read from.

You can pass payload information from the upstream axon to the downstream axon by setting the runtime arguments of the downstream axon using the values of either the runtime arguments or the configuration of any plugin in the upstream axon.

The Genesis ensures that every time the downstream axon is triggered, its payload is set using the runtime arguments of the specific run of the upstream axon that triggered the downstream axon.

To add payload configuration to a trigger, follow these steps:

  1. Click Trigger Config to see runtime arguments and plugin configuration that you can pass to the downstream axon when this trigger executes.

  2. In the Runtime arguments section, from the dropdown lists, you can pick runtime arguments from the first axon to pass along to the second axon.

  3. Click Plugin Config to see a list of properties from all the plugins you have in your upstream axon that you can pass along with the trigger to the downstream axon.

  4. After you have all the runtime arguments and plugin configuration set to include with the trigger, click Select.

  5. To enable the trigger, click Enable The Trigger.

Note: "Enable The Trigger" is disabled if the trigger configuration is incomplete. After enabling the trigger, you'll notice an increased count in your Inbound Trigger indicator.

To view the configuration you have set for this trigger, click "View Payload". If you wish to add additional triggers, click "Add New Trigger".


To test a trigger

  1. Run the upstream axon.

  2. From the Axon List > Deploy page, click the name of the upstream axon. Then click the Run button.

  3. Wait for the axon to complete, and navigate to the downstream axon. You should see it being triggered.

To navigate through triggers, you can also navigate from an upstream axon to its triggered axons by clicking the Outbound triggers button on the details page of the upstream axon.

Similarly, you can navigate from a downstream axon to its triggering axons by clicking the Inbound triggers button on the Axon Deploy page of the downstream axon. This feature can be utilized to navigate through a set of interconnected axons.


Last updated