Skip to content

Commit 38a73ac

Browse files
committed
import
1 parent d40a37c commit 38a73ac

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

services/autoscaling/src/simcore_service_autoscaling/modules/auto_scaling_core.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
EC2Tags,
1515
Resources,
1616
)
17+
from aws_library.ec2._errors import (
18+
EC2InstanceNotFoundError,
19+
EC2InstanceTypeInvalidError,
20+
EC2TooManyInstancesError,
21+
)
1722
from fastapi import FastAPI
1823
from models_library.generated_models.docker_rest_api import Node, NodeState
1924
from servicelib.logging_utils import log_catch, log_context
2025
from servicelib.utils_formatting import timedelta_as_minute_second
2126
from types_aiobotocore_ec2.literals import InstanceTypeType
2227

23-
from ..core.errors import (
24-
Ec2InstanceInvalidError,
25-
Ec2InstanceNotFoundError,
26-
Ec2InvalidDnsNameError,
27-
Ec2TooManyInstancesError,
28-
)
28+
from ..core.errors import Ec2InvalidDnsNameError
2929
from ..core.settings import ApplicationSettings, get_application_settings
3030
from ..models import (
3131
AssignedTasksToInstanceType,
@@ -497,13 +497,13 @@ async def _find_needed_instances(
497497
- task_required_resources,
498498
)
499499
)
500-
except Ec2InstanceNotFoundError:
500+
except EC2InstanceNotFoundError:
501501
_logger.exception(
502502
"Task %s needs more resources than any EC2 instance "
503503
"can provide with the current configuration. Please check!",
504504
f"{task}",
505505
)
506-
except Ec2InstanceInvalidError:
506+
except EC2InstanceTypeInvalidError:
507507
_logger.exception("Unexpected error:")
508508

509509
_logger.info(
@@ -568,7 +568,7 @@ async def _cap_needed_instances(
568568
>= app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_MAX_INSTANCES
569569
):
570570
# ok that is already too much
571-
raise Ec2TooManyInstancesError(
571+
raise EC2TooManyInstancesError(
572572
num_instances=app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_MAX_INSTANCES
573573
)
574574

services/clusters-keeper/tests/unit/test_modules_clusters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
import arrow
1111
import pytest
1212
from aws_library.ec2 import EC2InstanceData
13+
from aws_library.ec2._errors import EC2InstanceNotFoundError
1314
from faker import Faker
1415
from fastapi import FastAPI
1516
from models_library.users import UserID
1617
from models_library.wallets import WalletID
1718
from parse import Result, search
1819
from pytest_simcore.helpers.monkeypatch_envs import EnvVarsDict
1920
from simcore_service_clusters_keeper._meta import VERSION as APP_VERSION
20-
from simcore_service_clusters_keeper.core.errors import Ec2InstanceNotFoundError
2121
from simcore_service_clusters_keeper.core.settings import (
2222
ApplicationSettings,
2323
get_application_settings,
@@ -155,7 +155,7 @@ async def test_get_cluster_raises_if_not_found(
155155
wallet_id: WalletID,
156156
initialized_app: FastAPI,
157157
):
158-
with pytest.raises(Ec2InstanceNotFoundError):
158+
with pytest.raises(EC2InstanceNotFoundError):
159159
await get_cluster(initialized_app, user_id=user_id, wallet_id=wallet_id)
160160

161161

0 commit comments

Comments
 (0)