Skip to content

Add SnowparkContainerJobOperator#68259

Merged
vincbeck merged 6 commits into
apache:mainfrom
justinpakzad:feature/snowpark-container-job-operator
Jul 6, 2026
Merged

Add SnowparkContainerJobOperator#68259
vincbeck merged 6 commits into
apache:mainfrom
justinpakzad:feature/snowpark-container-job-operator

Conversation

@justinpakzad

@justinpakzad justinpakzad commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Snowpark Container Services lets users run containerized workloads directly within their Snowflake account. Things like ML training jobs, data processing pipelines, or any custom application packaged as a Docker image. Jobs are submitted via EXECUTE JOB SERVICE, which runs containers on a compute pool and terminates once the code exits. Currently there's no operator for orchestrating these jobs. Users would have to fall back to raw SQL via SQLExecuteQueryOperator and manually handle polling, log retrieval, error handling, and service teardown.

This PR adds SnowparkContainerJobOperator which:

  • Submits the job asynchronously via EXECUTE JOB SERVICE
  • Polls DESCRIBE SERVICE until the job reaches a terminal state (DONE, FAILED, etc.)
  • Fetches container logs via SYSTEM$GET_SERVICE_LOGS for all replicas and surfaces them in the Airflow task logs
  • Supports both stage-based specs (spec + spec_stage) and inline YAML (spec_text)
  • Supports fire-and-forget mode (wait_for_completion=False) for long-running jobs as well as other optional parameters (drop_on_completion, replicas, query_warehouse, etc.)

Testing:

  • Unit tests covering parameter validation, SQL generation, polling logic, log retrieval, error handling for unexpected statuses, on_kill cleanup, and execution paths.
  • Manually tested end-to-end against a real Snowflake account with an active compute pool. Verified the success path (job completes, logs retrieved) and failure scenarios (job fails, error logs surfaced, operator raises appropriately). Also tested with various parameters such as replicas, spec_text vs spec/spec_stage, and wait_for_completion variations.

Added an example DAG and operator documentation. Running the example DAG requires some infrastructure to be provisioned beforehand (compute pool, image repository, pushed container image, etc.) those steps are covered in the operator's how-to guide. If approved, I plan on opening a follow-up PR to implement deferrable mode.

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

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Note

✅ Ready for review · @justinpakzad@potiuk · 2026-06-22 06:34 UTC

Thanks @justinpakzad — the earlier triage items look addressed and this PR is now ready for review. The ball is back with the maintainers; a maintainer will take the next look.

Automated triage — may be imperfect.

@boring-cyborg boring-cyborg Bot added area:providers kind:documentation provider:snowflake Issues related to Snowflake provider labels Jun 9, 2026
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch 4 times, most recently from 6af3932 to 263af72 Compare June 10, 2026 22:03
@justinpakzad
justinpakzad marked this pull request as ready for review June 10, 2026 22:03
@justinpakzad
justinpakzad requested a review from potiuk as a code owner June 10, 2026 22:03
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from 263af72 to 780214e Compare June 10, 2026 23:06
@justinpakzad

Copy link
Copy Markdown
Contributor Author

Could I get a re-trigger of the failed check please? Seems there was an error building the image. Thanks.

@justinpakzad

Copy link
Copy Markdown
Contributor Author

Here are a couple of screenshots that show a successful run and a failed run against my Snowflake instance. Happy to provide more if needed.

Screenshot 2026-06-13 at 16 50 05 Screenshot 2026-06-13 at 16 51 42

@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch 2 times, most recently from f47975f to 8ce457d Compare June 17, 2026 13:26
@potiuk
potiuk marked this pull request as draft June 17, 2026 14:14
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from 8ce457d to 98c53cc Compare June 17, 2026 21:14
@justinpakzad
justinpakzad marked this pull request as ready for review June 17, 2026 21:14
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from 98c53cc to c80c220 Compare June 17, 2026 21:40

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good PR. I have left some comments.

Comment thread providers/snowflake/docs/operators/snowpark_containers.rst Outdated
Comment thread providers/snowflake/tests/unit/snowflake/operators/test_snowpark_containers.py Outdated
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from c80c220 to 494b09a Compare June 19, 2026 00:03
@justinpakzad

Copy link
Copy Markdown
Contributor Author

Good PR. I have left some comments.

I appreciate the detailed review. I addressed all of your feedback. I left one comment unresolved so you can see my response to your first question but your second point was addressed.

@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from 494b09a to 46e5a72 Compare June 19, 2026 11:42
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 22, 2026
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from 46e5a72 to d427404 Compare June 22, 2026 21:05
@justinpakzad

Copy link
Copy Markdown
Contributor Author

Would appreciate a review on this. Thanks.

@justinpakzad

Copy link
Copy Markdown
Contributor Author

@potiuk would you mind taking a look at this when you have a moment. Thanks.

@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from d427404 to 1238daf Compare July 3, 2026 17:22
@justinpakzad
justinpakzad force-pushed the feature/snowpark-container-job-operator branch from 1238daf to 107aa0d Compare July 3, 2026 21:34
@vincbeck
vincbeck merged commit c8d8908 into apache:main Jul 6, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers kind:documentation provider:snowflake Issues related to Snowflake provider ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants