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

Add IPFS integration #35

Merged
merged 15 commits into from
Jul 3, 2024
Merged

Add IPFS integration #35

merged 15 commits into from
Jul 3, 2024

Conversation

Vectorrent
Copy link
Contributor

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

Implements the use_ipfs argument, as documented here.

IPFS nodes will not respond to ping in the way Hivemind expects, so we also set ensure_bootstrap_success to False, when IPFS is used. Nevertheless, HivemindStrategy will connect to peers successfully once training begins.

Also added the bootstrap_timeout and wait_timeout arguments. Because the initial_peers format for IPFS omits the IP address (/p2p/XYZ123...), we need to set these higher, to allow IPFS time to connect. Else, 90% of attempts to join an IPFS-bootstrapped swarm will fail.

@Vectorrent Vectorrent requested a review from Borda as a code owner December 15, 2023 06:57
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86%. Comparing base (0835ea0) to head (a1ea228).
Report is 10 commits behind head on main.

Additional details and impacted files
@@        Coverage Diff         @@
##           main   #35   +/-   ##
==================================
  Coverage    86%   86%           
==================================
  Files         3     3           
  Lines       167   167           
==================================
  Hits        144   144           
  Misses       23    23           

@Vectorrent Vectorrent mentioned this pull request Dec 15, 2023
4 tasks
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

Looks good, can you please add test for it..

@Vectorrent
Copy link
Contributor Author

I'm not really sure how to write a proper test here. I setup the IPFS settings to just use the same defaults as Hivemind itself, so by default - nothing has changed. I would have written a full test for multiple peers over the IPFS network - but the existing one is marked as @pytest.mark.skip(); and so, I don't have a functional example to even start with.

Anyway, I also couldn't get this project to install on Arch Linux (failures with grpcio-tools), so I had to use a Docker environment for the testing. You can build the image with docker compose build and you can run tests with docker compose up.

I also added a couple more relevant settings. use_auto_relay=True is extremely helpful in connecting peers across the Internet.

@Vectorrent
Copy link
Contributor Author

I also updated Hivemind to its latest version. It seems to be passing all tests, and it's working well in my limited production testing.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@Borda Borda requested review from Borda and justusschock April 2, 2024 07:27
@Borda Borda enabled auto-merge (squash) July 3, 2024 22:06
@Borda Borda merged commit a140804 into Lightning-Universe:main Jul 3, 2024
20 checks passed
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