Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
6 changes: 3 additions & 3 deletions packages/models-library/src/models_library/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def from_key(cls, key: str) -> "DockerLabelKey":
_UNDEFINED_LABEL_VALUE_INT: Final[str] = "0"


DOCKER_TASK_EC2_INSTANCE_TYPE_PLACEMENT_CONSTRAINT_KEY: Final[
DockerLabelKey
] = TypeAdapter(DockerLabelKey).validate_python("ec2-instance-type")
DOCKER_TASK_EC2_INSTANCE_TYPE_PLACEMENT_CONSTRAINT_KEY: Final[DockerLabelKey] = (
TypeAdapter(DockerLabelKey).validate_python("ec2-instance-type")
)


def to_simcore_runtime_docker_label_key(key: str) -> DockerLabelKey:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def _update_paths_mappings(
)
env_vars["DY_SIDECAR_PATH_INPUTS"] = f"{path_mappings.inputs_path}"
env_vars["DY_SIDECAR_PATH_OUTPUTS"] = f"{path_mappings.outputs_path}"
env_vars[
"DY_SIDECAR_STATE_PATHS"
] = f"{json_dumps( { f'{p}' for p in path_mappings.state_paths } )}"
env_vars["DY_SIDECAR_STATE_PATHS"] = (
f"{json_dumps( { f'{p}' for p in path_mappings.state_paths } )}"
)

service_content["environment"] = _EnvironmentSection.export_as_list(env_vars)

Expand Down Expand Up @@ -241,15 +241,17 @@ def _update_container_labels(
spec_service_key, default_limits
)

label_keys = StandardSimcoreDockerLabels.model_construct(
user_id=user_id,
project_id=project_id,
node_id=node_id,
simcore_user_agent=simcore_user_agent,
product_name=product_name,
swarm_stack_name=swarm_stack_name,
memory_limit=ByteSize(container_limits["memory"]),
cpu_limit=container_limits["cpu"],
label_keys = StandardSimcoreDockerLabels.model_validate(
{
"user_id": user_id,
"project_id": project_id,
"node_id": node_id,
"simcore_user_agent": simcore_user_agent,
"product_name": product_name,
"swarm_stack_name": swarm_stack_name,
"memory_limit": ByteSize(container_limits["memory"]),
"cpu_limit": container_limits["cpu"],
}
)
docker_labels = [
f"{k}={v}" for k, v in label_keys.to_simcore_runtime_docker_labels().items()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,19 @@ def compute_task_labels(
ValidationError
"""
product_name = run_metadata.get("product_name", UNDEFINED_DOCKER_LABEL)
standard_simcore_labels = StandardSimcoreDockerLabels.model_construct(
user_id=user_id,
project_id=project_id,
node_id=node_id,
product_name=product_name,
simcore_user_agent=run_metadata.get(
"simcore_user_agent", UNDEFINED_DOCKER_LABEL
),
swarm_stack_name=UNDEFINED_DOCKER_LABEL, # NOTE: there is currently no need for this label in the comp backend
memory_limit=node_requirements.ram,
cpu_limit=node_requirements.cpu,
standard_simcore_labels = StandardSimcoreDockerLabels.model_validate(
{
"user_id": user_id,
"project_id": project_id,
"node_id": node_id,
"product_name": product_name,
"simcore_user_agent": run_metadata.get(
"simcore_user_agent", UNDEFINED_DOCKER_LABEL
),
"swarm_stack_name": UNDEFINED_DOCKER_LABEL, # NOTE: there is currently no need for this label in the comp backend
"memory_limit": node_requirements.ram,
"cpu_limit": node_requirements.cpu,
}
).to_simcore_runtime_docker_labels()
return standard_simcore_labels | TypeAdapter(ContainerLabelsDict).validate_python(
{
Expand Down Expand Up @@ -633,7 +635,7 @@ def check_if_cluster_is_able_to_run_pipeline(


async def wrap_client_async_routine(
client_coroutine: Coroutine[Any, Any, Any] | Any | None
client_coroutine: Coroutine[Any, Any, Any] | Any | None,
) -> Any:
"""Dask async behavior does not go well with Pylance as it returns
a union of types. this wrapper makes both mypy and pylance happy"""
Expand Down
Loading