Skip to content

Commit

Permalink
🔧 fix parallel example
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Jun 10, 2024
1 parent da37a00 commit d3ca9e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@


async def main():
await asyncio.gather(spawn_codebox() for _ in range(10))
await asyncio.gather(*(spawn_codebox() for _ in range(10)))


async def spawn_codebox():
async with CodeBox() as codebox:
print(await codebox.arun("print('Hello World!')"))
await codebox.arun("a = 'Hello World!'")
a = await codebox.arun("a")
assert a == "Hello World!"
print("Success!")


if __name__ == "__main__":
Expand Down

0 comments on commit d3ca9e2

Please sign in to comment.