Skip to content

Commit

Permalink
add TQDM and implement pool.join
Browse files Browse the repository at this point in the history
  • Loading branch information
muayyad-alsadi committed Feb 5, 2024
1 parent d475260 commit 9ed05a2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,7 @@ async def compose_exec(compose, args):
sys.exit(p)


async def transfer_service_status(compose, args, action):
async def transfer_service_status(compose: PodmanCompose, args, action):
# TODO: handle dependencies, handle creations
container_names_by_service = compose.container_names_by_service
if not args.services:
Expand All @@ -2595,8 +2595,7 @@ async def transfer_service_status(compose, args, action):
targets = list(reversed(targets))
podman_args = []
timeout_global = getattr(args, "timeout", None)
tasks = []
for target in targets:
for target in tqdm(targets):
if action != "start":
timeout = timeout_global
if timeout is None:
Expand All @@ -2607,8 +2606,8 @@ async def transfer_service_status(compose, args, action):
timeout = str_to_seconds(timeout_str)
if timeout is not None:
podman_args.extend(["-t", str(timeout)])
tasks.append(asyncio.create_task(compose.podman.run([], action, podman_args + [target])))
await asyncio.gather(*tasks)
compose.pool.run([], action, podman_args + [target], name=target)
await compose.pool.join()


@cmd_run(podman_compose, "start", "start specific services")
Expand Down

0 comments on commit 9ed05a2

Please sign in to comment.