iterative / gto

🏷️ Git Tag Ops. Turn your Git repository into Artifact Registry or Model Registry.
https://dvc.org/doc/gto
Apache License 2.0
140 stars 16 forks source link

Story: cli command to get the reference to the current stage #357

Closed francesco086 closed 1 year ago

francesco086 commented 1 year ago

Summary / Background

I have an artifact registry built with git + dvc + gto. In a pipeline, I would like to get the reference to the current prod stage of that registry, so that I can get the artifact I need. The only way I found to achieve this is:

gto history --repo REPO_URL --json ARTIFACT_NAME | jq '[.[] | select(.stage == "prod") | {commit: .commit, version: (.version)}] | sort_by(.version) | .[-1].commit'

This is quite cumbersome. It would be more convenient to have a dedicated command.

Scope

Assumptions

Open Questions

aguschin commented 1 year ago

@francesco086, I think you're looking for:

$ gto show -r http://github.com/iterative/example-gto churn#prod --ref
churn@v3.0.0

Also getting latest is possible

$ gto show -r http://github.com/iterative/example-gto churn@latest --ref
churn@v3.1.1

Am I correct?

In a pipeline, I would like to get the reference to the current prod stage of that registry, so that I can get the artifact I need.

Curious to learn more details about the use case. Do you have a cron job in your repo that deploys daily/weekly? Or it is something else?

francesco086 commented 1 year ago

Thanks @aguschin, I suspected I was missing something :(

Yes, you got the use case :) I have an experiment registry, from which every week I take the prod experiment, look at the model used, and train it with the freshest data.

aguschin commented 1 year ago

Cool, thanks. Helpful to know how you use it!

francesco086 commented 1 year ago

@aguschin in few month I think I will reach out you or Jennifer or whoever you think is best at iterative, perhaps it could be useful if I share what I have done ;)