ActionFlow is a Python package designed to simplify the execution of complex workflows through a structured and modular approach. By integrating powerful state management, parallel processing, and YAML-based configuration inspired by GitHub Actions, ActionFlow is ideal for orchestrating tasks in environments where flexibility, scalability, and extensibility are paramount.
-
YAML Syntax Inspired by GitHub Actions
Define your workflows using a familiar and intuitive YAML structure, making it easy for users already acquainted with GitHub Actions to adapt. -
YAML-Driven Workflows
Configure your workflows, jobs, and actions in a clear, human-readable YAML format, simplifying sharing and versioning. -
Action Groups with Parallelism
Actions are grouped based on theirconcurrencydependencies and executed in parallel or sequentially as needed, optimizing performance. -
Stateful Actions and Jobs
Each action follows a consistent lifecycle (_check,_pre_process,_run,_post_process) with states such aspending,running,success, andfailed. Jobs and groups inherit states based on their actions' outcomes. -
Thread-Safe Execution
Execute workflows in background threads while maintaining thread safety and avoiding task collisions using a global context and locking mechanisms. -
CLI and Web API
Run workflows, monitor logs, and check execution status using a simple CLI or a lightweight HTTP server. This makes the package versatile for both command-line and web-based integrations. -
Extensibility Through Python Classes
Define custom actions by extending the baseActionclass. Override lifecycle methods to implement specific logic, adapting to unique requirements with ease. -
Efficient Resource Management
Utilize multithreading and multiprocessing to handle long-running or resource-intensive tasks, such as cloning repositories or pulling Docker images.
- Flow: Represents the entire workflow, consisting of multiple jobs.
- Job: A set of grouped actions executed sequentially.
- Action: The building blocks of workflows, performing specific tasks and following a standardized lifecycle.
Define your workflow in YAML with a GitHub Actions-inspired syntax:
name: example_flow
context:
workspace: /tmp
mode: test
env:
VAR_1: value1
VAR_2: value2
jobs:
job1:
steps:
- name: action1
with:
concurrency: true
- name: action2
with:
concurrency: true
job2:
steps:
- name: action3
You can install ActionFlow using Poetry or pip:
pip install actionflowRun your workflows directly from the command line using the following commands:
Execute a workflow defined in a YAML file:
actionflow run example.yamlRetrieve the current status of your workflow:
actionflow statusAccess the logs generated during workflow execution:
actionflow logsActionFlow can be deployed as a lightweight web server to handle workflow submissions via HTTP requests.
Launch the web server on a specified port:
actionflow serve --port 8080Use a POST request to submit a YAML workflow for processing:
curl -X POST http://localhost:8080/process -d @example.yaml -H "Content-Type: application/x-yaml"- Logs: Fetch logs using a
GETrequest:curl http://localhost:8080/logs
- Status: Check workflow status using a
GETrequest:curl http://localhost:8080/status
For detailed documentation, please visit the documentation.
We welcome contributions! Please see our contributing guidelines for more details.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please contact us at support@example.com.