iterative / dvc-studio-client

Client to interact with DVC Studio
http://docs.iterative.ai/dvc-studio-client/
Apache License 2.0
6 stars 6 forks source link

Make non-blocking requests #39

Open daavoo opened 1 year ago

daavoo commented 1 year ago

Now that images can be sent through the API, the requests can take significant time, and would be nice to not block the main thread where the training will be happening.

natikgadzhi commented 9 months ago

So looks like the plan could be to:

  1. Provide a new async version of async_post_live_metrics.
  2. Make _post_in_chunks async. Send params and metrics async, process data and send the image / plots chunk async as well.
  3. In post_live_metrics, accept a blocking: Bool = True. By sticking with the current behavior by default, we can keep the Bool return type for existing client code. In non-blocking mode, we can return asyncio.create_task(async_post_live_metrics(...)).

Am I close? If that works, happy to submit a PR with that, unit tests, and docs!