Skip to content

Add environments and trigger named parameters to Databricks operators - #72505

Merged
eladkal merged 1 commit into
apache:mainfrom
moomindani:add-databricks-environments-trigger-params
Sep 19, 2026
Merged

eladkal merged 1 commit into
apache:mainfrom
moomindani:add-databricks-environments-trigger-params

Conversation

@moomindani

Copy link
Copy Markdown
Contributor

api/2.2/jobs/create and api/2.2/jobs/runs/submit both take a top-level environments field, and create also takes trigger. Neither had a named parameter on the operators, so a job that uses serverless task dependencies or an event-driven trigger had to be hand-written into json — and the operator signature, which the docs describe as having "exactly one named parameter for each top level parameter", no longer showed that those fields exist at all.

  • DatabricksCreateJobsOperator: adds environments and trigger
  • DatabricksSubmitRunOperator: adds environments (runs/submit has no trigger; a trigger is job-level)

Both are in template_fields, so a rendered value can be built from the Dag context — e.g. a file_arrival URL or a pinned dependency version per run — and both follow the existing merge rule, overriding the same key in json.

This is reach the payload already had, so the change is discoverability and typing rather than new capability. I checked that first: normalise_json_content stringifies ints, and the API accepts trigger.periodic.interval as either an int or a string and returns it as an int, so json= was never actually blocked here.

Verified against a live workspace, through the operators and the real hook, reading the result back with the CLI rather than the code under test:

  • jobs/create with environments + trigger — accepted, and jobs/get returns both byte for byte, including spec.environment_version and the int-valued min_time_between_triggers_seconds / periodic.interval. Checked with trigger.file_arrival and trigger.periodic.
  • runs/submit with environments — accepted. Submitting the same task without environments is rejected with Job environment 'serverless_default' used by task probe is not defined in field 'environments', which is what shows the field is genuinely consumed by the API and not quietly dropped.
  • One fixture note from that run: a file_arrival.url must end in / and must resolve to a UC volume — a raw s3:// URL that overlaps an existing volume or table is refused — so the unit-test fixtures use a /Volumes/... URL.

All six new unit tests fail without the change. Removing only the two template_fields entries, keeping the named parameters, fails exactly the two templating tests and leaves the four merge tests green, so the tests separate the two halves of the change. The provider's unit suite is 929 passed / 12 skipped, and mypy is clean on the changed file.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

Serverless task dependencies and event-driven triggers are how Databricks jobs are
written today, but reaching either from Airflow meant hand-building the raw payload
in ``json`` — the two fields were the only mainstream top-level ones without a named
parameter, so the operator signature no longer showed what a job can be given.
@moomindani

Copy link
Copy Markdown
Contributor Author

@eladkal could you take a look when you have a moment, or point it at whoever is better placed?

It adds environments and trigger named parameters to the job operators — the two mainstream top-level fields of jobs/create that had none, so serverless task environments and event-driven triggers had to be hand-written into json. Green, and verified against a live workspace.


Drafted-by: Claude Code (Opus 5); reviewed by @moomindani before posting

@moomindani

Copy link
Copy Markdown
Contributor Author

@eladkal could you take a look at this one? It is the only one left from the 09-06 batch — the other three merged on 09-09.

It adds the environments and trigger named parameters to the job operators. Still green, and current main merges into it cleanly (259 operator tests pass on the merged tree).


Drafted-by: Claude Code (Opus 5); reviewed by @moomindani before posting

@eladkal
eladkal merged commit 985e500 into apache:main Sep 19, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants