Skip to content

Commit

Permalink
added test and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Aug 23, 2024
1 parent 40d1ecb commit 161481c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,13 @@ async def _make_pending_buffer_ec2s_join_cluster(
app: FastAPI,
cluster: Cluster,
) -> Cluster:
# started buffer instance shall be asked to join the cluster once they are running
ssm_client = get_ssm_client(app)

if buffer_ec2s_pending := [
i.ec2_instance
for i in cluster.pending_ec2s
if is_buffer_machine(i.ec2_instance.tags)
]:
# started buffer instance shall be asked to join the cluster once they are running
ssm_client = get_ssm_client(app)
buffer_ec2_connection_state = await limited_gather(
*[
ssm_client.is_instance_connected_to_ssm_server(i.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,32 @@ async def test_cluster_scaling_with_no_tasks_does_nothing(
)


@pytest.mark.acceptance_test(
"Ensure this does not happen https://github.com/ITISFoundation/osparc-simcore/issues/6227"
)
async def test_cluster_scaling_with_disabled_ssm_does_not_block_autoscaling(
minimal_configuration: None,
disabled_ssm: None,
app_settings: ApplicationSettings,
initialized_app: FastAPI,
mock_launch_instances: mock.Mock,
mock_terminate_instances: mock.Mock,
mock_rabbitmq_post_message: mock.Mock,
dask_spec_local_cluster: distributed.SpecCluster,
):
await auto_scale_cluster(
app=initialized_app, auto_scaling_mode=ComputationalAutoscaling()
)
mock_launch_instances.assert_not_called()
mock_terminate_instances.assert_not_called()
_assert_rabbit_autoscaling_message_sent(
mock_rabbitmq_post_message,
app_settings,
initialized_app,
dask_spec_local_cluster.scheduler_address,
)


async def test_cluster_scaling_with_task_with_too_much_resources_starts_nothing(
minimal_configuration: None,
app_settings: ApplicationSettings,
Expand Down

0 comments on commit 161481c

Please sign in to comment.