Skip to content

[PLT-1799] Vb/cleanup experimental #1905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libs/labelbox/src/labelbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ def rest_endpoint(self) -> str:
def enable_experimental(self) -> bool:
return self._request_client.enable_experimental

@enable_experimental.setter
def enable_experimental(self, value: bool):
self._request_client.enable_experimental = value

@property
def app_url(self) -> str:
return self._request_client.app_url
Expand Down Expand Up @@ -2026,7 +2030,6 @@ def get_batch(self, project_id: str, batch_id: str) -> Entity.Batch:
get_batch_str,
{"projectId": project_id, "batchId": batch_id},
timeout=180.0,
experimental=True,
)["project"]["batches"]["nodes"][0]

return Entity.Batch(self, project_id, batch)
Expand Down
4 changes: 0 additions & 4 deletions libs/labelbox/src/labelbox/schema/labeling_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ class LabelingService(_CamelCaseMixin):

def __init__(self, **kwargs):
super().__init__(**kwargs)
if not self.client.enable_experimental:
raise RuntimeError(
"Please enable experimental in client to use LabelingService"
)

@classmethod
def start(cls, client, project_id: Cuid) -> "LabelingService":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ class LabelingServiceDashboard(_CamelCaseMixin):

def __init__(self, **kwargs):
super().__init__(**kwargs)
if not self.client.enable_experimental:
raise RuntimeError(
"Please enable experimental in client to use LabelingService"
)

@property
def service_type(self):
Expand Down Expand Up @@ -140,7 +136,7 @@ def get(cls, client, project_id: str) -> "LabelingServiceDashboard":
}}
}}
"""
result = client.execute(query, {"id": project_id}, experimental=True)
result = client.execute(query, {"id": project_id})
if result["getProjectById"] is None:
raise ResourceNotFoundError(
message="The project does not have a labeling service data yet."
Expand Down Expand Up @@ -196,7 +192,6 @@ def convert_to_labeling_service_dashboard(client, data):
dereferencing=["searchProjects", "nodes"],
obj_class=convert_to_labeling_service_dashboard,
cursor_path=["searchProjects", "pageInfo", "endCursor"],
experimental=True,
)

@model_validator(mode="before")
Expand Down
17 changes: 5 additions & 12 deletions libs/labelbox/src/labelbox/schema/model_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
Union,
Tuple,
List,
Optional,
Any,
Tuple,
Union,
)


from labelbox.orm.db_object import DbObject, experimental
from labelbox.orm.model import Field, Relationship, Entity
from labelbox.orm.model import Entity, Field, Relationship
from labelbox.orm.query import results_query_part
from labelbox.pagination import PaginatedCollection
from labelbox.schema.conflict_resolution_strategy import (
ConflictResolutionStrategy,
)
from labelbox.schema.export_params import ModelRunExportParams
from labelbox.schema.export_task import ExportTask
from labelbox.schema.identifiables import GlobalKeys, DataRowIds
from labelbox.schema.identifiables import DataRowIds, GlobalKeys
from labelbox.schema.send_to_annotate_params import (
SendToAnnotateFromModelParams,
build_destination_task_queue_input,
Expand Down Expand Up @@ -458,7 +457,6 @@ def update_status(
experimental=True,
)

@experimental
def update_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
"""
Updates the Model Run's training metadata config
Expand All @@ -474,11 +472,9 @@ def update_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
}
""",
{"modelRunId": self.uid, "data": data},
experimental=True,
)
return res["updateModelRunConfig"]

@experimental
def reset_config(self) -> Dict[str, Any]:
"""
Resets Model Run's training metadata config
Expand All @@ -491,11 +487,9 @@ def reset_config(self) -> Dict[str, Any]:
}
""",
{"modelRunId": self.uid},
experimental=True,
)
return res["resetModelRunConfig"]

@experimental
def get_config(self) -> Dict[str, Any]:
"""
Gets Model Run's training metadata
Expand All @@ -508,7 +502,6 @@ def get_config(self) -> Dict[str, Any]:
}
""",
{"modelRunId": self.uid},
experimental=True,
)
return res["modelRun"]["trainingMetadata"]

Expand Down
17 changes: 7 additions & 10 deletions libs/labelbox/src/labelbox/schema/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from labelbox import utils
from labelbox.orm import query
from labelbox.orm.db_object import DbObject, Deletable, Updateable, experimental
from labelbox.orm.db_object import DbObject, Deletable, Updateable
from labelbox.orm.model import Entity, Field, Relationship
from labelbox.pagination import PaginatedCollection
from labelbox.schema.consensus_settings import ConsensusSettings
Expand Down Expand Up @@ -861,9 +861,9 @@ def create_batches(
},
}

tasks = self.client.execute(mutation_str, params, experimental=True)[
"project"
][method]["tasks"]
tasks = self.client.execute(mutation_str, params)["project"][method][
"tasks"
]
batch_ids = [task["batchUuid"] for task in tasks]
task_ids = [task["taskId"] for task in tasks]

Expand Down Expand Up @@ -926,9 +926,9 @@ def create_batches_from_dataset(
},
}

tasks = self.client.execute(mutation_str, params, experimental=True)[
"project"
][method]["tasks"]
tasks = self.client.execute(mutation_str, params)["project"][method][
"tasks"
]

batch_ids = [task["batchUuid"] for task in tasks]
task_ids = [task["taskId"] for task in tasks]
Expand Down Expand Up @@ -1595,7 +1595,6 @@ def clone(self) -> "Project":
result = self.client.execute(mutation, {"projectId": self.uid})
return self.client.get_project(result["cloneProject"]["id"])

@experimental
def get_labeling_service(self) -> LabelingService:
"""Get the labeling service for this project.

Expand All @@ -1606,7 +1605,6 @@ def get_labeling_service(self) -> LabelingService:
"""
return LabelingService.getOrCreate(self.client, self.uid)

@experimental
def get_labeling_service_status(self) -> LabelingServiceStatus:
"""Get the labeling service status for this project.

Expand All @@ -1618,7 +1616,6 @@ def get_labeling_service_status(self) -> LabelingServiceStatus:
"""
return self.get_labeling_service().status

@experimental
def get_labeling_service_dashboard(self) -> LabelingServiceDashboard:
"""Get the labeling service for this project.

Expand Down
5 changes: 5 additions & 0 deletions libs/labelbox/tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ def test_headers():
assert client.headers["Content-Type"] == "application/json"
assert client.headers["User-Agent"]
assert client.headers["X-Python-Version"]


def test_enable_experimental():
client = Client(api_key="api_key", enable_experimental=True)
assert client.enable_experimental
Loading