Skip to content

Commit

Permalink
add containers banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Lombardi committed Jan 11, 2024
1 parent 7a98156 commit e159cfe
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sdk/src/beam/abstractions/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,20 @@ def deploy(self, name: str) -> bool:
return deploy_response.ok

def _gather_and_yield_results(self, inputs: Iterable):
container_count = len(inputs)

async def _gather_async():
tasks = [asyncio.create_task(self._call_remote(input)) for input in inputs]
for task in asyncio.as_completed(tasks):
yield await task

async_gen = _gather_async()
while True:
try:
yield self.parent.loop.run_until_complete(async_gen.__anext__())
except StopAsyncIteration:
break
with terminal.progress(f"Running {container_count} containers..."):
while True:
try:
yield self.parent.loop.run_until_complete(async_gen.__anext__())
except StopAsyncIteration:
break

def map(self, inputs: Iterable):
if not self.parent.prepare_runtime(
Expand Down

0 comments on commit e159cfe

Please sign in to comment.