Skip to content

5.6 Upgrade Guide

In this document we describe changes to be aware of when upgrading from orchestrator-core v5.5 to v5.6.

About 5.6

This release introduces:

Library upgrades

Behavior changes and fixes

Deprecations

Notable features and refactors

SQLAlchemy 2.1

orchestrator-core now requires SQLAlchemy 2.1. Most applications need no changes, but check the points below and read the SQLAlchemy 2.1 migration guide.

Type annotations

SQLAlchemy 2.1 types Select, Result and Row with PEP 646 variadic generics, so the tuple[...] wrapper is gone. This does not affect runtime behaviour, only static type checking.

# SQLAlchemy 2.0
stmt: Select[tuple[SubscriptionTable]] = select_in_use_by_subscriptions(subscription_id)

# SQLAlchemy 2.1
stmt: Select[SubscriptionTable] = select_in_use_by_subscriptions(subscription_id)

Search your code for Select[tuple[, Result[tuple[ and Row[tuple[ and remove the tuple[...] wrapper. mypy 1.7 or newer is required.

The annotations of these orchestrator-core helpers changed accordingly:

Helper Before Now
services.subscriptions.select_in_use_by_subscriptions Select[tuple[SubscriptionTable]] Select[SubscriptionTable]
services.subscriptions.select_depends_on_subscriptions Select[tuple[SubscriptionTable]] Select[SubscriptionTable]
SubscriptionTable.select_by_product_tag Select[tuple[SubscriptionTable]] Select[SubscriptionTable]
WorkflowTable.select Select Select[WorkflowTable]

Default PostgreSQL driver

A DATABASE_URI without a driver (postgresql://...) now uses psycopg 3 instead of psycopg2. The orchestrator-core default (postgresql+psycopg://...) is unaffected, and psycopg 3 is already a dependency of orchestrator-core. If you override the URI and rely on psycopg2, specify it explicitly: postgresql+psycopg2://....

Other changes

  • Loader strategy classes in sqlalchemy.orm.strategies (e.g. SubqueryLoader) are now private. To check a relationship’s loading strategy, use relationship.lazy instead.
  • Tests that compare compiled SQL strings using postgresql.dialect() now see parameter casts such as %(param)s::VARCHAR. Re-record such snapshots, or compile with an explicit dialect like postgresql.psycopg.dialect().

FastAPI 0.162

orchestrator-core now requires FastAPI 0.162. If your application passes old/unused keyword arguments to OrchestratorCore(), these are forwarded to FastAPI. FastAPI 0.150 has now removed the **extra parameter which means that these arguments will raise a TypeError.

The fix is to remove the arguments from the OrchestratorCore() invocation.

Search in GraphQL

The list resources (subscriptions, processes, products, productBlocks, workflows, resourceTypes) and their relation fields accept a new search argument that runs the AI / Hybrid Search engine. It replaces filterBy, sortBy and query, which are deprecated and cannot be combined with search. first and after are no longer deprecated, and after offset paging works for structured search.

If you have custom GraphQL resolvers or relation fields, see Searching list resources and the orchestrator-core ≥ 5.6 examples to adopt it.

Configurable search export limit

Search has a new export endpoint, POST /api/search/{entity}/export. It takes the same body as the search endpoints and returns all results in one unpaginated response. How many it returns is set by the new SEARCH_MAX_EXPORT_LIMIT setting, which defaults to 1000. The same limit applies to the saved-query exports (GET /api/search/queries/{id}/export and the GraphQL searchQueryExport). Normal search stays capped at 100.

To export more results, raise the limit:

SEARCH_MAX_EXPORT_LIMIT=10000

Scheduler day-of-week fix

The schedule form now reads the day_of_week of a cron expression as crontab does (0 and 7 are Sunday, 1 is Monday) and translates it to APScheduler 3.x, which counts 0 as Monday.

Previously, Sunday-to-Saturday values ran a day early due to a bug in APScheduler 3.x. This is fixed in the next major APScheduler version, but it is unknown when that will be released.

Schedules created through the UI form before 5.6 may therefore run on a different day than intended, please review them.

Scheduler misfire grace time

APScheduler skips a schedule that is picked up more than its misfire_grace_time after its trigger time, which defaults to 1 second. The scheduler starts due schedules one after the other, so when many schedules share a trigger time, for example 30 schedules at 11:00, the first few start and the rest are skipped.

Schedules now accept the optional fields misfire_grace_time (in seconds) and coalesce to tweak this per schedule. See Schedules that share a trigger time for more details.

Test helpers in orchestrator.core.testing

The workflow test helpers (run_workflow, resume_workflow, assert_complete, extract_state, …) and the database, app and test client fixtures now ship with orchestrator-core. Install them with the testing extra:

uv add --dev "orchestrator-core[testing]"

If your orchestrator has a copy of the helpers, usually in test/unit_tests/workflows/__init__.py, replace its imports and delete the copy:

# Before
from test.unit_tests.workflows import assert_complete, extract_state, run_workflow

# After
from orchestrator.core.testing import assert_complete, extract_state, run_workflow

To replace your copy of the database and app fixtures as well, load the plugin in your root conftest.py. See Using the test helpers in your orchestrator.

pytest_plugins = ["orchestrator.core.testing.fixtures"]

Tests generated with orchestrator generate unit-tests now import from orchestrator.core.testing, so the project needs the testing extra to run them.

Deprecated GraphQL arguments

  • The GraphQL arguments filterBy, sortBy and query on the list resources, and filterBy and sortBy on the relation fields, are deprecated in favor of search.