From a0dd8add1db7db1856366fb6e0218dcf0fd5ad93 Mon Sep 17 00:00:00 2001 From: matusdrobuliak66 <60785969+matusdrobuliak66@users.noreply.github.com> Date: Tue, 11 Jul 2023 18:48:05 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=F0=9F=97=83=EF=B8=8F=20Is100?= =?UTF-8?q?4/modify=20resource=20tracker=20backend=20after=20container=20l?= =?UTF-8?q?abel=20changes=20(#4488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...143b7cd_refactoring_of_resource_tracker.py | 96 +++++++++++++ .../models/resource_tracker.py | 48 +++---- .../models/resource_tracker_container.py | 30 ++-- .../db/repositories/resource_tracker.py | 13 +- .../resource_tracker_core.py | 68 +++------ .../resource_tracker_container_service.py | 6 +- .../list_of_prometheus_mocked_outputs.json | 132 ++++++++++-------- .../test_api_resource_tracker__list.py | 8 +- ...iner_resource_usage_task__on_update_set.py | 26 ++-- 9 files changed, 261 insertions(+), 166 deletions(-) create mode 100644 packages/postgres-database/src/simcore_postgres_database/migration/versions/ef931143b7cd_refactoring_of_resource_tracker.py diff --git a/packages/postgres-database/src/simcore_postgres_database/migration/versions/ef931143b7cd_refactoring_of_resource_tracker.py b/packages/postgres-database/src/simcore_postgres_database/migration/versions/ef931143b7cd_refactoring_of_resource_tracker.py new file mode 100644 index 00000000000..1b7fcf001bf --- /dev/null +++ b/packages/postgres-database/src/simcore_postgres_database/migration/versions/ef931143b7cd_refactoring_of_resource_tracker.py @@ -0,0 +1,96 @@ +"""refactoring of resource_tracker_container table + +Revision ID: ef931143b7cd +Revises: a8762d5d43ae +Create Date: 2023-07-11 14:37:57.455348+00:00 + +""" +import sqlalchemy as sa +from alembic import op +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = "ef931143b7cd" +down_revision = "a8762d5d43ae" +branch_labels = None +depends_on = None + + +def upgrade(): + container_classification_enum = postgresql.ENUM( + "DYNAMIC_SIDECAR", "USER_SERVICE", name="containerclassification" + ) + container_classification_enum.create(op.get_bind()) + + op.execute("DELETE FROM resource_tracker_container;") + + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "resource_tracker_container", + sa.Column("cpu_limit", sa.Numeric(precision=3, scale=2), nullable=False), + ) + op.add_column( + "resource_tracker_container", + sa.Column("memory_limit", sa.BigInteger(), nullable=False), + ) + op.add_column( + "resource_tracker_container", + sa.Column( + "classification", + sa.Enum("DYNAMIC_SIDECAR", "USER_SERVICE", name="containerclassification"), + nullable=True, + ), + ) + op.drop_column( + "resource_tracker_container", "service_settings_reservation_nano_cpus" + ) + op.drop_column("resource_tracker_container", "service_settings_limit_nano_cpus") + op.drop_column("resource_tracker_container", "service_settings_limit_memory_bytes") + op.drop_column( + "resource_tracker_container", "service_settings_reservation_memory_bytes" + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "resource_tracker_container", + sa.Column( + "service_settings_reservation_memory_bytes", + sa.BIGINT(), + autoincrement=False, + nullable=True, + ), + ) + op.add_column( + "resource_tracker_container", + sa.Column( + "service_settings_limit_memory_bytes", + sa.BIGINT(), + autoincrement=False, + nullable=True, + ), + ) + op.add_column( + "resource_tracker_container", + sa.Column( + "service_settings_limit_nano_cpus", + sa.BIGINT(), + autoincrement=False, + nullable=True, + ), + ) + op.add_column( + "resource_tracker_container", + sa.Column( + "service_settings_reservation_nano_cpus", + sa.BIGINT(), + autoincrement=False, + nullable=True, + ), + ) + op.drop_column("resource_tracker_container", "classification") + op.drop_column("resource_tracker_container", "memory_limit") + op.drop_column("resource_tracker_container", "cpu_limit") + # ### end Alembic commands ### diff --git a/packages/postgres-database/src/simcore_postgres_database/models/resource_tracker.py b/packages/postgres-database/src/simcore_postgres_database/models/resource_tracker.py index 277246f0dc1..09be024f9d9 100644 --- a/packages/postgres-database/src/simcore_postgres_database/models/resource_tracker.py +++ b/packages/postgres-database/src/simcore_postgres_database/models/resource_tracker.py @@ -3,6 +3,7 @@ - Table where we store the resource usage of each container that we scrape via resource-usage-tracker service """ +import enum import sqlalchemy as sa from sqlalchemy.dialects.postgresql import JSONB @@ -10,6 +11,12 @@ from ._common import column_modified_datetime from .base import metadata + +class ContainerClassification(str, enum.Enum): + DYNAMIC_SIDECAR = enum.auto() + USER_SERVICE = enum.auto() + + resource_tracker_container = sa.Table( "resource_tracker_container", metadata, @@ -39,18 +46,6 @@ doc="product_name label scraped via Prometheus (taken from container labels)", index=True, ), - sa.Column( - "service_settings_reservation_nano_cpus", - sa.BigInteger, - nullable=True, - doc="CPU resource allocated to a container, ex.500000000 means that the container is allocated 0.5 CPU shares", - ), - sa.Column( - "service_settings_reservation_memory_bytes", - sa.BigInteger, - nullable=True, - doc="memory limit in bytes scraped via Prometheus", - ), sa.Column( "service_settings_reservation_additional_info", JSONB, @@ -90,18 +85,6 @@ nullable=True, doc="instance label scraped via Prometheus (taken from container labels, ex.: gpu1)", ), - sa.Column( - "service_settings_limit_nano_cpus", - sa.BigInteger, - nullable=True, - doc="CPU resource limit allocated to a container, ex.500000000 means that the container has limit for 0.5 CPU shares", - ), - sa.Column( - "service_settings_limit_memory_bytes", - sa.BigInteger, - nullable=True, - doc="memory limit in bytes scraped via Prometheus", - ), sa.Column( "project_name", sa.String, @@ -126,6 +109,23 @@ nullable=False, doc="Service Version (parsed from image label scraped via Prometheus)", ), + sa.Column( + "cpu_limit", + sa.Numeric(precision=3, scale=2), + nullable=False, + doc="CPU resource allocated to a container, ex.0.5 CPU shares", + ), + sa.Column( + "memory_limit", + sa.BigInteger, + nullable=False, + doc="memory limit in bytes scraped via Prometheus", + ), + sa.Column( + "classification", + sa.Enum(ContainerClassification), + doc="Our custom classification of the container type", + ), # --------------------------- sa.PrimaryKeyConstraint("container_id", name="resource_tracker_container_pkey"), ) diff --git a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/models/resource_tracker_container.py b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/models/resource_tracker_container.py index 441a2729275..b1afb309e92 100644 --- a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/models/resource_tracker_container.py +++ b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/models/resource_tracker_container.py @@ -8,7 +8,8 @@ from models_library.projects_nodes_io import NodeID from models_library.services import ServiceKey, ServiceVersion from models_library.users import UserID -from pydantic import BaseModel, Field, PositiveInt +from pydantic import BaseModel, ByteSize, Field, PositiveInt +from simcore_postgres_database.models.resource_tracker import ContainerClassification # Scraped from prometheus @@ -26,17 +27,18 @@ class ContainerScrapedResourceUsageMetric(BaseModel): None, description="Instance label scraped via Prometheus (taken from container labels, ex.: gpu1)", ) - service_settings_reservation_nano_cpus: int | None = Field( - None, - description="CPU resource limit allocated to a container, ex.500000000 means that the container has limit for 0.5 CPU shares", - ) - service_settings_reservation_memory_bytes: int | None service_settings_reservation_additional_info: dict[str, Any] = Field( {}, description="Storing additional information about the reservation settings, such as what type of graphic card is used.", ) - service_settings_limit_nano_cpus: int | None - service_settings_limit_memory_bytes: int | None + memory_limit: ByteSize = Field( + None, + description="Memory bytes limit set by the runtime, ex. 17179869184 means that the container has limit for 16GB of memory", + ) + cpu_limit: float = Field( + None, + description="CPU limit set by the runtime, ex. 3.5 Shares of one CPU cores", + ) service_key: ServiceKey service_version: ServiceVersion @@ -50,8 +52,14 @@ class Config: arbitrary_types_allowed = True +class ContainerScrapedResourceUsageCustom(BaseModel): + classification: ContainerClassification + + class ContainerScrapedResourceUsage( - ContainerScrapedResourceUsageMetric, ContainerScrapedResourceUsageValues + ContainerScrapedResourceUsageMetric, + ContainerScrapedResourceUsageValues, + ContainerScrapedResourceUsageCustom, ): ... @@ -60,8 +68,8 @@ class ContainerScrapedResourceUsage( class ContainerGetDB(BaseModel): - service_settings_reservation_nano_cpus: int | None - service_settings_reservation_memory_bytes: int | None + cpu_limit: float + memory_limit: int prometheus_created: datetime prometheus_last_scraped: datetime project_uuid: ProjectID diff --git a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/modules/db/repositories/resource_tracker.py b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/modules/db/repositories/resource_tracker.py index 94573c840ad..712c9086d04 100644 --- a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/modules/db/repositories/resource_tracker.py +++ b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/modules/db/repositories/resource_tracker.py @@ -39,8 +39,8 @@ async def upsert_resource_tracker_container_data( project_uuid=f"{data.project_uuid}", project_name=data.project_name, product_name=data.product_name, - service_settings_reservation_nano_cpus=data.service_settings_reservation_nano_cpus, - service_settings_reservation_memory_bytes=data.service_settings_reservation_memory_bytes, + cpu_limit=data.cpu_limit, + memory_limit=data.memory_limit, service_settings_reservation_additional_info=data.service_settings_reservation_additional_info, container_cpu_usage_seconds_total=data.container_cpu_usage_seconds_total, prometheus_created=data.prometheus_created.datetime, @@ -49,10 +49,9 @@ async def upsert_resource_tracker_container_data( node_uuid=f"{data.node_uuid}", node_label=data.node_label, instance=data.instance, - service_settings_limit_nano_cpus=data.service_settings_limit_nano_cpus, - service_settings_limit_memory_bytes=data.service_settings_limit_memory_bytes, service_key=data.service_key, service_version=data.service_version, + classification=data.classification, ) on_update_stmt = insert_stmt.on_conflict_do_update( @@ -84,8 +83,8 @@ async def list_containers_by_user_and_product( async with self.db_engine.begin() as conn: query = ( sa.select( - resource_tracker_container.c.service_settings_reservation_nano_cpus, - resource_tracker_container.c.service_settings_reservation_memory_bytes, + resource_tracker_container.c.cpu_limit, + resource_tracker_container.c.memory_limit, resource_tracker_container.c.prometheus_created, resource_tracker_container.c.prometheus_last_scraped, resource_tracker_container.c.project_uuid, @@ -106,7 +105,7 @@ async def list_containers_by_user_and_product( result = await conn.execute(query) containers_list = [ - ContainerGetDB.construct(**row) # type: ignore[arg-type] + ContainerGetDB(**row) # type: ignore[arg-type] for row in result.fetchall() ] diff --git a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/resource_tracker_core.py b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/resource_tracker_core.py index 7c0f96a98df..05308a47f2b 100644 --- a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/resource_tracker_core.py +++ b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/resource_tracker_core.py @@ -1,5 +1,4 @@ import asyncio -import json import logging from datetime import datetime, timedelta, timezone from typing import Any @@ -11,7 +10,8 @@ from models_library.projects_nodes_io import NodeID from models_library.services import ServiceKey, ServiceVersion from prometheus_api_client import PrometheusConnect -from pydantic import BaseModel +from pydantic import BaseModel, ByteSize +from simcore_postgres_database.models.resource_tracker import ContainerClassification from simcore_service_resource_usage_tracker.modules.prometheus import ( get_prometheus_api_client, ) @@ -56,10 +56,6 @@ def _build_cache_key_user_id(fct, *args): return f"{fct.__name__}_{args[1]}" -def _build_cache_key_project_and_node_id(fct, *args): - return f"{fct.__name__}_{args[1]}_{args[2]}" - - @cached(ttl=_TTL, key_builder=_build_cache_key_user_id) async def _get_user_email( osparc_repo: UserAndProjectRepository, user_id: int @@ -68,7 +64,6 @@ async def _get_user_email( return user_email -@cached(ttl=_TTL, key_builder=_build_cache_key_project_and_node_id) async def _get_project_and_node_names( osparc_repo: UserAndProjectRepository, project_uuid: ProjectID, node_uuid: NodeID ) -> tuple[str | None, str | None]: @@ -104,35 +99,6 @@ async def _scrape_container_resource_usage( data: list[ContainerScrapedResourceUsage] = [] for item in containers_cpu_seconds_usage: - # Prepare metric - metric: dict[str, Any] = item["metric"] - container_label_simcore_service_settings: list[dict[str, Any]] = json.loads( - metric["container_label_simcore_service_settings"] - ) - reservation_nano_cpus: int | None = None - reservation_memory_bytes: int | None = None - limit_nano_cpus: int | None = None - limit_memory_bytes: int | None = None - for setting in container_label_simcore_service_settings: - if setting.get("type") == "Resources": - reservation_nano_cpus = ( - setting.get("value", {}) - .get("Reservations", {}) - .get("NanoCPUs", None) - ) - reservation_memory_bytes = ( - setting.get("value", {}) - .get("Reservations", {}) - .get("MemoryBytes", None) - ) - limit_nano_cpus = ( - setting.get("value", {}).get("Limits", {}).get("NanoCPUs", None) - ) - limit_memory_bytes = ( - setting.get("value", {}).get("Limits", {}).get("MemoryBytes", None) - ) - break - # Prepare values values: list[list] = item["values"] first_value: list = values[0] @@ -140,9 +106,18 @@ async def _scrape_container_resource_usage( assert len(first_value) == 2 # nosec assert len(last_value) == 2 # nosec - user_id = int(metric["container_label_user_id"]) - project_uuid = ProjectID(metric["container_label_study_id"]) - node_uuid = NodeID(metric["container_label_uuid"]) + # Prepare metric + metric: dict[str, Any] = item["metric"] + + memory_limit = int(metric["container_label_io_simcore_runtime_memory_limit"]) + cpu_limit = float(metric["container_label_io_simcore_runtime_cpu_limit"]) + + product_name = metric["container_label_io_simcore_runtime_product_name"] + user_id = int(metric["container_label_io_simcore_runtime_user_id"]) + project_uuid = ProjectID( + metric["container_label_io_simcore_runtime_project_id"] + ) + node_uuid = NodeID(metric["container_label_io_simcore_runtime_node_id"]) user_email, project_info = await asyncio.gather( *[ _get_user_email(osparc_repo, user_id), @@ -161,24 +136,23 @@ async def _scrape_container_resource_usage( container_resource_usage = ContainerScrapedResourceUsage( container_id=metric["id"], - user_id=metric["container_label_user_id"], - product_name=metric["container_label_product_name"], - project_uuid=metric["container_label_study_id"], - service_settings_reservation_nano_cpus=reservation_nano_cpus, - service_settings_reservation_memory_bytes=reservation_memory_bytes, + user_id=user_id, + product_name=product_name, + project_uuid=project_uuid, + memory_limit=ByteSize(memory_limit), + cpu_limit=cpu_limit, service_settings_reservation_additional_info={}, container_cpu_usage_seconds_total=last_value[1], prometheus_created=arrow.get(first_value[0]), prometheus_last_scraped=arrow.get(last_value[0]), - node_uuid=metric["container_label_uuid"], + node_uuid=node_uuid, instance=metric.get("instance", None), - service_settings_limit_nano_cpus=limit_nano_cpus, - service_settings_limit_memory_bytes=limit_memory_bytes, project_name=project_name, node_label=node_label, user_email=user_email, service_key=ServiceKey(service_key), service_version=ServiceVersion(service_version), + classification=ContainerClassification.USER_SERVICE, ) data.append(container_resource_usage) diff --git a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/services/resource_tracker_container_service.py b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/services/resource_tracker_container_service.py index 672fb9babb2..cc48a0b7325 100644 --- a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/services/resource_tracker_container_service.py +++ b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/services/resource_tracker_container_service.py @@ -59,11 +59,7 @@ async def list_containers( container.prometheus_last_scraped - container.prometheus_created ).total_seconds() / 60 - _processors = ( - container.service_settings_reservation_nano_cpus / 1e9 - if container.service_settings_reservation_nano_cpus - else 0.0 - ) + _processors = container.cpu_limit if ( overall_last_scraped_timestamp - timedelta(minutes=16) diff --git a/services/resource-usage-tracker/tests/unit/with_dbs/data/list_of_prometheus_mocked_outputs.json b/services/resource-usage-tracker/tests/unit/with_dbs/data/list_of_prometheus_mocked_outputs.json index 01b7f82a95a..eec1a5cca04 100644 --- a/services/resource-usage-tracker/tests/unit/with_dbs/data/list_of_prometheus_mocked_outputs.json +++ b/services/resource-usage-tracker/tests/unit/with_dbs/data/list_of_prometheus_mocked_outputs.json @@ -4,12 +4,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmpb1ztyf6m", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "ac62ed72-0c26-11ee-994f-02420a0b0fc8", - "container_label_user_id": "43818", - "container_label_uuid": "11177106-2302-5461-9017-e495145858b6", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/ec08331c8658286a384cfa6e57f3b4daa59c9e9a369ed42401f621c142042f40", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -48,12 +50,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmpqg_rpq7e", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "92acac24-0c26-11ee-98b2-02420a0b0fc9", - "container_label_user_id": "43817", - "container_label_uuid": "9069c179-c3d7-58a6-8431-8cb19339c847", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/2873c8bee46543f059d4c2c2500ba658d24bdf0abdfcdc2b7eccc955e9538c43", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -96,12 +100,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmp0m7ijyoy", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "ac62ed72-0c26-11ee-994f-02420a0b0fc8", - "container_label_user_id": "43818", - "container_label_uuid": "8f1a908e-8b4b-5011-a42c-98abd141fc50", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/b6cd6d013763a34795aaac8402b7f8943df80c2f63ba4f90f95c5b7235dbbc4e", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -140,12 +146,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmp3o6q4v5e", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "df604058-0c26-11ee-994f-02420a0b0fc8", - "container_label_user_id": "43819", - "container_label_uuid": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/22394ffafb00907311fc6b76423875411f1084009f89fe77bc618f48f06053eb", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -188,12 +196,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmpfgfyp7n5", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "98f516f8-0c25-11ee-bec2-02420a0b0fc7", - "container_label_user_id": "11367", - "container_label_uuid": "32f3c80d-7cbc-58d3-840e-fedae5252dd0", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/fecc93800827e3fbdaee9a51842ff2001d010f809c46e806f74611bada02b7b1", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -236,12 +246,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmpyugvc3z8", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "92acac24-0c26-11ee-98b2-02420a0b0fc9", - "container_label_user_id": "43817", - "container_label_uuid": "f7c6e801-d8a0-5f57-8283-850adf128613", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/38179a390b273788cba9a7b33860f0606c4d4c45d13d63f9d1920509e05d2054", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -284,12 +296,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmpehms8dgc", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "52d7e1a8-0c27-11ee-bec2-02420a0b0fc7", - "container_label_user_id": "43820", - "container_label_uuid": "d283967b-11db-5d91-a484-af570f32d5e7", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/98f90bfd2e28861247f550da8dcf09ebcfa3e5304d15f470708f67f84e724a8f", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -316,12 +330,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmpdkm5klhn", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "df604058-0c26-11ee-994f-02420a0b0fc8", - "container_label_user_id": "43819", - "container_label_uuid": "fee6dbfe-529f-5c57-8121-af8a507326f0", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/e468fa476815d843e3d3dcf4c7988c8846107be02959a2ef1fd41584b18c18ee", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -364,12 +380,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmp6y2a68v3", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "98f516f8-0c25-11ee-bec2-02420a0b0fc7", - "container_label_user_id": "11367", - "container_label_uuid": "88ebaebf-c50e-5b33-a3ce-fe7ed2ad9668", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/7f7d260357ee8c80f69b148bc090068df4bc1c9aafad909dc1557934d0366967", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -412,12 +430,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmp_3seh6kp", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "52d7e1a8-0c27-11ee-bec2-02420a0b0fc7", - "container_label_user_id": "43820", - "container_label_uuid": "2b231c38-0ebc-5cc0-9030-1ffe573f54e9", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/58e1138d51eb5eafd737024d0df0b01ef88f2087e5a3922565c59130d57ac7a3", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -444,12 +464,14 @@ "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmp_3seh6kp", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "TEST", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": "[{\"name\": \"ports\", \"type\": \"int\", \"value\": 8888}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"DISPLAY=:0\"]}, {\"name\": \"env\", \"type\": \"string\", \"value\": [\"SYM_SERVER_HOSTNAME=sym-server_%service_uuid%\"]}, {\"name\": \"mount\", \"type\": \"object\", \"value\": [{\"ReadOnly\": true, \"Source\": \"/tmp/.X11-unix\", \"Target\": \"/tmp/.X11-unix\", \"Type\": \"bind\"}]}, {\"name\": \"constraints\", \"type\": \"string\", \"value\": [\"node.platform.os == linux\"]}, {\"name\": \"Resources\", \"type\": \"Resources\", \"value\": {\"Limits\": {\"NanoCPUs\": 4000000000, \"MemoryBytes\": 17179869184}, \"Reservations\": {\"NanoCPUs\": 100000000, \"MemoryBytes\": 536870912, \"GenericResources\": [{\"DiscreteResourceSpec\": {\"Kind\": \"VRAM\", \"Value\": 1}}]}}}]", - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "52d7e1a8-0c27-11ee-bec2-02420a0b0fc7", - "container_label_user_id": "43820", - "container_label_uuid": "2b231c38-0ebc-5cc0-9030-1ffe573f54e9", + "container_label_io_simcore_runtime_simcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "df604058-0c26-11ee-994f-02420a0b0fc8", + "container_label_io_simcore_runtime_user_id": "43819", + "container_label_io_simcore_runtime_node_id": "14387f03-4a37-5187-b8e0-0e491389ade4", + "container_label_io_simcore_runtime_cpu_limit": "3.5", + "container_label_io_simcore_runtime_memory_limit": "17179869184", "id": "/docker/58e1138d51eb5eafd737024d0df0b01ef88f2087e5a3922565c59130d57ac7a3", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", diff --git a/services/resource-usage-tracker/tests/unit/with_dbs/test_api_resource_tracker__list.py b/services/resource-usage-tracker/tests/unit/with_dbs/test_api_resource_tracker__list.py index 5492b5145cd..964aafc9b4d 100644 --- a/services/resource-usage-tracker/tests/unit/with_dbs/test_api_resource_tracker__list.py +++ b/services/resource-usage-tracker/tests/unit/with_dbs/test_api_resource_tracker__list.py @@ -46,8 +46,8 @@ def random_resource_tracker_container(**overrides) -> dict[str, Any]: user_id=FAKE.pyint(), project_uuid=FAKE.uuid4(), product_name="osparc", - service_settings_reservation_nano_cpus=None, - service_settings_reservation_memory_bytes=None, + cpu_limit="3.5", + memory_limit="17179869184", service_settings_reservation_additional_info={}, container_cpu_usage_seconds_total=FAKE.pyint(), prometheus_created=datetime.now(tz=timezone.utc), @@ -56,12 +56,11 @@ def random_resource_tracker_container(**overrides) -> dict[str, Any]: node_uuid=FAKE.uuid4(), node_label=FAKE.word(), instance="gpu", - service_settings_limit_nano_cpus=None, - service_settings_limit_memory_bytes=None, project_name=FAKE.word(), user_email=FAKE.email(), service_key="simcore/services/dynamic/jupyter-smash", service_version="3.0.7", + classification="USER_SERVICE", ) data.update(overrides) @@ -92,7 +91,6 @@ def resource_tracker_container_db(postgres_db: sa.engine.Engine) -> Iterator[lis con.execute(resource_tracker_container.delete()) -@pytest.mark.testit async def test_list_containers( mocked_redis_server: None, mocked_setup_background_task: mock.Mock, diff --git a/services/resource-usage-tracker/tests/unit/with_dbs/test_collect_container_resource_usage_task__on_update_set.py b/services/resource-usage-tracker/tests/unit/with_dbs/test_collect_container_resource_usage_task__on_update_set.py index ecf098cbad0..a6d2b6e32b8 100644 --- a/services/resource-usage-tracker/tests/unit/with_dbs/test_collect_container_resource_usage_task__on_update_set.py +++ b/services/resource-usage-tracker/tests/unit/with_dbs/test_collect_container_resource_usage_task__on_update_set.py @@ -77,12 +77,14 @@ def random_promql_output_generator(): "container_label_com_docker_compose_oneoff": "False", "container_label_com_docker_compose_project_working_dir": "/tmp/tmp_3seh6kp", "container_label_com_docker_compose_version": "1.29.1", - "container_label_product_name": "osparc", + "container_label_io_simcore_runtime_product_name": "osparc", "container_label_simcore_service_settings": '[{"name": "ports", "type": "int", "value": 8888}, {"name": "env", "type": "string", "value": ["DISPLAY=:0"]}, {"name": "env", "type": "string", "value": ["SYM_SERVER_HOSTNAME=sym-server_%service_uuid%"]}, {"name": "mount", "type": "object", "value": [{"ReadOnly": true, "Source": "/tmp/.X11-unix", "Target": "/tmp/.X11-unix", "Type": "bind"}]}, {"name": "constraints", "type": "string", "value": ["node.platform.os == linux"]}, {"name": "Resources", "type": "Resources", "value": {"Limits": {"NanoCPUs": 4000000000, "MemoryBytes": 17179869184}, "Reservations": {"NanoCPUs": 100000000, "MemoryBytes": 536870912, "GenericResources": [{"DiscreteResourceSpec": {"Kind": "VRAM", "Value": 1}}]}}}]', - "container_label_simcore_user_agent": "puppeteer", - "container_label_study_id": "46449cc3-7d83-4081-a44e-fc75a0c85f2c", - "container_label_user_id": "43820", - "container_label_uuid": "2b231c38-0ebc-5cc0-1234-1ffe573f54e9", + "container_label_io_simcore_runtime_imcore_user_agent": "puppeteer", + "container_label_io_simcore_runtime_project_id": "46449cc3-7d83-4081-a44e-fc75a0c85f2c", + "container_label_io_simcore_runtime_user_id": "43820", + "container_label_io_simcore_runtime_node_id": "2b231c38-0ebc-5cc0-1234-1ffe573f54e9", + "container_label_io_simcore_runtime_memory_limit": "17179869184", + "container_label_io_simcore_runtime_cpu_limit": "3.5", "id": "/docker/58e1138d51eb5eafd737024d0df0b01ef88f2087e5a3922565c59130d57ac7a3", "image": "registry.osparc.io/simcore/services/dynamic/jupyter-smash:3.0.7", "instance": "gpu1", @@ -152,21 +154,21 @@ async def test_collect_container_resource_usage_task( assert len(db_rows) == 1 assert ( - random_promql_output_generator["max_float"] == db_rows[0][7] + random_promql_output_generator["max_float"] == db_rows[0][5] ) # <-- container_cpu_usage_seconds_total assert ( arrow.get(random_promql_output_generator["min_timestamp"]).datetime - == db_rows[0][8] + == db_rows[0][6] ) # <-- prometheus_created assert ( arrow.get(random_promql_output_generator["max_timestamp"]).datetime - == db_rows[0][9] + == db_rows[0][7] ) # <-- prometheus_last_scraped assert f"{project_uuid}" == db_rows[0][2] # <-- project_uuid node_uuid_ = list(project_db["workbench"].keys())[0] - assert node_uuid_ == db_rows[0][11] # <-- node_uuid + assert node_uuid_ == db_rows[0][9] # <-- node_uuid assert ( - project_db["workbench"][node_uuid_]["label"] == db_rows[0][12] + project_db["workbench"][node_uuid_]["label"] == db_rows[0][10] ) # <-- node_label - assert project_db["name"] == db_rows[0][16] # <-- project_name - assert user_db["email"] == db_rows[0][17] # <-- user_email + assert project_db["name"] == db_rows[0][12] # <-- project_name + assert user_db["email"] == db_rows[0][13] # <-- user_email