Skip to content

Commit 3d1d8a9

Browse files
committed
Merge branch 'master' into is1779/search-users
2 parents 6d27a71 + 95d208b commit 3d1d8a9

File tree

61 files changed

+1512
-665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1512
-665
lines changed

.codecov.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ flag_management:
1010
statuses:
1111
- type: project
1212
target: auto
13-
threshold: 1%
13+
threshold: 2%
1414
- type: patch
1515
target: auto
16-
threshold: 1%
16+
threshold: 2%
1717

1818

1919
component_management:
@@ -22,7 +22,7 @@ component_management:
2222
statuses:
2323
- type: project
2424
target: auto
25-
threshold: 1%
25+
threshold: 2%
2626
branches:
2727
- "!master"
2828
individual_components:
@@ -116,12 +116,12 @@ coverage:
116116
project:
117117
default:
118118
informational: true
119-
threshold: 1%
119+
threshold: 2%
120120

121121
patch:
122122
default:
123123
informational: true
124-
threshold: 1%
124+
threshold: 2%
125125

126126
comment:
127127
layout: "header,diff,flags,components,footer"

.github/workflows/ci-testing-deploy.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ jobs:
772772
if: ${{ !cancelled() }}
773773
run: ./ci/github/unit-testing/catalog.bash test
774774
- name: upload failed tests logs
775-
if: ${{ !cancelled() }}
775+
if: ${{ failure() }}
776776
uses: actions/upload-artifact@v4
777777
with:
778778
name: ${{ github.job }}_docker_logs
@@ -879,7 +879,7 @@ jobs:
879879
if: ${{ !cancelled() }}
880880
run: ./ci/github/unit-testing/datcore-adapter.bash test
881881
- name: upload failed tests logs
882-
if: ${{ !cancelled() }}
882+
if: ${{ failure() }}
883883
uses: actions/upload-artifact@v4
884884
with:
885885
name: ${{ github.job }}_docker_logs
@@ -930,7 +930,7 @@ jobs:
930930
if: ${{ !cancelled() }}
931931
run: ./ci/github/unit-testing/director.bash test
932932
- name: upload failed tests logs
933-
if: ${{ !cancelled() }}
933+
if: ${{ failure() }}
934934
uses: actions/upload-artifact@v4
935935
with:
936936
name: ${{ github.job }}_docker_logs
@@ -981,7 +981,7 @@ jobs:
981981
if: ${{ !cancelled() }}
982982
run: ./ci/github/unit-testing/director-v2.bash test
983983
- name: upload failed tests logs
984-
if: ${{ !cancelled() }}
984+
if: ${{ failure() }}
985985
uses: actions/upload-artifact@v4
986986
with:
987987
name: ${{ github.job }}_docker_logs
@@ -1910,7 +1910,7 @@ jobs:
19101910
- name: test
19111911
run: ./ci/github/integration-testing/webserver.bash test 01
19121912
- name: upload failed tests logs
1913-
if: ${{ !cancelled() }}
1913+
if: ${{ failure() }}
19141914
uses: actions/upload-artifact@v4
19151915
with:
19161916
name: ${{ github.job }}_docker_logs
@@ -1974,7 +1974,7 @@ jobs:
19741974
- name: test
19751975
run: ./ci/github/integration-testing/webserver.bash test 02
19761976
- name: upload failed tests logs
1977-
if: ${{ !cancelled() }}
1977+
if: ${{ failure() }}
19781978
uses: actions/upload-artifact@v4
19791979
with:
19801980
name: ${{ github.job }}_docker_logs
@@ -2038,7 +2038,7 @@ jobs:
20382038
- name: test
20392039
run: ./ci/github/integration-testing/director-v2.bash test 01
20402040
- name: upload failed tests logs
2041-
if: ${{ !cancelled() }}
2041+
if: ${{ failure() }}
20422042
uses: actions/upload-artifact@v4
20432043
with:
20442044
name: ${{ github.job }}_docker_logs
@@ -2111,7 +2111,7 @@ jobs:
21112111
- name: test
21122112
run: ./ci/github/integration-testing/director-v2.bash test 02
21132113
- name: upload failed tests logs
2114-
if: ${{ !cancelled() }}
2114+
if: ${{ failure() }}
21152115
uses: actions/upload-artifact@v4
21162116
with:
21172117
name: ${{ github.job }}_docker_logs
@@ -2177,7 +2177,7 @@ jobs:
21772177
- name: test
21782178
run: ./ci/github/integration-testing/dynamic-sidecar.bash test 01
21792179
- name: upload failed tests logs
2180-
if: ${{ !cancelled() }}
2180+
if: ${{ failure() }}
21812181
uses: actions/upload-artifact@v4
21822182
with:
21832183
name: ${{ github.job }}_docker_logs
@@ -2241,7 +2241,7 @@ jobs:
22412241
- name: test
22422242
run: ./ci/github/integration-testing/simcore-sdk.bash test
22432243
- name: upload failed tests logs
2244-
if: ${{ !cancelled() }}
2244+
if: ${{ failure() }}
22452245
uses: actions/upload-artifact@v4
22462246
with:
22472247
name: ${{ github.job }}_docker_logs
@@ -2330,7 +2330,7 @@ jobs:
23302330
- name: test
23312331
run: ./ci/github/system-testing/public-api.bash test
23322332
- name: upload failed tests logs
2333-
if: ${{ !cancelled() }}
2333+
if: ${{ failure() }}
23342334
uses: actions/upload-artifact@v4
23352335
with:
23362336
name: ${{ github.job }}_docker_logs
@@ -2395,7 +2395,7 @@ jobs:
23952395
name: ${{ github.job }}_services_settings_schemas
23962396
path: ./services/**/settings-schema.json
23972397
- name: upload failed tests logs
2398-
if: ${{ !cancelled() }}
2398+
if: ${{ failure() }}
23992399
uses: actions/upload-artifact@v4
24002400
with:
24012401
name: ${{ github.job }}_docker_logs

packages/pytest-simcore/src/pytest_simcore/helpers/aws_ec2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ async def assert_autoscaled_dynamic_ec2_instances(
4242
expected_instance_state: InstanceStateNameType,
4343
expected_additional_tag_keys: list[str],
4444
instance_filters: Sequence[FilterTypeDef] | None,
45+
expected_user_data: list[str] | None = None,
4546
) -> list[InstanceTypeDef]:
47+
if expected_user_data is None:
48+
expected_user_data = ["docker swarm join"]
4649
return await assert_ec2_instances(
4750
ec2_client,
4851
expected_num_reservations=expected_num_reservations,
@@ -54,7 +57,7 @@ async def assert_autoscaled_dynamic_ec2_instances(
5457
"io.simcore.autoscaling.monitored_services_labels",
5558
*expected_additional_tag_keys,
5659
],
57-
expected_user_data=["docker swarm join"],
60+
expected_user_data=expected_user_data,
5861
instance_filters=instance_filters,
5962
)
6063

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

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,43 @@ async def _activate_drained_nodes(
418418
)
419419

420420

421-
async def _start_buffer_instances(
421+
async def _start_warm_buffer_instances(
422422
app: FastAPI, cluster: Cluster, auto_scaling_mode: BaseAutoscaling
423423
) -> Cluster:
424+
"""starts warm buffer if there are assigned tasks, or if a hot buffer of the same type is needed"""
425+
426+
app_settings = get_application_settings(app)
427+
assert app_settings.AUTOSCALING_EC2_INSTANCES # nosec
428+
424429
instances_to_start = [
425430
i.ec2_instance for i in cluster.buffer_ec2s if i.assigned_tasks
426431
]
432+
433+
if (
434+
len(cluster.buffer_drained_nodes)
435+
< app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_MACHINES_BUFFER
436+
):
437+
# check if we can migrate warm buffers to hot buffers
438+
hot_buffer_instance_type = cast(
439+
InstanceTypeType,
440+
next(
441+
iter(app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_ALLOWED_TYPES)
442+
),
443+
)
444+
free_startable_warm_buffers_to_replace_hot_buffers = [
445+
warm_buffer.ec2_instance
446+
for warm_buffer in cluster.buffer_ec2s
447+
if (warm_buffer.ec2_instance.type == hot_buffer_instance_type)
448+
and not warm_buffer.assigned_tasks
449+
]
450+
instances_to_start += free_startable_warm_buffers_to_replace_hot_buffers[
451+
: app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_MACHINES_BUFFER
452+
- len(cluster.buffer_drained_nodes)
453+
]
454+
427455
if not instances_to_start:
428456
return cluster
429-
# change the buffer machine to an active one
457+
430458
with log_context(
431459
_logger, logging.INFO, f"start {len(instances_to_start)} buffer machines"
432460
):
@@ -1187,8 +1215,8 @@ async def _autoscale_cluster(
11871215
# 2. activate available drained nodes to cover some of the tasks
11881216
cluster = await _activate_drained_nodes(app, cluster, auto_scaling_mode)
11891217

1190-
# 3. start buffer instances to cover the remaining tasks
1191-
cluster = await _start_buffer_instances(app, cluster, auto_scaling_mode)
1218+
# 3. start warm buffer instances to cover the remaining tasks
1219+
cluster = await _start_warm_buffer_instances(app, cluster, auto_scaling_mode)
11921220

11931221
# 4. scale down unused instances
11941222
cluster = await _scale_down_unused_cluster_instances(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def _list_processing_tasks_on_worker(
273273
async with _scheduler_client(scheduler_url, authentication) as client:
274274
worker_url, _ = _dask_worker_from_ec2_instance(client, ec2_instance)
275275

276-
_logger.debug("looking for processing tasksfor %s", f"{worker_url=}")
276+
_logger.debug("looking for processing tasks for %s", f"{worker_url=}")
277277

278278
# now get the used resources
279279
worker_processing_tasks: list[

services/autoscaling/src/simcore_service_autoscaling/utils/utils_docker.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,14 @@ async def tag_node(
521521
tags: dict[DockerLabelKey, str],
522522
available: bool,
523523
) -> Node:
524+
assert node.spec # nosec
525+
if (node.spec.labels == tags) and (
526+
(node.spec.availability is Availability.active) == available
527+
):
528+
# nothing to do
529+
return node
524530
with log_context(
525-
logger, logging.DEBUG, msg=f"tagging {node.id=} with {tags=} and {available=}"
531+
logger, logging.DEBUG, msg=f"tag {node.id=} with {tags=} and {available=}"
526532
):
527533
assert node.id # nosec
528534

0 commit comments

Comments
 (0)