Skip to content
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

✨Adding dynamic services monitoring dashboard (⚠️devops) #6784

Merged
Changes from 1 commit
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
d2d81c0
⬆️ Upgrade models-library (pydantic v2) (#6333)
giancarloromeo Sep 18, 2024
19e3923
♻️ Add common library (#6495)
giancarloromeo Oct 7, 2024
1d92881
⬆️ Upgrade libraries (pydantic v2) (#6366)
giancarloromeo Oct 9, 2024
329b00d
Upgrade agent service (Pydantic v2) (#6508)
giancarloromeo Oct 10, 2024
6786b92
Upgrade EFS guardian service (Pydantic v2) (#6516)
giancarloromeo Oct 11, 2024
bbe92a2
Upgrade invitations service (Pydantic v2) (#6513)
giancarloromeo Oct 11, 2024
42c0a68
Upgrade clusters keeper service (Pydantic v2) (#6519)
giancarloromeo Oct 14, 2024
1c833e0
Merge remote-tracking branch 'origin/master' into pydantic_v2_migrati…
sanderegg Oct 22, 2024
cac8134
♻️Pydantic V2 upgrade: autoscaling (#6535)
sanderegg Oct 15, 2024
e97258e
🎨 pydantic2 migration: fixed unit-tests for dynamic-sidecar (#6534)
GitHK Oct 18, 2024
463488b
🎨 pydantic2 migration: fixed unit-tests for dynamic-scheduler (#6547)
GitHK Oct 18, 2024
c2b4983
🎨 pydantic2 migration: fixed unit-tests for agent (#6546)
GitHK Oct 18, 2024
64293f0
🎨 pydantic2 migration: fixed unit-tests for payments (#6553)
GitHK Oct 18, 2024
cf5546b
Upgrade resource usage tracker (Pydantic v2) (#6517)
giancarloromeo Oct 21, 2024
3b188f5
Merge remote-tracking branch 'origin/master' into pydantic_v2_migrati…
sanderegg Oct 22, 2024
4716e55
Merge remote-tracking branch 'origin/master' into pydantic_v2_migrati…
sanderegg Oct 22, 2024
84f1e51
missing file from re-creating branch
sanderegg Oct 22, 2024
cf95d81
restored from old pydanitc_v2_migration branch
sanderegg Oct 22, 2024
7be9541
fixes after merge
sanderegg Oct 22, 2024
6199ed6
⬆️Dask sidecar: migration to v2 (#6591)
sanderegg Oct 24, 2024
cd6f545
♻️Use correct import (#6597)
sanderegg Oct 24, 2024
3cf68ba
⬆️Datcore adapter: migration (#6594)
sanderegg Oct 24, 2024
fb48eb1
Merge remote-tracking branch 'upstream/master' into update-branch
sanderegg Oct 25, 2024
82c69d0
Merge pull request #6600 from sanderegg/update-branch
sanderegg Oct 25, 2024
7410516
⬆️Migration: Storage (#6599)
sanderegg Oct 25, 2024
39aed6a
⬆️ Upgrade API Server service (Pydantic v2) (#6580)
giancarloromeo Oct 25, 2024
e38cf4e
♻️Fix settings library tests (#6605)
sanderegg Oct 28, 2024
00f8674
Merge remote-tracking branch 'upstream/master' into update-branch2
sanderegg Oct 28, 2024
06df37d
Merge pull request #6609 from sanderegg/update-branch2
sanderegg Oct 28, 2024
3195f1e
Merge remote-tracking branch 'upstream/master' into upgrade-master-3
sanderegg Oct 29, 2024
7033151
Merge remote-tracking branch 'upstream/master' into upgrade-master-3
sanderegg Oct 29, 2024
4fd252f
Merge pull request #6626 from sanderegg/upgrade-master-3
sanderegg Oct 29, 2024
afa0b3c
⬆️ upgrades `iter_model_examples_in_module` to enable all example te…
pcrespov Oct 29, 2024
9e76d4f
⬆️Pydantic V2: Diverse fixes after merges from master (#6627)
sanderegg Oct 29, 2024
fefd1b9
Merge remote-tracking branch 'upstream/master' into upgrade-master-5
sanderegg Oct 29, 2024
05cff9e
Merge pull request #6637 from sanderegg/upgrade-master-5
sanderegg Oct 29, 2024
34c9f3e
⬆️ pydantic migration catalog (#6629)
pcrespov Oct 31, 2024
ee66b3d
Merge remote-tracking branch 'upstream/master' into update-master-6
sanderegg Nov 1, 2024
01769ac
Merge pull request #6645 from sanderegg/update-master-6
sanderegg Nov 1, 2024
2486b38
♻️Pydantic V2 migration: various fixes (#6647)
sanderegg Nov 1, 2024
add4b61
Merge remote-tracking branch 'upstream/master' into update-master-7
sanderegg Nov 1, 2024
1fe311d
Merge pull request #6650 from sanderegg/update-master-7
sanderegg Nov 1, 2024
24218c1
⬆️ Pydantic V2: after upstream merge -> fixes (#6651)
sanderegg Nov 1, 2024
b01c4a7
⬆️ Fix custom settings class with `pydantic-settings~=2.6` (#6644)
pcrespov Nov 5, 2024
8402270
⬆️ Upgrade Web Server service (Pydantic v2) (#6584)
giancarloromeo Nov 6, 2024
0527b1e
🐛 pydantic v2 fixed broken unit tests (#6649)
GitHK Nov 6, 2024
7d0fbdb
Merge remote-tracking branch 'upstream/master' into update-from-maste…
sanderegg Nov 8, 2024
c106d0a
Merge pull request #6689 from sanderegg/update-from-master-10
sanderegg Nov 8, 2024
60fe257
🎨 Add examples to pydantic response models (#6658)
bisgaard-itis Nov 8, 2024
f07afbf
🐛 Fixed packages mypy, pylint and tests (#6678)
GitHK Nov 11, 2024
a00d55f
pydantic2 making ported services green (#6701)
GitHK Nov 13, 2024
f335bca
WIP: ⬆️ Upgrade Director v2 service (Pydantic v2) (#6619)
giancarloromeo Nov 14, 2024
db084cd
Merge remote-tracking branch 'upstream/master' into update-master-20
sanderegg Nov 14, 2024
44bc9f7
Merge pull request #6724 from sanderegg/update-master-20
sanderegg Nov 15, 2024
a2d3742
♻️ Fix unit tests after master merge (#6727)
giancarloromeo Nov 15, 2024
327beab
⬆️ Align versions for pydantic/fastapi (#6730)
giancarloromeo Nov 15, 2024
84c4c85
♻️Fixed Unit test director v2 (#6733)
sanderegg Nov 15, 2024
8eac56b
♻️ Fix deprecated stuff (Pydantic v2) (#6732)
giancarloromeo Nov 18, 2024
65665ec
♻️ Migrate scripts (Pydantic v2) (#6741)
giancarloromeo Nov 18, 2024
57058f9
Merge remote-tracking branch 'upstream/master' into update-from-maste…
sanderegg Nov 18, 2024
44f85bf
Merge pull request #6744 from sanderegg/update-from-master-XXX
sanderegg Nov 18, 2024
fa57c9e
pydantic2 migration made integration tests green (#6719)
GitHK Nov 18, 2024
a6802c9
⬆️✅ Fixes settings tests (#6753)
pcrespov Nov 18, 2024
75f06e4
🐛 Fixed webserver API endpoints (#6751)
GitHK Nov 19, 2024
aa756f0
Merge remote-tracking branch 'upstream/master' into update-master-XXX
sanderegg Nov 19, 2024
bcf3327
Merge remote-tracking branch 'upstream/master' into update-master-XXX
sanderegg Nov 19, 2024
373c314
Merge pull request #6754 from sanderegg/update-master-XXX
sanderegg Nov 19, 2024
c0a13ac
added fastUI
Nov 19, 2024
fa69117
fixed imports
Nov 19, 2024
08f1881
fixed broken import
Nov 19, 2024
f442e63
⬆️Pydantic V2: Migrate director v0 + some fixes from query PR (#6755)
sanderegg Nov 19, 2024
c10d7d0
⬆️♻️ Fix/test models (#6758)
pcrespov Nov 19, 2024
3250e5d
♻️ Greenify pylint (after Pydantic v2 migration) (#6747)
giancarloromeo Nov 19, 2024
f6d392c
moved healthcheck form root to it's own path
Nov 19, 2024
ed24e0d
moved health endpoint
Nov 19, 2024
ee2d339
added base FastUi app
Nov 19, 2024
dcdc863
🎨 Ensure profiling middleware is compatible with fastapi (#6760)
bisgaard-itis Nov 19, 2024
21eb313
Merge remote-tracking branch 'upstream/pydantic_v2_migration_do_not_s…
Nov 19, 2024
c7b2444
base SSE render demo
Nov 19, 2024
2d454e9
added app to sse endpoint
Nov 19, 2024
3a77ff5
renaming and adding prefix
Nov 19, 2024
c50d79c
♻️Pydantic V2: Unify errors dv 2 (#6763)
sanderegg Nov 19, 2024
0aea337
Uses typing_extensions.TypedDict in all instances used in pydantic mo…
pcrespov Nov 19, 2024
d973a81
Merge remote-tracking branch 'upstream/pydantic_v2_migration_do_not_s…
Nov 20, 2024
c49f421
♻️ Cleanup network AnyHttpUrlLegacy and HttpUrlLegacy (#6767)
giancarloromeo Nov 20, 2024
a0b8a2f
All errors in dynamic-sidecar inherit from `OsparcErrorMixin` (#6764)
GitHK Nov 20, 2024
dc32c96
Merge remote-tracking branch 'upstream/pydantic_v2_migration_do_not_s…
Nov 20, 2024
66a492f
♻️ Fix agent tests (#6772)
giancarloromeo Nov 20, 2024
ccc3ea7
Merge remote-tracking branch 'upstream/pydantic_v2_migration_do_not_s…
Nov 20, 2024
c38b064
Fixes [unit] webserver 03 and [unit] settings-library (both mypy and …
pcrespov Nov 20, 2024
150b17a
Merge remote-tracking branch 'upstream/master' into update-master-XXXXX
sanderegg Nov 20, 2024
17d1702
Merge pull request #6780 from sanderegg/update-master-XXXXX
sanderegg Nov 20, 2024
47e3570
⬆️Pydantic V2: missing import in director-v0 (#6781)
sanderegg Nov 20, 2024
6f63769
added reusable sse utils
Nov 21, 2024
3b6ee6f
Merge remote-tracking branch 'upstream/pydantic_v2_migration_do_not_s…
Nov 21, 2024
e6f5a5f
added base example to render service status
Nov 21, 2024
8108f9f
refactor toutes
Nov 21, 2024
3ebc16e
added some docstring
Nov 21, 2024
4e8bce9
propagate dataset as soon as possible
Nov 21, 2024
dc60766
renaming
Nov 21, 2024
928570d
added mock data provider
Nov 21, 2024
1ad36bf
docstrings
Nov 21, 2024
e2e75c2
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 21, 2024
891efb7
very rough first draft
Nov 21, 2024
40d2966
enhanced hashing
Nov 21, 2024
32f1044
added service details
Nov 21, 2024
78debb9
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 21, 2024
3f8115c
current WIP version with FastUI
Nov 22, 2024
5b0a357
replaced ui engine
Nov 25, 2024
8fb09d1
refactored UI first version
Nov 25, 2024
ef70773
refactor
Nov 25, 2024
7890cfc
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 25, 2024
4e4d014
sticky tarcking
Nov 26, 2024
a47c732
fixed update interval in UI and extended capability
Nov 26, 2024
76802fe
refactor
Nov 26, 2024
db61f1f
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 26, 2024
63b8f1e
remove stickyness
Nov 26, 2024
c74a2bb
rename
Nov 26, 2024
12fa00a
rename restructure
Nov 26, 2024
b2ffc56
ui touches
Nov 26, 2024
0613b9f
revert
Nov 26, 2024
ba618d2
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 26, 2024
73db351
added new makefile entry
Nov 26, 2024
6fbd1eb
added service count
Nov 26, 2024
209303e
typo
Nov 26, 2024
b7b1b44
remove note and fixed for pydantic2
Nov 26, 2024
1aae2e4
extended description
Nov 26, 2024
9a4dbfd
enhanced texts
Nov 26, 2024
25a9b95
feedback
Nov 26, 2024
de0db8c
fixed previously failing test
Nov 26, 2024
b183aff
using secret string
Nov 26, 2024
64c21dd
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 27, 2024
9d8ab8e
added back nicegui dependencies after merge
Nov 27, 2024
665c70d
fixed broken unit tests
Nov 27, 2024
1a3bdba
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Nov 27, 2024
926d88d
added tests for index page to see if it renders as expected
Nov 27, 2024
da197d4
refactor stop dialog
Nov 27, 2024
46fb5d0
rename
Nov 27, 2024
696ff79
added base tests with playwright
Dec 2, 2024
179ac90
fixed test
Dec 2, 2024
c19c878
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Dec 2, 2024
5fb1314
added tests for service details
Dec 2, 2024
1db89fe
fixed interface rendering
Dec 2, 2024
d65d155
refactor
Dec 2, 2024
10dafbd
refactor page rendering
Dec 2, 2024
f98a96d
added 404 test
Dec 2, 2024
1d488c8
fixed broken tests
Dec 3, 2024
0f3374e
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-dyb…
Dec 3, 2024
e79e6af
Merge branch 'master' into pr-osparc-add-dybamic-services-monitor-das…
GitHK Dec 4, 2024
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
Prev Previous commit
Next Next commit
All errors in dynamic-sidecar inherit from OsparcErrorMixin (#6764)
Co-authored-by: Andrei Neagu <[email protected]>
GitHK and Andrei Neagu authored Nov 20, 2024
commit a0b8a2fae4d055e68d65f25bcd8c9abddfc03949
Original file line number Diff line number Diff line change
@@ -50,7 +50,13 @@ async def get_volume_by_label(label: str, run_id: RunID) -> dict[str, Any]:
volumes = data["Volumes"]
_logger.debug("volumes query for label=%s volumes=%s", label, volumes)
if len(volumes) != 1:
raise VolumeNotFoundError(label, run_id, volumes)
raise VolumeNotFoundError(
volume_count=len(volumes),
source_label=label,
run_id=run_id,
volume_names=" ".join(v.get("Name", "UNKNOWN") for v in volumes),
status_code=http_status.HTTP_404_NOT_FOUND,
)
volume_details: dict[str, Any] = volumes[0]
return volume_details

Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ async def http_error_handler(
) -> JSONResponse:
return JSONResponse(
content=jsonable_encoder({"errors": [exception.message]}),
status_code=exception.status_code,
status_code=exception.status_code, # type:ignore[attr-defined]
)


Original file line number Diff line number Diff line change
@@ -1,53 +1,30 @@
from typing import Any

from common_library.errors_classes import OsparcErrorMixin
from fastapi import status
from models_library.services import RunID


class BaseDynamicSidecarError(Exception):
class BaseDynamicSidecarError(OsparcErrorMixin, Exception):
"""Used as base for all exceptions"""

def __init__(
self, nessage: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR
) -> None:
self.message: str = nessage
self.status_code: int = status_code
super().__init__(nessage)


class VolumeNotFoundError(BaseDynamicSidecarError):
def __init__(
self, source_label: str, run_id: RunID, volumes: list[dict[str, Any]]
) -> None:
super().__init__(
f"Expected 1 got {len(volumes)} volumes labels with {source_label=}, {run_id=}: "
f"Found {' '.join(v.get('Name', 'UNKNOWN') for v in volumes)}",
status_code=status.HTTP_404_NOT_FOUND,
)
msg_template = (
"Expected 1 got {volume_count} volumes labels with "
"source_label={source_label}, run_id={run_id}: Found {volume_names}"
)


class UnexpectedDockerError(BaseDynamicSidecarError):
def __init__(self, message: str, status_code: int) -> None:
super().__init__(
f"An unexpected Docker error occurred {status_code=}, {message=}",
status_code=status_code,
)


class BaseError(OsparcErrorMixin, BaseDynamicSidecarError):
...
msg_template = "An unexpected Docker error occurred status_code={status_code}, message={message}"


class ContainerExecContainerNotFoundError(BaseError):
class ContainerExecContainerNotFoundError(BaseDynamicSidecarError):
msg_template = "Container '{container_name}' was not found"


class ContainerExecTimeoutError(BaseError):
class ContainerExecTimeoutError(BaseDynamicSidecarError):
msg_template = "Timed out after {timeout} while executing: '{command}'"


class ContainerExecCommandFailedError(BaseError):
class ContainerExecCommandFailedError(BaseDynamicSidecarError):
msg_template = (
"Command '{command}' exited with code '{exit_code}'"
"and output: '{command_result}'"
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from typing import cast

from common_library.pydantic_validators import validate_numeric_string_as_timedelta
from models_library.basic_types import BootModeEnum, PortInt
from models_library.basic_types import PortInt
from models_library.callbacks_mapping import CallbacksMapping
from models_library.products import ProductName
from models_library.projects import ProjectID
@@ -21,8 +21,8 @@
field_validator,
)
from servicelib.logging_utils_filtering import LoggerName, MessageSubstring
from settings_library.application import BaseApplicationSettings
from settings_library.aws_s3_cli import AwsS3CliSettings
from settings_library.base import BaseCustomSettings
from settings_library.docker_registry import RegistrySettings
from settings_library.node_ports import StorageAuthSettings
from settings_library.postgres import PostgresSettings
@@ -35,7 +35,7 @@
from settings_library.utils_logging import MixinLoggingSettings


class ResourceTrackingSettings(BaseCustomSettings):
class ResourceTrackingSettings(BaseApplicationSettings):
RESOURCE_TRACKING_HEARTBEAT_INTERVAL: timedelta = Field(
default=DEFAULT_RESOURCE_USAGE_HEARTBEAT_INTERVAL,
description="each time the status of the service is propagated",
@@ -46,17 +46,13 @@ class ResourceTrackingSettings(BaseCustomSettings):
)


class SystemMonitorSettings(BaseCustomSettings):
class SystemMonitorSettings(BaseApplicationSettings):
DY_SIDECAR_SYSTEM_MONITOR_TELEMETRY_ENABLE: bool = Field(
default=False, description="enabled/disabled disk usage monitoring"
)


class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
SC_BOOT_MODE: BootModeEnum = Field(
...,
description="boot mode helps determine if in development mode or normal operation",
)
class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):

DYNAMIC_SIDECAR_DY_VOLUMES_MOUNT_DIR: Path = Field(
...,
Original file line number Diff line number Diff line change
@@ -480,7 +480,7 @@ async def test_container_docker_error(
def _expected_error_string(status_code: int) -> dict[str, Any]:
return {
"errors": [
f"An unexpected Docker error occurred status_code={status_code}, message='aiodocker_mocked_error'"
f"An unexpected Docker error occurred status_code={status_code}, message=aiodocker_mocked_error"
]
}

42 changes: 42 additions & 0 deletions services/dynamic-sidecar/tests/unit/test_core_errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# pylint:disable=broad-exception-caught
# pylint:disable=no-member

from simcore_service_dynamic_sidecar.core.errors import (
UnexpectedDockerError,
VolumeNotFoundError,
)
from starlette import status


def test_legacy_interface_unexpected_docker_error():
message = "some_message"
status_code = 42
try:
raise UnexpectedDockerError( # noqa: TRY301
message=message, status_code=status_code
)
except Exception as e:
print(e)
assert e.status_code == status_code # noqa: PT017
assert message in e.message # noqa: PT017


def test_legacy_interface_volume_not_found_error():
try:
volumes = [{}, {"Name": "a_volume"}]
volume_names = " ".join(v.get("Name", "UNKNOWN") for v in volumes)

raise VolumeNotFoundError( # noqa: TRY301
volume_count=len(volumes),
source_label="some",
run_id="run_id",
volume_names=volume_names,
status_code=status.HTTP_404_NOT_FOUND,
)
except Exception as e:
print(e)
assert ( # noqa: PT017
e.message
== "Expected 1 got 2 volumes labels with source_label=some, run_id=run_id: Found UNKNOWN a_volume"
)
assert e.status_code == status.HTTP_404_NOT_FOUND # noqa: PT017