Skip to content

Add a job query type for running a file from git - #1974

Open
amritghimire wants to merge 1 commit into
mainfrom
amrit/run_from_git
Open

Add a job query type for running a file from git#1974
amritghimire wants to merge 1 commit into
mainfrom
amrit/run_from_git

Conversation

@amritghimire

Copy link
Copy Markdown
Contributor

Studio clones a repo into the job working directory already, but the code that actually runs still has to be pasted into the job, so it drifts from the repo.

The Studio side adds a FROM_GIT query type where query holds a repo-relative path instead of source, and the worker runs that file straight out of the clone. This enum has to land first: JobFullResponse.from_model in the backend and SaaSJobFull.from_dict in datachain_saas both do JobQueryType(job.query_type), so a value of 3 raises ValueError until the member exists here.

Also fixes something the new member makes reachable. create_job mapped anything that was not "PYTHON" onto SHELL when mirroring a job into the local metastore:

query_type_value = (
    JobQueryType.PYTHON if query_type == "PYTHON" else JobQueryType.SHELL
)

Fine with two members, quietly wrong with three, so it looks the member up by name now. The value is derived from the filename right there in create_job, so this was latent rather than biting anyone yet.

Nothing else in this repo reads the new member.

Studio can already clone a repository into a job's working directory, but the
code it runs still has to be pasted into the job, so it drifts from the repo.
Studio is adding a third query type where a job stores a path inside the repo
instead of the source, and the worker runs that file straight out of the clone.

The enum lives here, and both the Studio backend and its workers call
JobQueryType(job.query_type) on the way to the worker, so the value has to
exist here before any of that works.

While we are here, the CLI mapped anything that was not "PYTHON" onto SHELL
when mirroring a job into the local metastore. That was fine with two members
and quietly wrong with three, so we look the member up by name instead.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 1, 2026

Copy link
Copy Markdown

Deploying datachain with  Cloudflare Pages  Cloudflare Pages

Latest commit: edad8e4
Status: ✅  Deploy successful!
Preview URL: https://7c871af4.datachain-2g6.pages.dev
Branch Preview URL: https://amrit-run-from-git-ui.datachain-2g6.pages.dev

View logs

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@amritghimire amritghimire self-assigned this Sep 1, 2026
@amritghimire
amritghimire requested a review from a team September 1, 2026 15:10

Copilot AI 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.

🟢 Approval recommended

The focused enum and mapping changes are correct and preserve existing behavior.

Pull request overview

Adds FROM_GIT job-query compatibility for Studio and SaaS integrations.

Changes:

  • Adds JobQueryType.FROM_GIT = 3.
  • Replaces binary query-type mapping with enum name lookup.
File summaries
File Description
src/datachain/studio.py Maps query types directly to enum members.
src/datachain/data_storage/job.py Defines the new FROM_GIT query type.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants