Open aguschin opened 1 year ago
If we try to generalize a bit:
Input: revision, [artifact name] optionally, [version or stage] optionally Output: artifact version or stage
I like that the artifact name is optional. Because all I need is the revision, and navigate the git repo to that revision to find the artifact (e.g. a model) version in the dvc.lock file.
$ gto find HEAD nn --version v0.0.1 $ gto find HEAD nn --stage dev $ gto find HEAD nn v0.0.1 in dev $ gto find HEAD nn v0.0.1 in dev mymodel v1.2.3 in stage and prod
Having the v0.0.1 in dev
is nice, but in my view, I'd aim towards getting the tag itself, with the option to exclude certain parts such as --stage
. E.g.:
$ gto find HEAD nn --tag --version --exclude-stage
mymodel@v0.0.1
That would give me a clean model name to save to the database. And it makes it easy to find the model code with the tag, regardless of its stage - which from what I understand, stages don't map to different versions of the model, code and data; they just tell you "where" they have been deployed to.
@aguschin that was a late reply, my bad! Right now I am using a mix of coolname
and git rev-parse HEAD
to register models to the database, but I'd rather have it coordinated with gto and its tag naming scheme!
Ok, I think I came up with a decent way to include this in gto show
instead of adding a new command. Please see the example (after your case there is also another part of extending show
with a similar logic - good for generalization ๐ ).
Please let me know what do you think)
$ git clone https://github.com/iterative/example-gto
$ cd example-gto
$ gto show
โโโโโโโโโโโโคโโโโโโโโโโโคโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโ
โ name โ latest โ #dev โ #prod โ #staging โ
โโโโโโโโโโโโชโโโโโโโโโโโชโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโก
โ churn โ v3.1.1 โ v3.1.1 โ v3.0.0 โ v3.1.0 โ
โ cv-class โ v0.1.13 โ - โ - โ - โ
โ segment โ v0.4.1 โ v0.4.1 โ - โ - โ
โโโโโโโโโโโโงโโโโโโโโโโโงโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโ
$ gto show nn:HEAD # show versions for nn in HEAD
โโโโโโโโโโโโโโคโโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโ
โ artifact โ version โ stage โ created_at โ ref โ
โโโโโโโโโโโโโโชโโโโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโก
โ churn โ v3.1.0 โ staging โ 2022-11-20 09:36:38 โ churn@v3.1.0 โ
โโโโโโโโโโโโโโงโโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโ
$ gto show nn:HEAD --ref
churn@v3.1.0
$ gto show :HEAD # show all artifacts that have versions/assignments in HEAD
โโโโโโโโโโโโโโคโโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโ
โ artifact โ version โ stage โ created_at โ ref โ
โโโโโโโโโโโโโโชโโโโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโก
โ churn โ v3.1.0 โ staging โ 2022-11-20 09:36:38 โ churn@v3.1.0 โ
โโโโโโโโโโโโโโงโโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโ
$ gto show @v3.1.0 # show all v3.1.0 versions for all artifacts
โโโโโโโโโโโโโโคโโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโ
โ artifact โ version โ stage โ created_at โ ref โ
โโโโโโโโโโโโโโชโโโโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโก
โ churn โ v3.1.0 โ staging โ 2022-11-20 09:36:38 โ churn@v3.1.0 โ
โโโโโโโโโโโโโโงโโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโ
$ gto show "#staging" # show all versions in staging for all artifacts
โโโโโโโโโโโโโโคโโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโ
โ artifact โ version โ stage โ created_at โ ref โ
โโโโโโโโโโโโโโชโโโโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโก
โ churn โ v3.1.0 โ staging โ 2022-11-20 09:36:38 โ churn@v3.1.0 โ
โโโโโโโโโโโโโโงโโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโ
$ gto show --long # alternative way to show the registry
โโโโโโโโโโโโโโคโโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโ
โ artifact โ version โ stage โ created_at โ ref โ
โโโโโโโโโโโโโโชโโโโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโก
โ churn โ v3.1.1 โ dev โ 2022-11-27 08:16:38 โ churn@v3.1.1 โ
โ churn โ v3.1.0 โ staging โ 2022-11-20 09:36:38 โ churn@v3.1.0 โ
โ churn โ v3.0.0 โ prod โ 2022-11-15 18:29:58 โ churn@v3.0.0 โ
โ cv-class โ v0.1.13 โ โ 2022-11-18 02:03:18 โ cv-class@v0.1.13 โ
โ cv-class โ 793ff78 โ โ 2022-11-19 05:49:58 โ 793ff78 โ
โ segment โ v0.4.1 โ dev โ 2022-11-16 22:16:38 โ segment@v0.4.1 โ
โ segment โ 793ff78 โ โ 2022-11-19 05:49:58 โ 793ff78 โ
โโโโโโโโโโโโโโงโโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโโโ
For the record, this design doesn't allow to get Git tags that assigned stages in HEAD (all or for a specific artifact), but that's not required currently and can be ignored I assume.
For the record, this design doesn't allow to get Git tags that assigned stages in HEAD (all or for a specific artifact), but that's not required currently and can be ignored I assume.
Well it is good enough for my use case: I only need a gto controlled version-tag so that it matches predictions I am saving in the database with the tags in the git repository.
So, on my end, I'd say this is a good addition for me already ๐
@aguschin hey, I would like to request to have this accesible from Python, if possible :D
From discord:
Now it can be achieved with something like:
We can add a command to GTO, but I need to better understand how it should work first.
Specifically for this case:
If we try to generalize a bit:
Then it can look like
WDYT? Maybe there are some simpler options or this can be included in existing commands (like
gto show
orgto check-ref
?)