Pulse Action

core pulse action for triggering scheduled pulse ability on subscribing actions.

Pulse Action

GitHub release (latest by date) GitHub Workflow Status GitHub issues GitHub pull requests GitHub

This action provides a core mechanism for triggering scheduled pulse activities in subscribing actions. As a pulse action, it ensures periodic and timely execution of tasks within the subscribing actions framework. The package is a singleton and requires the Jivas library version 2.0.0.

Package Information

  • Name: jivas/pulse_action
  • Author: V75 Inc.
  • Architype: PulseAction

Meta Information

  • Title: Pulse Action
  • Group: core
  • Type: action

Configuration

  • Singleton: true

Dependencies

  • Jivas: ^2.0.0

How to Use

Below is detailed guidance on how to configure and use the Pulse Action.

Overview

The Pulse Action provides a mechanism for scheduling and triggering periodic tasks. It supports configurations for various use cases, including:

  • Custom schedules for specific tasks.
  • Integration with subscribing actions for seamless task execution.
  • Scalability for handling multiple pulse triggers.

Configuration Structure

The action accepts direct entries under the config parameter, which can be specified in the agent descriptor entry for the action. Below is an example:

- action: jivas/pulse_action
    context:
        enabled: true
        version: ">=0.0.1"
        config:
            DHBReportUpdateInteractAction: every().day.at("05:30", "America/Guyana")

Syntax for the config Parameter

The config parameter accepts key-value mappings where the key is the action label, and the value is the scheduling specification. The scheduling syntax follows the conventions outlined in the schedule library documentation.

config = {
        # Example key-value mappings
        "PulseAction": "every(5).seconds",
        "XYZAction": "every(1).hour.until('2030-01-01 18:00')"
}

Programmatic Configuration Management

Once a reference to the pulse_action is acquired, you can programmatically add or remove schedule entries using the following methods:

Adding a Schedule Entry

pulse_action = self.get_agent().get_actions().get(action_label="PulseAction")
pulse_action.add_schedule("MyOwnAction", "every(1).hour.until('2030-01-01 18:00')")

Removing a Schedule Entry

pulse_action.remove_schedule("MyOwnAction")

Method Definitions

  • add_schedule(action_label: str, interval_spec: str) Adds a new schedule entry for the specified action and interval. Example:

    pulse_action.add_schedule("MyOwnAction", "every(1).hour.until('2030-01-01 18:00')")
    
  • remove_schedule(action_label: str) Removes an existing schedule entry for the specified action. Example:

    pulse_action.remove_schedule("MyOwnAction")
    

These methods allow dynamic management of schedules, enabling flexibility and scalability for task execution.

Best Practices

  • Validate your task identifiers and parameters before deployment.
  • Test pulse schedules in a staging environment before production use.

🔰 Contributing

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/TrueSelph/pulse_action
    
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
    
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
    
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
    
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph

🎗 License

This project is protected under the Apache License 2.0. See LICENSE for more information.

Install
jvcli download action jivas/pulse_action

Last published

a month ago

Version

0.0.2

Downloads

191

Author

jivas

Type

action

Visibility

Public

Tags

core
action