Skip to content

Commit

Permalink
♻️ director-v2 SchedulerData legacy data format update (ITISFoundatio…
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHK authored Mar 22, 2023
1 parent 32fdc23 commit 1b10482
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import logging
import warnings
from enum import Enum
from functools import cached_property
from typing import Any, Mapping, Optional
Expand All @@ -17,15 +16,7 @@
)
from models_library.services import RunID
from models_library.services_resources import ServiceResourcesDict
from pydantic import (
AnyHttpUrl,
BaseModel,
Extra,
Field,
constr,
parse_obj_as,
root_validator,
)
from pydantic import AnyHttpUrl, BaseModel, Extra, Field, constr, parse_obj_as
from servicelib.error_codes import ErrorCodeStr
from servicelib.exception_utils import DelayedExceptionHandler

Expand Down Expand Up @@ -116,24 +107,6 @@ def from_container(cls, container: dict[str, Any]) -> "DockerContainerInspect":
id=container["Id"],
)

@root_validator(pre=True)
@classmethod
def _ensure_legacy_format_compatibility(cls, values):
warnings.warn(
(
"Once https://github.com/ITISFoundation/osparc-simcore/pull/3610 "
"reaches production this entire root_validator function "
"can be safely removed. Please check the "
"https://github.com/ITISFoundation/osparc-simcore/releases"
),
DeprecationWarning,
stacklevel=2,
)
status: Optional[str] = values.get("status")
if status:
values["container_state"] = {"Status": status}
return values

class Config:
keep_untouched = (cached_property,)
allow_mutation = False
Expand Down
64 changes: 60 additions & 4 deletions services/director-v2/tests/mocks/legacy_scheduler_data_format.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,21 @@
{
"status": "running",
"name": "/dy-sidecar-12fb3055-db35-4a34-a9c0-bff1267aa859-0-container",
"id": "dddbc3c10cd074e4cce0fbb6c49258e82befa003c2714159aef6214750646dc8"
"id": "dddbc3c10cd074e4cce0fbb6c49258e82befa003c2714159aef6214750646dc8",
"container_state": {
"Status": "running",
"Running": null,
"Paused": null,
"Restarting": null,
"OOMKilled": null,
"Dead": null,
"Pid": null,
"ExitCode": null,
"Error": null,
"StartedAt": null,
"FinishedAt": null,
"Health": null
}
}
],
"was_dynamic_sidecar_started": true,
Expand Down Expand Up @@ -109,17 +123,59 @@
{
"status": "running",
"name": "/dy-sidecar-d14bf3ea-abcf-52f2-8146-fc244b70f307-0-rt-web-dy",
"id": "eb076666d7da05ac69e60a211ff500d6b8d8dd6a823e0d0cc362d3421b6f37d7"
"id": "eb076666d7da05ac69e60a211ff500d6b8d8dd6a823e0d0cc362d3421b6f37d7",
"container_state": {
"Status": "running",
"Running": null,
"Paused": null,
"Restarting": null,
"OOMKilled": null,
"Dead": null,
"Pid": null,
"ExitCode": null,
"Error": null,
"StartedAt": null,
"FinishedAt": null,
"Health": null
}
},
{
"status": "running",
"name": "/dy-sidecar-d14bf3ea-abcf-52f2-8146-fc244b70f307-1-s4l-core",
"id": "3a0a443dd2732ae147b9e2d56f8ce44a72e7ca0b20886092c0b49d3cf5073dd9"
"id": "3a0a443dd2732ae147b9e2d56f8ce44a72e7ca0b20886092c0b49d3cf5073dd9",
"container_state": {
"Status": "running",
"Running": null,
"Paused": null,
"Restarting": null,
"OOMKilled": null,
"Dead": null,
"Pid": null,
"ExitCode": null,
"Error": null,
"StartedAt": null,
"FinishedAt": null,
"Health": null
}
},
{
"status": "running",
"name": "/dy-sidecar-d14bf3ea-abcf-52f2-8146-fc244b70f307-2-sym-server",
"id": "454858d71c4eed4e62723cf55dbdc72a97c41073a5b4cf6bbffd79a04df2f80a"
"id": "454858d71c4eed4e62723cf55dbdc72a97c41073a5b4cf6bbffd79a04df2f80a",
"container_state": {
"Status": "running",
"Running": null,
"Paused": null,
"Restarting": null,
"OOMKilled": null,
"Dead": null,
"Pid": null,
"ExitCode": null,
"Error": null,
"StartedAt": null,
"FinishedAt": null,
"Health": null
}
}
],
"was_dynamic_sidecar_started": true,
Expand Down

0 comments on commit 1b10482

Please sign in to comment.