Skip to content

Commit

Permalink
new specs with correct v3 (#1426)
Browse files Browse the repository at this point in the history
regenerate the specs with latest v3 config
  • Loading branch information
japrescott authored Nov 22, 2023
1 parent 514ffd7 commit 6a9d625
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 379 deletions.
24 changes: 12 additions & 12 deletions lightly/api/api_workflow_compute_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
DockerWorkerConfigV3Lightly,
DockerWorkerRegistryEntryData,
DockerWorkerType,
SelectionConfig,
SelectionConfigEntry,
SelectionConfigEntryInput,
SelectionConfigEntryStrategy,
SelectionConfigV3,
SelectionConfigV3Entry,
SelectionConfigV3EntryInput,
SelectionConfigV3EntryStrategy,
TagData,
)
from lightly.openapi_generated.swagger_client.rest import ApiException
Expand Down Expand Up @@ -175,7 +175,7 @@ def create_compute_worker_config(
self,
worker_config: Optional[Dict[str, Any]] = None,
lightly_config: Optional[Dict[str, Any]] = None,
selection_config: Optional[Union[Dict[str, Any], SelectionConfig]] = None,
selection_config: Optional[Union[Dict[str, Any], SelectionConfigV3]] = None,
) -> str:
"""Creates a new configuration for a Lightly Worker run.
Expand Down Expand Up @@ -269,7 +269,7 @@ def schedule_compute_worker_run(
self,
worker_config: Optional[Dict[str, Any]] = None,
lightly_config: Optional[Dict[str, Any]] = None,
selection_config: Optional[Union[Dict[str, Any], SelectionConfig]] = None,
selection_config: Optional[Union[Dict[str, Any], SelectionConfigV3]] = None,
priority: str = DockerRunScheduledPriority.MID,
runs_on: Optional[List[str]] = None,
) -> str:
Expand Down Expand Up @@ -634,17 +634,17 @@ def get_compute_worker_run_tags(self, run_id: str) -> List[TagData]:
return tags_in_dataset


def selection_config_from_dict(cfg: Dict[str, Any]) -> SelectionConfig:
"""Recursively converts selection config from dict to a SelectionConfig instance."""
def selection_config_from_dict(cfg: Dict[str, Any]) -> SelectionConfigV3:
"""Recursively converts selection config from dict to a SelectionConfigV3 instance."""
strategies = []
for entry in cfg.get("strategies", []):
new_entry = copy.deepcopy(entry)
new_entry["input"] = SelectionConfigEntryInput(**entry["input"])
new_entry["strategy"] = SelectionConfigEntryStrategy(**entry["strategy"])
strategies.append(SelectionConfigEntry(**new_entry))
new_entry["input"] = SelectionConfigV3EntryInput(**entry["input"])
new_entry["strategy"] = SelectionConfigV3EntryStrategy(**entry["strategy"])
strategies.append(SelectionConfigV3Entry(**new_entry))
new_cfg = copy.deepcopy(cfg)
new_cfg["strategies"] = strategies
return SelectionConfig(**new_cfg)
return SelectionConfigV3(**new_cfg)


_T = TypeVar("_T")
Expand Down
1 change: 1 addition & 0 deletions lightly/openapi_generated/swagger_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
from lightly.openapi_generated.swagger_client.models.selection_input_type import SelectionInputType
from lightly.openapi_generated.swagger_client.models.selection_strategy_threshold_operation import SelectionStrategyThresholdOperation
from lightly.openapi_generated.swagger_client.models.selection_strategy_type import SelectionStrategyType
from lightly.openapi_generated.swagger_client.models.selection_strategy_type_v3 import SelectionStrategyTypeV3
from lightly.openapi_generated.swagger_client.models.service_account_basic_data import ServiceAccountBasicData
from lightly.openapi_generated.swagger_client.models.set_embeddings_is_processed_flag_by_id_body_request import SetEmbeddingsIsProcessedFlagByIdBodyRequest
from lightly.openapi_generated.swagger_client.models.shared_access_config_create_request import SharedAccessConfigCreateRequest
Expand Down
22 changes: 0 additions & 22 deletions lightly/openapi_generated/swagger_client/api/__init__.py-e

This file was deleted.

Loading

0 comments on commit 6a9d625

Please sign in to comment.