Skip to content

fix: activate flow schedules in the Scheduler Service (not just write the config)#481

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1783596373-flow-schedule-activation
Closed

fix: activate flow schedules in the Scheduler Service (not just write the config)#481
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1783596373-flow-schedule-activation

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

kbagent flow schedule created a keboola.scheduler config with state=enabled but never registered it with the Scheduler microservice, so the schedule was never activated and never fired — even though it looked "enabled" in schedule list/detail (those read the config field, not the Scheduler Service). The Keboola UI does two steps: write the config and activate it. We only did the first.

In Keboola, a keboola.scheduler config and an active schedule are distinct: the cron engine lives in a separate Scheduler service (scheduler.{stack}) that only runs schedules activated via POST /schedules {configurationId} (which also mints the schedule's token). This PR adds that activation step (and the symmetric deactivation on removal).

client.py — new Scheduler Service sub-client (sibling scheduler. host, same X-StorageApi-Token, same retry/backoff as queue/query/encryption)

activate_schedule(configuration_id, configuration_version_id=None) -> dict   # POST /schedules
list_activated_schedules(configuration_id=None) -> list[dict]                 # GET  /schedules (client-side filter)
deactivate_schedule(schedule_id) -> None                                     # DELETE /schedules/{id}

flow_service.set_flow_schedule — activate after writing the config

result = client.create_config(...) or client.update_config(...)
if effective_branch is None:                      # production only
    schedule = client.activate_schedule(result["id"], configuration_version_id=result["version"])
# result now carries: activated: bool, activated_schedule_id: str | None

Activation is production-only. On --branch, the config is written but not activated (activated=false); dev-branch schedules activate on deploy to production, mirroring how the Scheduler Service operates on the default branch.

flow_service.remove_flow_schedule — deactivate before deleting

For each matching keboola.scheduler config, delete its Scheduler Service activation first, so removal no longer orphans an activation + token that would keep firing against a deleted config. Result gains deactivated_schedule_ids.

CLI output

flow schedule now prints whether the schedule was activated (or that a dev-branch schedule activates on deploy).

Tests

  • test_client.py::TestSchedulerService — activate (with/without version), list+filter, deactivate hit the correct scheduler. host/method/body.
  • test_flow_service.py — activation happens on production, is skipped on a dev branch, and removal deactivates only the matching registration.
  • Full suite: 4226 passed, 8 skipped (ruff, ruff format, ty, changelog-check all clean). Version bumped 0.66.0 → 0.66.1 with changelog + version-sync; gotcha + commands-reference updated.

Note

I couldn't exercise this against a live stack (no scheduler-service round-trip in unit tests). The endpoint contract (POST/GET/DELETE /schedules, configurationId = the keboola.scheduler config id) should be confirmed against the Scheduler API before/at merge, or via a quick manual flow schedule on a real project.

Link to Devin session: https://app.devin.ai/sessions/b4ab934128864f6d9e4b841e828bcc9e

… the config)

Co-Authored-By: Zora Jelínková <zora.jelinkova@keboola.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot deleted the devin/1783596373-flow-schedule-activation branch July 9, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants