You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To integrate this with minimal effort and change to other libraries, we need to consider the following approach
If we're planning something similar to the websockets approach of the demos in #43 for the GUIDE handling of such things, then what we need is the ability to take existing code that looks like this
defrun_some_complicated_function_with_progress_bars_in_it(
various_arguments: various_types=various_defaults,
...,
)
# Perform some setup
...
# Get to the lines where the iterated operation is runprogress_bar=tqdm.tqdm(iterable=thing_being_iterated, ..., **other_tqdm_options)
forstepinprogress_bar:
# do something expensive each step
and refactor it into
defrun_some_complicated_function_with_progress_bars_in_it(
various_arguments: various_types=various_defaults,
...,
progress_bar_class: Type[tqdm.tqdm] =tqdm.tqdm, # This would be a refactor we help with; most directly wrap at time of instantiationprogress_bar_kwargs: dict=dict(), # This would allow us to pass the callable to our new type
)
# Perform some setup
...
# Get to the lines where the iterated operation is runprogress_bar=progress_bar_class(iterable=thing_being_iterated, **progress_bar_kwargs)
forstepinprogress_bar:
# do something expensive each step
So based on current structure I'd recommend something like
On the Flask server, you run the following command to update the GUIDE of any events:
announcer.announce(message, label)
Where announcer is a global class instance. These announcement events can be individually subscribed to on the GUIDE using label, or you can listen to all events.
From my investigation, it looks like Flask endpoints are synchronous by default—so asynchronous operations would have to be handled in the logic of the endpoint.
To integrate this with minimal effort and change to other libraries, we need to consider the following approach
If we're planning something similar to the
websockets
approach of the demos in #43 for the GUIDE handling of such things, then what we need is the ability to take existing code that looks like thisand refactor it into
So based on current structure I'd recommend something like
Or perhaps more simply, directly inherit from
tqdm.tqdm
and bypassTQDMPublisher
to have theupdate
call directly send on each iterationThis way, all we would need to do in the Flask server is define an endpoint that does more or less
One question is, do we currently use multithreading and what not to showcase the async deployment of a synchronous operation
What will this be like on a Flask server? Are the endpoints already asynchronous or would the logic inside each endpoint handle the threading stuff?
The text was updated successfully, but these errors were encountered: