Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel demo #32

Closed
wants to merge 12 commits into from
Closed

Parallel demo #32

wants to merge 12 commits into from

Conversation

garrettmflynn
Copy link
Collaborator

This PR approaches #31 by including a demo/parallel_script.py script (and associated CLI command) that allows you to get updates from parallel tqdm_publisher instances through an HTTP relay server.

@CodyCBakerPhD Let me know if this aligns with what we can bring to this package's dependents. I'll integrate the script into the main demo if that's the case.

Comment on lines 83 to 96
def run(self, number_of_jobs: int, repeats: List[int]):
"""The main (outer) iteration run on the central managing process."""

if self.started:
return

self.started = True

PORT = find_free_port()

# Start the server in a new thread
server_thread = threading.Thread(target=self.run_server, args=[PORT])
server_thread.daemon = True
server_thread.start()
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to move the PORT related stuff to an argument of this function? Such that the run command only does parallel dispatch of some operation with some map of input arguments (which can also include the port info)?

Copy link
Member

Choose a reason for hiding this comment

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

Or better yet make it more generic to only receive the URL at which to make the post request

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done! Now the process "server" and HTTP "client" are run in parallel and communicate to each other through the URL provided to the former.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also trying out the kwargs approach discussed yesterday. Let me know if this makes sense.

It's a bit more cumbersome than I'd anticipated because all kwargs are considered required to be defined on the callback function (or simply **kwargs)

@garrettmflynn
Copy link
Collaborator Author

garrettmflynn commented Mar 12, 2024

I'm only running the parallel demo in Python at the moment. But I can adapt the main HTML demo to handle both at the same time if that is desirable.

@CodyCBakerPhD
Copy link
Member

I'd hold off for a little bit on this while I think of a better way to design the tqdm injection, now that I understand the scoping better

@garrettmflynn
Copy link
Collaborator Author

Got it. Sounds good!

@garrettmflynn garrettmflynn mentioned this pull request Mar 25, 2024
@CodyCBakerPhD
Copy link
Member

@garrettmflynn Replaced by #51?

@garrettmflynn
Copy link
Collaborator Author

Yep! Feel free to close

@CodyCBakerPhD CodyCBakerPhD deleted the parallel-tests branch April 6, 2024 22:13
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