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

Implemented batch dispatching #147

Merged
merged 53 commits into from Aug 2, 2019
Merged

Implemented batch dispatching #147

merged 53 commits into from Aug 2, 2019

Conversation

AndreaCatania
Copy link
Contributor

This is the second iteration to implement the Batch dispatching following the feedback received in this PR: #144 (Was easier for me redo everything rather change it)

This is the project to test this feature:
shred_test.zip

@AndreaCatania AndreaCatania mentioned this pull request Jul 5, 2019
@WaDelma
Copy link
Member

WaDelma commented Jul 6, 2019

Could the project be an example? As in add it to the examples folder.

@AndreaCatania
Copy link
Contributor Author

Done!

Copy link
Member

@torkleyy torkleyy left a comment

Choose a reason for hiding this comment

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

Thank you for your work! It's already pretty good. I did find a bunch of nits, most of them I created a suggestion for which you can just apply from GitHub.

We still need some tests to cover the new code. The things that definitely need testing are:

  • setup is working correctly
  • batch with conflicting dependencies does not run in parallel with other systems
  • batch without conflicting dependencies does run in parallel with other systems
  • fetching works correctly
  • dispatching works, and the batch and its systems get executed

examples/batch_dispatching.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
src/dispatch/batch_builder.rs Outdated Show resolved Hide resolved
@torkleyy torkleyy requested a review from WaDelma July 8, 2019 17:50
AndreaCatania and others added 16 commits July 8, 2019 19:52
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
Co-Authored-By: Thomas Schaller <torkleyy@gmail.com>
@AndreaCatania
Copy link
Contributor Author

AndreaCatania commented Jul 10, 2019

@torkleyy I did all the changes that you advised.

ThreadPool

About the ThreadPool assignment problem that I mentioned you before, I found a solution that seems nice and elegant.

I've created a struct, called ThreadPoolWrapper, which is shared across all batches.
This wrapper contains the actual ThreadPool that now can be modified at any point.

The result of this addition is that when in amethyst the Application struct create the thread pool and assign it to the main DispatcherBuilder it change the internal part of the wrapper and everyone is automatically updated.

To me this seems clear enough but do you think that exist a better way to handle it?

Tests

I written three tests that demonstrate what you suggested, please let me know if I have to add more.

Commit squash

Do you want that I squash all this changes to a single commit?

Copy link
Member

@WaDelma WaDelma 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! There is some stuff I am not sure about as I haven't looked at the use case for this.

src/dispatch/async_dispatcher.rs Show resolved Hide resolved
src/dispatch/batch.rs Outdated Show resolved Hide resolved
examples/batch_dispatching.rs Outdated Show resolved Hide resolved
src/dispatch/batch.rs Show resolved Hide resolved
src/dispatch/batch.rs Show resolved Hide resolved
src/dispatch/batch.rs Show resolved Hide resolved
src/dispatch/dispatcher.rs Outdated Show resolved Hide resolved
src/dispatch/dispatcher.rs Show resolved Hide resolved
src/dispatch/stage.rs Outdated Show resolved Hide resolved
src/dispatch/builder.rs Show resolved Hide resolved
@AndreaCatania
Copy link
Contributor Author

@WaDelma I just did a commit to resolve the things that you pointed out

src/dispatch/builder.rs Outdated Show resolved Hide resolved
AndreaCatania and others added 12 commits July 14, 2019 14:30
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
Co-Authored-By: WaDelma <WaDelma@users.noreply.github.com>
@AndreaCatania
Copy link
Contributor Author

Any news for this?

Cargo.toml Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors bot commented Aug 2, 2019

✌️ jojolepro can now approve this pull request

Copy link
Member

@torkleyy torkleyy left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me!

bors delegate=jojolepro

@torkleyy
Copy link
Member

torkleyy commented Aug 2, 2019

bors r+

bors bot added a commit that referenced this pull request Aug 2, 2019
147: Implemented batch dispatching r=torkleyy a=AndreaCatania

This is the second iteration to implement the Batch dispatching following the feedback received in this PR: #144 (Was easier for me redo everything rather change it)

This is the project to test this feature: 
[shred_test.zip](https://github.com/slide-rs/shred/files/3363344/shred_test.zip)


Co-authored-by: Andrea Catania <info@andreacatania.com>
@bors
Copy link
Contributor

bors bot commented Aug 2, 2019

Build succeeded

@bors bors bot merged commit cc981d0 into amethyst:master Aug 2, 2019
@AndreaCatania AndreaCatania deleted the batch_2 branch August 2, 2019 06:40
@AndreaCatania
Copy link
Contributor Author

AndreaCatania commented Aug 2, 2019

Guys, thank you a lot!

@AndreaCatania
Copy link
Contributor Author

I would like to update shred in Amethyst and so use this new feature.
@torkleyy can I help you to add a new version in crates.io?

@AnneKitsune
Copy link

I'd just like to precise that I reviewed only half of the PR yesterday (lack of time), which is why I didn't add an "accept" review thingy. However, it as been reviewed by 2 people, so I would tend to think that I would not have found more than 1-2 nitpicks in the second half.

@AndreaCatania
Copy link
Contributor Author

@torkleyy, @Jojolepro any idea about how to create a new version in crates.io?
otherwise I can't use it

@AnneKitsune
Copy link

It depends when torkleyy actually wants to release. I'll ask him.

In the meantime, you can target the git repo using cargo using:

shred = { git = "https://github.com/slide-rs/shred" }
specs = { git = "https://github.com/your_specs_fork" }

For that, you'll need to fork specs and update that Cargo.toml file too so that it targets this repo.

@AndreaCatania
Copy link
Contributor Author

@Jojolepro Thanks for the advice! I wanted to avoid it but that's ok, I can continue to work on phythyst now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants