Skip to content

Commit

Permalink
add wait for new task
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed May 8, 2023
1 parent 6f2baca commit d1d3e45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/pytest-simcore/src/pytest_simcore/docker_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def docker_swarm(
retry=retry_if_exception_type(AssertionError),
stop=stop_after_delay(30),
)
def _wait_for_new_task(service, old_task_ids: set[str]) -> None:
def _wait_for_new_task_to_be_started(service: Any, old_task_ids: set[str]) -> None:
service.reload()
new_task_ids = {t["ID"] for t in service.tasks()}
assert len(new_task_ids.difference(old_task_ids)) == 1
Expand All @@ -198,9 +198,9 @@ def _force_restart_migration_service(docker_client: docker.client.DockerClient)
print(
"WARNING: migration service detected before updating stack, it will be force-updated"
)
current_task_ids = {t["ID"] for t in migration_service.tasks()}
before_update_task_ids = {t["ID"] for t in migration_service.tasks()}
migration_service.force_update()
_wait_for_new_task(migration_service, current_task_ids)
_wait_for_new_task_to_be_started(migration_service, before_update_task_ids)
print(f"forced updated {migration_service.name}.")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name

pytest_simcore_core_services_selection = ["postgres", "migration"]
pytest_simcore_ops_services_selection = [
"adminer",
Expand Down

0 comments on commit d1d3e45

Please sign in to comment.