Skip to content

Commit 2477e72

Browse files
authored
Merge branch 'main' into main-cml-pr-37b8a4fe
2 parents 2e1f743 + 73c81d8 commit 2477e72

File tree

35 files changed

+1443
-20
lines changed

35 files changed

+1443
-20
lines changed

packages/example/content/docs/examples.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,14 @@ To push the changes upstream, run:
8585
git push origin cv-class#dev#1 #this is a comment
8686
#This is a comment
8787
```
88+
89+
## Highlight --options-with-hypthen
90+
91+
```cli
92+
$ cml runner launch \
93+
--cloud=aws \
94+
--cloud-region=us-west \
95+
--cloud-type=m+t4 \
96+
--cloud-permission-set=arn:aws:iam::1234567890:instance-profile/dvc-s3-access \
97+
--labels=cml-gpu
98+
```
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# annotate
2+
3+
Update artifact metadata annotations.
4+
5+
## Synopsis
6+
7+
```usage
8+
usage: gto annotate [-r <text>] [--type <text>] [--path <text>]
9+
[-e] [--label <text>] [-d <text>] [--commit]
10+
[--push] [-h]
11+
name
12+
13+
arguments:
14+
name Artifact name
15+
```
16+
17+
## Description
18+
19+
The command adds the artifact annotation to `artifacts.yaml` file. Feel free to
20+
modify the file directly!
21+
22+
For example,
23+
24+
```cli
25+
$ gto annotate awesome-model \
26+
--type model \
27+
--path models/neural_network.h5 \
28+
--label ml
29+
--label cool
30+
--description "This model is very cool"
31+
```
32+
33+
will create
34+
35+
```yaml
36+
awesome-model:
37+
description: This model is very cool
38+
labels:
39+
- ml
40+
- cool
41+
path: models/neural_network.h5
42+
type: model
43+
```
44+
45+
This information can be later retrieved by running `gto describe` command.
46+
47+
> Don't forget to commit `artifacts.yaml` with Git to associate it with the
48+
> latest artifact version and stage in any copy of the repo.
49+
50+
By default GTO saves artifact as `virtual`. Use the `--must_exist` flag to tell
51+
GTO the artifact file is committed to Git.
52+
53+
<details>
54+
55+
### Virtual vs. Physical artifacts
56+
57+
- Physical files/directories are committed to the repo. When you create a new
58+
version or assign a stage to it, Git guarantees that it's immutable -- you can
59+
return a year later and get the same artifact by providing a version.
60+
61+
- Virtual artifacts could be an external path (e.g. `s3://mybucket/myfile`) or a
62+
local path to a metafile representing an externally stored artifact file (as
63+
[with DVC](https://dvc.org/doc/start/data-management)). In this case, GTO
64+
can't pin versions to a physical state of the artifact and guarantee its
65+
immutability later, e.g. if `s3://mybucket/myfile` changes the registry won't
66+
know it, nor have a way to recover the original file.
67+
68+
> In future versions, we will support additional enrichments: useful information
69+
> that other tools like [DVC](https://dvc.org/) and [MLEM](https://mlem.ai/) can
70+
> provide about the artifacts. This will allow treating DVC repo outputs as
71+
> usual artifacts instead of `virtual` ones.
72+
73+
</details>
74+
75+
## Options
76+
77+
- `-r <text>`, `--repo <text>` - Local or remote repository [default: .]
78+
- `--type <text>` - Artifact type
79+
- `--path <text>` - Artifact path
80+
- `-e`, `--must-exist` - Verify artifact is committed to Git
81+
- `--label <text>` - Labels to add to artifact
82+
- `-d <text>`, `--description <text>` - Artifact description
83+
- `--commit` - Automatically commit changes due to this command (experimental)
84+
- `--push` - Push created commit automatically (experimental) - will set
85+
commit=True
86+
- `-h`, `--help` - Show this message and exit.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# assign
2+
3+
Assign stage to specific artifact version.
4+
5+
## Synopsis
6+
7+
```usage
8+
usage: gto assign [-r <text>] [--version <text>]
9+
[--stage <text>] [-m <text>]
10+
[--simple <text>] [--force] [--push] [--sr]
11+
[-h]
12+
name [ref]
13+
14+
arguments:
15+
name Artifact name
16+
[ref] Git reference to use
17+
```
18+
19+
## Description
20+
21+
To assign an actionable stage for a specific artifact version use the same
22+
`gto assign` command. Stages can mark the artifact readiness for a specific
23+
consumer. You can plug in a real downsteam system via CI/CD or web hooks, e.g.
24+
to redeploy an ML model.
25+
26+
```cli
27+
$ gto assign awesome-model --version v0.0.1 --stage prod
28+
Created git tag 'awesome-model#prod#1' that assigns stage to 'v0.0.1'
29+
```
30+
31+
GTO creates a special Git tag in
32+
[the standard format](/doc/gto/user-guide/git-tags).
33+
34+
## Options
35+
36+
- `-r <text>`, `--repo <text>` - Local or remote repository [default: .]
37+
- `--version <text>` - If you provide REF, this will be used to name new version
38+
- `--stage <text>` - Stage to assign
39+
- `-m <text>`, `--message <text>` - Message to annotate the Git tag with
40+
- `--simple <text>` - Use simple notation, e.g. `rf#prod` instead of `rf#prod-5`
41+
[supported values: auto, true, false] [default: auto]
42+
- `--force` - Create the Git tag even if it already exists and is in effect
43+
- `--push` - Push created tag automatically (experimental)
44+
- `--sr`, `--skip-registration` - Don't register a version at specified commit
45+
- `-h`, `--help` - Show this message and exit.
46+
47+
## Examples
48+
49+
Assign artifact "nn" to "prod" at specific Git ref instead of supplying artifact
50+
version (note that this will also register a version if it doesn't exist):
51+
52+
```cli
53+
$ gto assign nn abcd123 --stage prod
54+
```
55+
56+
Assign stage at specific Git ref and name the version explicitly (this assumes
57+
that version was not registered yet):
58+
59+
```cli
60+
$ gto assign nn abcd123 --version v1.0.0 --stage prod
61+
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# check-ref
2+
3+
Find out the artifact version registered/assigned with ref.
4+
5+
## Synopsis
6+
7+
```usage
8+
usage: gto check-ref [-r <text>] [--json] [--name] [--version]
9+
[--event] [--stage] [-h]
10+
ref
11+
12+
arguments:
13+
ref Git reference to analyze
14+
```
15+
16+
## Description
17+
18+
You can use `gto check-ref` to interpret a Git tag:
19+
20+
```cli
21+
$ gto check-ref -r build/example-gto churn#prod#3
22+
✅ Stage "prod" was assigned to version "v3.0.0" of artifact "churn"
23+
```
24+
25+
For machine-consumable format, use `--json` flag or output specific pieces of
26+
information with `--name`, `--version`, `--stage` or `--event`.
27+
28+
## Options
29+
30+
- `-r <text>`, `--repo <text>` - Local or remote repository [default: .]
31+
- `--json` - Print output in json format
32+
- `--name` - Show artifact name
33+
- `--version` - Output artifact version
34+
- `--event` - Show event
35+
- `--stage` - Show artifact stage
36+
- `-h`, `--help` - Show this message and exit.
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# deprecate
2+
3+
Deprecate artifact, deregister a version, or unassign a stage.
4+
5+
## Synopsis
6+
7+
```usage
8+
usage: gto deprecate [-r <text>] [-m <text>] [--simple <text>]
9+
[--force] [-d] [--push] [-h]
10+
name [version] [stage]
11+
12+
arguments:
13+
name Artifact name
14+
[version] Artifact version
15+
[stage] Stage to unassign
16+
```
17+
18+
## Description
19+
20+
The command supports three use cases:
21+
22+
```cli
23+
# deprecate an artifact:
24+
$ gto deprecate nn
25+
26+
# deprecate a version:
27+
$ gto deprecate nn v0.0.1
28+
29+
# unassign a stage:
30+
$ gto deprecate nn v0.0.1 prod
31+
```
32+
33+
### Unassigning a stage
34+
35+
Sometimes you need to mark an artifact version no longer ready for a specific
36+
consumer, and maybe signal a downstream system about this. You can use
37+
`gto deprecate` for that:
38+
39+
```cli
40+
$ gto deprecate awesome-model v0.0.1 prod
41+
Created git tag 'awesome-model#prod!#2' that unassigns a stage from 'v0.0.1'
42+
```
43+
44+
<details>
45+
46+
### Unassigning a stage: some details and options
47+
48+
GTO creates a special Git tag in
49+
[the standard format](/doc/gto/user-guide/git-tags).
50+
51+
Note, that later you can create this stage again, if you need to, by calling
52+
`$ gto assign` again.
53+
54+
You also may want to delete the git tag instead of creating a new one. This is
55+
useful if you don't want to keep extra tags in you Git repo, don't need history
56+
and don't want to trigger a CI/CD or another downstream system. For that, you
57+
can use:
58+
59+
```cli
60+
$ gto deprecate awesome-model v0.0.1 prod --delete
61+
Deleted git tag 'awesome-model#prod#1' that assigned a stage to 'v0.0.1'
62+
To push the changes upstream, run:
63+
git push origin awesome-model#prod#1 --delete
64+
```
65+
66+
</details>
67+
68+
### Deregister a version
69+
70+
Sometimes you need mark a specific artifact version as a no longer ready for
71+
usage. You could just delete a git tag, but if you want to preserve a history of
72+
the actions, you may again use `gto deprecate`.
73+
74+
```cli
75+
$ gto deprecate awesome-model v0.0.1
76+
Created git tag 'awesome-model@v0.0.1!' that deregistered a version.
77+
```
78+
79+
<details>
80+
81+
### Deregister a version: some details and options
82+
83+
If you want to deregister the version by deleting the Git tags itself, you could
84+
use
85+
86+
```cli
87+
$ gto deprecate awesome-model v0.0.1 --delete
88+
Deleted git tag 'awesome-model@v0.0.1' that registered a version.
89+
Deleted git tag 'awesome-model#prod#1' that assigned a stage to 'v0.0.1'.
90+
Deleted git tag 'awesome-model#prod!#2' that unassigned a stage to 'v0.0.1'.
91+
To push the changes upstream, run:
92+
git push origin awesome-model@v0.0.1 awesome-model#prod#1 awesome-model#prod!#2 --delete
93+
```
94+
95+
This includes all Git tags related to the version: a tag that registered it and
96+
all tags that assigned stages to it.
97+
98+
</details>
99+
100+
### Deprecating an artifact
101+
102+
Sometimes you need to need to mark the artifact as "deprecated", usually meaning
103+
it's outdated and will no longer be developed. To do this, you could run:
104+
105+
```cli
106+
$ gto deprecate awesome-model
107+
Created Git tag 'awesome-model@deprecated' that deprecates an artifact.
108+
```
109+
110+
<details>
111+
112+
### Deprecating an artifact: some details and options
113+
114+
With `awesome-model@deprecated` Git tag the artifact will be considered
115+
deprecated until you register a new version or assign a new stage to it after
116+
the deprecation.
117+
118+
If you want to deprecate an artifact by deleting git tags, you'll need to delete
119+
all of them for the artifact. You could do that with
120+
121+
```cli
122+
$ gto deprecate awesome-model --delete
123+
Deleted git tag 'awesome-model@v0.0.1' that registered a version.
124+
Deleted git tag 'awesome-model#prod#1' that assigned a stage to 'v0.0.1'.
125+
Deleted git tag 'awesome-model#prod!#2' that unassigned a stage to 'v0.0.1'.
126+
To push the changes upstream, run:
127+
git push origin awesome-model@v0.0.1 awesome-model#prod#1 awesome-model#prod!#2 --delete
128+
```
129+
130+
</details>
131+
132+
## Options
133+
134+
- `-r <text>`, `--repo <text>` - Local or remote repository [default: .]
135+
- `-m <text>`, `--message <text>` - Message to annotate the Git tag with
136+
- `--simple <text>` - Use simple notation, e.g. `rf#prod` instead of `rf#prod-5`
137+
[supported values: auto, true, false] [default: auto]
138+
- `--force` - Create the Git tag even if it already exists and is in effect
139+
- `-d`, `--delete` - Delete the git tag(s) instead of creating the new one
140+
- `--push` - Push created tag automatically (experimental)
141+
- `-h`, `--help` - Show this message and exit.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# describe
2+
3+
Display enrichments for an artifact.
4+
5+
## Synopsis
6+
7+
```usage
8+
usage: gto describe [-r <text>] [--rev <text>] [--type] [--path]
9+
[--description] [-h]
10+
name
11+
12+
arguments:
13+
name Artifact name
14+
```
15+
16+
## Description
17+
18+
To get details about an artifact (from `artifacts.yaml`) use `gto describe`:
19+
20+
```cli
21+
$ gto describe churn -r https://github.com/iterative/example-gto
22+
{
23+
"type": "model",
24+
"path": "models/churn.pkl",
25+
"virtual": false
26+
}
27+
```
28+
29+
The output is in JSON format for ease of parsing programatically.
30+
31+
## Options
32+
33+
- `-r <text>`, `--repo <text>` - Local or remote repository [default: .]
34+
- `--rev <text>` - Repo revision to use
35+
- `--type` - Show type
36+
- `--path` - Show path
37+
- `--description` - Show description
38+
- `-h`, `--help` - Show this message and exit.

0 commit comments

Comments
 (0)