Wallaroo SDK Essentials Guide: Tag Management
Tags are applied to either model versions or pipelines. This allows organizations to track different versions of models, and search for what pipelines have been used for specific purposes such as testing versus production use.
Create Tag
Tags are created with the Wallaroo client command create_tag(String tagname)
. This creates the tag and makes it available for use.
The tag will be saved to the variable currentTag
to be used in the rest of these examples.
# Now we create our tag
currentTag = wl.create_tag("My Great Tag")
List Tags
Tags are listed with the Wallaroo client command list_tags()
, which shows all tags and what models and pipelines they have been assigned to.
# List all tags
wl.list_tags()
id | tag | models | pipelines |
---|---|---|---|
1 | My Great Tag | [('tagtestmodel', ['70169e97-fb7e-4922-82ba-4f5d37e75253'])] | [] |
Wallaroo Pipeline Tag Management
Tags are used with pipelines to track different pipelines that are built or deployed with different features or functions.
Add Tag to Pipeline
Tags are added to a pipeline through the Wallaroo Tag add_to_pipeline(pipeline_id)
method, where pipeline_id
is the pipeline’s integer id.
For this example, we will add currentTag
to testtest_pipeline
, then verify it has been added through the list_tags
command and list_pipelines
command.
# add this tag to the pipeline
currentTag.add_to_pipeline(tagtest_pipeline.id())
{'pipeline_pk_id': 1, 'tag_pk_id': 1}
Search Pipelines by Tag
Pipelines can be searched through the Wallaroo Client search_pipelines(search_term)
method, where search_term
is a string value for tags assigned to the pipelines.
In this example, the text “My Great Tag” that corresponds to currentTag
will be searched for and displayed.
wl.search_pipelines('My Great Tag')
name | version | creation_time | last_updated_time | deployed | tags | steps |
---|---|---|---|---|---|---|
tagtestpipeline | 5a4ff3c7-1a2d-4b0a-ad9f-78941e6f5677 | 2022-29-Nov 17:15:21 | 2022-29-Nov 17:15:21 | (unknown) | My Great Tag |
Remove Tag from Pipeline
Tags are removed from a pipeline with the Wallaroo Tag remove_from_pipeline(pipeline_id)
command, where pipeline_id
is the integer value of the pipeline’s id.
For this example, currentTag
will be removed from tagtest_pipeline
. This will be verified through the list_tags
and search_pipelines
command.
## remove from pipeline
currentTag.remove_from_pipeline(tagtest_pipeline.id())
{'pipeline_pk_id': 1, 'tag_pk_id': 1}
Wallaroo Model Tag Management
Tags are used with models to track differences in model versions.
Assign Tag to a Model
Tags are assigned to a model through the Wallaroo Tag add_to_model(model_id)
command, where model_id
is the model’s numerical ID number. The tag is applied to the most current version of the model.
For this example, the currentTag
will be applied to the tagtest_model
. All tags will then be listed to show it has been assigned to this model.
# add tag to model
currentTag.add_to_model(tagtest_model.id())
{'model_id': 1, 'tag_id': 1}
Search Models by Tag
Model versions can be searched via tags using the Wallaroo Client method search_models(search_term)
, where search_term
is a string value. All models versions containing the tag will be displayed. In this example, we will be using the text from our tag to list all models that have the text from currentTag
in them.
# Search models by tag
wl.search_models('My Great Tag')
name | version | file_name | image_path | last_update_time |
---|---|---|---|---|
tagtestmodel | 70169e97-fb7e-4922-82ba-4f5d37e75253 | ccfraud.onnx | None | 2022-11-29 17:15:21.703465+00:00 |
Remove Tag from Model
Tags are removed from models using the Wallaroo Tag remove_from_model(model_id)
command.
In this example, the currentTag
will be removed from tagtest_model
. A list of all tags will be shown with the list_tags
command, followed by searching the models for the tag to verify it has been removed.
### remove tag from model
currentTag.remove_from_model(tagtest_model.id())
{'model_id': 1, 'tag_id': 1}