Skip to content

Commit 5bfae7e

Browse files
authored
Merge pull request #483 from Labelbox/al-1677
[AL-1677] Client Get Model Run
2 parents 6804637 + 1463ed5 commit 5bfae7e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

labelbox/client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from labelbox.schema import role
2626
from labelbox.schema.labeling_frontend import LabelingFrontend
2727
from labelbox.schema.model import Model
28+
from labelbox.schema.model_run import ModelRun
2829
from labelbox.schema.ontology import Ontology, Tool, Classification
2930
from labelbox.schema.organization import Organization
3031
from labelbox.schema.user import User
@@ -906,3 +907,15 @@ def create_feature_schema(self, normalized):
906907
# But the features are the same so we just grab the feature schema id
907908
res['id'] = res['normalized']['featureSchemaId']
908909
return Entity.FeatureSchema(self, res)
910+
911+
def get_model_run(self, model_run_id: str) -> ModelRun:
912+
""" Gets a single ModelRun with the given ID.
913+
914+
>>> model_run = client.get_model_run("<model_run_id>")
915+
916+
Args:
917+
model_run_id (str): Unique ID of the ModelRun.
918+
Returns:
919+
A ModelRun object.
920+
"""
921+
return self._get_single(Entity.ModelRun, model_run_id)

tests/integration/annotation_import/test_model_run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def test_model_run(client, configured_project_with_label, rand_gen):
2323
assert model_run_data_row.data_row().uid == next(
2424
next(project.datasets()).data_rows()).uid
2525

26+
fetch_model_run = client.get_model_run(model_run.uid)
27+
assert fetch_model_run == model_run
28+
2629

2730
def test_model_run_delete(client, model_run):
2831
models_before = list(client.get_models())

0 commit comments

Comments
 (0)