Migrating from legacy¶
Existing workflow and clone definitions use the legacy dialect: the
behaviour of today’s resolvers in the workflow manager and the dispatchers.
This package does not implement legacy and does not change it. A workflow
or clone opts in to standard per definition with
settings.placeholder_dialect: "standard"; pipelines always use standard.
What changes when a definition opts in (§11)¶
|
|
|---|---|
A function is recognised only at the start of a string; trailing text is dropped ( |
Functions resolve anywhere ( |
Quoted arguments are resolved again; |
Quoted arguments are text; |
|
|
|
Not part of |
Unknown |
Rejected when the definition is saved |
Time functions use the wall clock |
Date functions take the time to compute from as their last argument ( |
Any field may hold a placeholder |
Not |
|
Keys are restricted to the run’s tenant |
Secrets resolved by the dispatcher, by a regex |
Secrets resolved by the service, or by the dispatcher with |
|
Not available: use |
Function output differences¶
The time functions are reimplemented, not copied. At the same instant they give the same output as the workflow manager’s builtins (a test compares them across DST changes, a year rollover, and a leap February), except:
get_current_datereturns an ISO date string ("2026-05-03"), not adateobject.get_previous_hoursubtracts one elapsed hour. On a DST change the legacy version subtracted wall time and could return an hour that does not exist.str_joinrenders booleans astrue/false(legacy:True/False).
Checking a definition before it opts in¶
Run validate on the definition for syntax and dialect problems, then a dry
run of every task with the run context the workflow manager will build.
Run it in a test or an offline script, not inside a running service. Secrets
are stubbed:
from ds_common_placeholder_py_lib import Context, PlaceholderError, validate
from ds_common_placeholder_py_lib.testing import fake_vault
report = validate(definition)
state = {"current": None, "outputs": {}}
ctx = Context.from_values(
{
"tenant_id": tenant_id,
"run": lambda: run_facts,
"variables": definition["settings"].get("variables", {}),
"job": definition,
},
verbatim=["run", "execution", "tasks"],
)
with fake_vault(default=b"dry-run"): # no real secrets in a dry run
ctx.set("execution", lambda: state["current"])
ctx.set("tasks", lambda: state["outputs"])
for index, task in enumerate(definition["tasks"]):
state["current"] = {"id": task["id"], "name": task["name"], "attempt_no": 1}
try:
ctx.resolve(["job", "tasks", index, "settings"])
except PlaceholderError as err:
report.append(err)
state["outputs"][task["id"]] = {"output": sample_output(task)} # what later tasks read
for error in report:
print(error.code.value, error.path, error.placeholder)
Text that is not a placeholder, such as {{ POSTGRESQL_URI }} or
#/variables/x, passes validation as plain text. Replace it by hand: a
{{ … }} connection string usually becomes a get_secret of a vault path.
Date windows in workflows¶
A standard date function written as in legacy (@{get_start_date_last_month})
computes from the current time, as legacy did. To compute the window for
the time the run is for, not the time the task happens to run, pass it:
@{get_start_date_last_month, UTC, run.logical_at}.