Skip to content

Conversation

kwanUm
Copy link
Collaborator

@kwanUm kwanUm commented Oct 27, 2024

No description provided.


traj_ids = [uuid.uuid4().hex for _ in range(len(environments))]
await asyncio.gather(
from tqdm.asyncio import tqdm_asyncio
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we import this at the module level?

Comment on lines +202 to +206
try:
# Wait for either the batch to fill up or the timeout to expire
await asyncio.wait_for(self._batch_ready_event.wait(), timeout=self.timeout)
except asyncio.TimeoutError:
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        async with asyncio.timeout(self.timeout):
            # Wait for either the batch to fill up or the timeout to expire
            self._batch_ready_event.wait()

Alternate way of doing this using built-in asyncio.timeout

I am not sure if you need to await the wait()

await self._processed_events[request_id].wait()

async with self._lock:
print(f"Finished Request ID: {request_id}, Counter: {self._events_count[request_id]}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use logging not print

self._processed_events[request_id] = asyncio.Event()
self._events_count[request_id] = self._counter
self._counter += 1
print(f"Started Request ID: {request_id}, Counter: {self._events_count[request_id]}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use logging over print

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants