-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Convert some local scheduler data structures to C++ STL. #445
Conversation
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
"Tried to kill worker that doesn't exist"); | ||
auto it = std::find(state->workers.begin(), state->workers.end(), worker); | ||
CHECK(it != state->workers.end()); | ||
std::swap(*it, state->workers.back()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only want to do this if it
is not equal to the last element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For efficiency reasons? The swap should be pretty cheap and this would add an extra if
all of the time, right?
|
||
/* Make sure that we removed the worker. */ | ||
it = std::find(state->workers.begin(), state->workers.end(), worker); | ||
CHECK(it == state->workers.end()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check doesn't really seem necessary anymore.
@@ -78,28 +77,25 @@ int force_kill_worker(event_loop *loop, timer_id id, void *context) { | |||
* to clean up its own state. | |||
* @return Void. | |||
*/ | |||
void kill_worker(LocalSchedulerClient *worker, bool cleanup) { | |||
void kill_worker(LocalSchedulerState *state, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to state
as an argument here (LocalSchedulerClient
s should have a reference to it).
auto it = std::find(algorithm_state->executing_workers.begin(), | ||
algorithm_state->executing_workers.end(), worker); | ||
if (it != algorithm_state->executing_workers.end()) { | ||
std::swap(*it, algorithm_state->executing_workers.back()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here for if the pointers are the same. It would be good to have a helper function for this.
/** A hash map of the objects that are not available locally. These are | ||
* currently being fetched by this local scheduler. The key is the object | ||
* ID. Every LOCAL_SCHEDULER_FETCH_TIMEOUT_MILLISECONDS, a Plasma fetch | ||
* request will be sent the object IDs in this table. Each entry also holds | ||
* an array of queued tasks that are dependent on it. */ | ||
object_entry *remote_objects; | ||
std::unordered_map<ObjectID, ObjectEntry *, UniqueIDHasher> remote_objects; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one and local_objects
can just be std::unordered_map<ObjectID, ObjectEntry, UniqueIDHasher>
, to avoid allocation/deallocation.
Merged build finished. Test FAILed. |
Test FAILed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Merged build finished. Test PASSed. |
Test PASSed. |
This makes some more progress on #404. In particular,
std::unordered_map
in the local schedulerstd::vector
in the local scheduler