moomindani opened a new pull request, #72505: URL: https://github.com/apache/airflow/pull/72505
`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? - [X] Yes — Claude Code (Opus 5) Generated-by: Claude Code (Opus 5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
