posit-dev / posit-sdk-py

Posit SDK for Python
MIT License
7 stars 3 forks source link

Improve task polling #184

Open tdstein opened 2 months ago

tdstein commented 2 months ago

The existing task polling is naive and doesn't consider the various edge cases around output length, polling algorithms, etc...

Modify the implementation to take advantage of the log appending support in the API. Modify the polling algorithm to reduce server resource consumption (i.e., do polling client side instead of server side). Check if there is a need for supporting more advanced polling algorithms (.e.g, backoff policies, etc).

nealrichardson commented 2 months ago

Another thought, following the observation on https://github.com/posit-dev/posit-sdk-py/pull/183#discussion_r1581215656: Request with some reasonable wait amount for the first request, since if it is a quick task, it will return early. Then if longer than that, start polling.