-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update names of classes and demo instructions in readme (#67)
- Loading branch information
Showing
5 changed files
with
20 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# TQDM Publisher Multiple Bars Demo | ||
This demo shows how to use a global `TQDMPublisher` instance to forward progress updates from parallel `TQDMPublisher` instances to the browser. | ||
This demo shows how to use a global `TQDMProgressPublisher` instance to forward progress updates from parallel `TQDMProgressPublisher` instances to the browser. | ||
|
||
## The Approach | ||
In this demo, we track multiple interdependent levels of progress updates by using a global `TQDMPublisher` instance to reflect the execution state of parallel `TQDMPublisher` instances. | ||
In this demo, we track multiple interdependent levels of progress updates by using a global `TQDMProgressPublisher` instance to reflect the execution state of parallel `TQDMProgressPublisher` instances. | ||
|
||
Similar to the [multiple bar demo](../_multiple_bars/README.md), a `request_id` is used to associate both the global and parallel progress bars with a specific group of elements on the browser. In particular, the ID of the global progress bar matches the `request_id`, allowing it to be distinguished from the lower-level progress bars. | ||
|
||
However, this approach also differs in many ways from the other demos: | ||
1. Instead of a `websockets` server, we use a `flask` server to receive requests from the client and send updates back using the Server-Sent Events (SSE) protocol. | ||
2. A `TQDMProgressHandler` is used to queue progress updates from parallel `TQDMPublisher` instances, avoiding the possibility of overloading the connection and receiving misformatted messages on the client. | ||
2. A `TQDMProgressHandler` is used to queue progress updates from parallel `TQDMProgressPublisher` instances, avoiding the possibility of overloading the connection and receiving misformatted messages on the client. | ||
|
||
## Handling Processes | ||
Since our `TQDMProgressHandler` is managing progress bars across processes, we're using it in an unconventional way. | ||
|
||
Instead of using the handler to directly manage `TQDMSubscriber` instances, we declare `TQDMPublisher` instances within the process. | ||
Instead of using the handler to directly manage `TQDMProgressSubscriber` instances, we declare `TQDMProgressPublisher` instances within the process. | ||
|
||
Since we can't pass data directly out of the process, we send an HTTP request to the `flask` server that is directly forwarded to the handler's `announce` method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# TQDM Publisher Single Bar Demo | ||
This demo shows how to use `tqdm_publisher` to forward progress updates from a single `TQDMPublisher` instance to the browser. | ||
This demo shows how to use `tqdm_publisher` to forward progress updates from a single `TQDMProgressPublisher` instance to the browser. | ||
|
||
## The Approach | ||
We use `websockets` to establish a connection between the server and the client. | ||
|
||
A progress bar is pre-rendered on page load. When the client presses the Create Progress Bar button, the server forwards progress updates to the client using a `TQDMPublisher` instance spawned in a separate thread. | ||
A progress bar is pre-rendered on page load. When the client presses the Create Progress Bar button, the server forwards progress updates to the client using a `TQDMProgressPublisher` instance spawned in a separate thread. | ||
|
||
The Create button is disabled until the progress bar is finished to avoid associating updates from multiple progress bars with their respective elements. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters