v0.19.0 — Project triggers and sub-projects
Start a project when a file arrives, a table changes, a webhook is called or another project ends — and let one project run another — without an external scheduler or message broker.
pip install -U hydra-etlNew features
Project triggers — triggers.yaml
-
A
triggers.yamlfile at the project root, seven types:Type Starts the project when… Parameters received cronthe schedule matches ( cron, IANAtimezone)— intervalevery every— filea file matching path(glob,**) is added or modifiedtrigger.file,trigger.filesmarkera marker file such as inbox/READYappears (removed unlessconsume: false)— source_changea job source changes ( check: count | max | checksum)trigger.value,trigger.previouswebhookPOST …/triggers/{name}/webhookwith a valid tokennone (nothing from the request) after_projectanother project ends ( on: success | failure | any)trigger.project,trigger.status -
Common keys:
env,workflows(default: the thread),params(no secret),overlap(skipby default),timeout,retry: {max, delay},enabled,description. A trigger always runs the project in its own process, under.hydra/run.lock. -
hdrctl watch [PROJECT]... [--env]runs the triggers of one or more projects. It prints each trigger and its next run, then every start and end. -
hdrctl serveruns the same engine for every project of the Studio list. -
hdrctl trigger list | validate | fire <name> | history | token <name> [--rotate].validatechecks workflows, called projects, sources, webhook secrets and refusesafter_projectloops. Every run is recorded in.hydra/triggers/history.jsonl. -
Guarantees:
- a trigger still running is not started again (the missed run is recorded as
skipped); runs missed while the engine was stopped are not replayed; triggers.yamlis reloaded without restart; an invalid file keeps the previous triggers running;- a file is taken only once unchanged for
debounce(no half-copied file); a file arriving during a run starts the next run; - a
source_changemeasure runs apart from the engine (a slow database does not hold up other triggers); on PostgreSQL, MySQL/MariaDB and SQL Servercountandmaxare a singleSELECT COUNT(*)/SELECT MAX(col); - webhook tokens are
${SECRET:…}references, compared in constant time (401 / 404 / 503); keephdrctl serveon 127.0.0.1 unless an HTTPS reverse proxy stands in front; - first Ctrl+C on
hdrctl watchwaits for running projects; a second stops at once.
- a trigger still running is not started again (the missed run is recorded as
-
Cron expressions are parsed by Hydra itself (no extra package);
tzdatais installed on Windows. -
Studio — Project settings › Triggers: triggers with event, environment, next run, running state and last run; a form per type; enable/disable, delete, Run now; create or rotate a webhook token (shown once, with PowerShell and curl calls); run history. An invalid change is not written; the previous file is backed up to
~/.hydra/_backups. -
API:
GET|PUT /api/projects/{id}/triggers,…/triggers/history,POST …/triggers/{name}/fire,…/{name}/webhook,…/{name}/token.
Sub-projects — type: project step
- A workflow of a "master" project runs another project: its
thread.yaml, or only theworkflowslisted. Keys:project(relative path, orref:a Studio project),env(inheritby default),params,variables,workflows,outputs,isolation(inprocessorsubprocess),timeout,overlap(wait,skip,fail). - Nothing is passed implicitly except the environment; the called project keeps its own secrets, and
${SECRET:…}is refused inparamsandvariables. - Checked before anything runs (
hdrctl run,--dry-run,workflow validate, Studio Check): project not found or ambiguous, cycles (a → b → a), more than 5 levels.workflow validateprints the tree of called projects. - Results readable by the next steps:
{{ project:STEP.status }},.rows,.duration,.param.NAME. - A called project runs once at a time (
.hydra/run.lock, also between processes; a stale lock is taken over). hdrctl run <project> -w <workflow>(repeatable): run only these workflows.- Studio — Project node: a Projects section in the palette; a cycle is refused with its path; one window sets path, environment, workflows, parameters, outputs, process, timeout and overlap.
Tools
- VS Code extension 0.1.8 (
type: project) and 0.1.9 (triggers.yaml: the seven types,tokenas a secret reference only, 8 snippets). - MCP:
hydra_project_callsandhydra_project_triggers(read-only). - API:
POST /api/projects/{id}/project-step.
Patches and fixes
- Workflow actions lost the values of
environments/<env>.yamlwhen arequiredparameter was given at run time (-P, orparamsof a project step):{{ param:X }}fell back to the defaults while the jobs of the same run used the environment. hdrctl workflow runrefuses project steps that form a cycle, call a missing project or nest more than 5 levels, before anything runs.- An optional
{{ env:NAME }}or a parameter without value inside a text becomes an empty string instead ofNone. - Parameter errors are in English:
missing required parameter,unresolved parameter,missing environment variable.
Documentation
- White paper (FR/EN): 1.4 Sub-projects and 1.5 Project triggers. README and
03-workflows.mdupdated.
Full changelog: v0.18.0...v0.19.0