Learning Path

Welcome to st2

Your guide to understanding the codebase

Learning Path Overview

  • 5 levels
  • 15 learning units

Orchestration & APIs

  • Pipelines, workflows, public interfaces • 3 units

Pack-Based Plugin Architecture

  • Architecture • 7

Data Models and Persistence

  • Data Model • 6

Actions and Runners Fundamentals

  • Patterns • 1

Core Logic & Data

  • Business rules, schemas, models • 3 units

REST API and Serialization

  • API • 6

Security and Access Control

  • Security • 5

Triggers and Sensors

  • Workflow • 10

Interaction & Integration

  • UI components, external connectors • 3 units

Message Queue and Service Integration

  • Integration • 8

Rules, Policies, and Automation

  • Workflow • 4

Workflow Engines and Execution

  • Workflow • 2

Cross-Cutting Concerns

  • Auth, logging, config, testing • 2 units

ChatOps and Action Aliases

  • API • 10

Observability and Operations

  • Infrastructure • 14

Edge Cases & Resilience

  • Error handling, fault tolerance • 1 units

Additional Data Model Patterns

  • Data Model • 11

Test Your Knowledge

Test your deep understanding of the codebase

Quiz Overview

  • Progress 0/26 answered
  • Question Tiers:
    • Why: 8
    • Purpose & Problem Architecture: 10
    • Design & Patterns Code: 8
    • Implementation

Hands-On Assignment

Duration: 45-60 minutes

Your Challenge

Build a custom runner that executes actions with retry logic and exponential backoff. Your runner should accept parameters for max retries, initial delay, and backoff multiplier, then automatically retry failed actions while respecting these constraints. This will help you understand how runners interact with the execution framework and handle action lifecycle events.

Starting Points

  • contrib/runners/action_chain_runner/action_chain_runner/action_chain_runner.py:1-93
    Study how ActionChainRunner extends the base runner class, handles action execution, and manages state transitions

  • contrib/runners/action_chain_runner/action_chain_runner/action_chain_runner.py:45-70
    Notice how the run() method is implemented and how it returns action status

  • contrib/examples/config.schema.yaml:1-21
    Examine how runner parameters are defined using JSON schema - you'll need to create a similar schema for your retry runner

  • contrib/runners/action_chain_runner/action_chain_runner/
    Create your new retry_runner package here, following the same structure as action_chain_runner

Success Criteria

  • Runner successfully retries failed actions up to max_retries times
  • Delays between retries follow exponential backoff pattern (can verify via logs/timing)
  • Runner stops retrying and returns success when action succeeds before max_retries
  • Runner returns failure status when max_retries is exhausted
  • config.schema.yaml properly validates runner parameters
  • Runner can be registered and invoked through st2 action execution

Hints

  • Hint 1: Understanding the Runner base class conceptually
  • Hint 2: Action execution and status handling code location
  • Hint 3: Parameter schema definition implementation
  • Hint 4: Implementing exponential backoff implementation
  • Hint 5: Testing your runner implementation

Prerequisites

  • Python classes and inheritance
  • Action execution model
  • JSON Schema basics