-
Notifications
You must be signed in to change notification settings - Fork 15
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
Push snapshot diffs before reset, and thread results after #126
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a564f79
Check if we have registered hosts before doing snapshot pushes
Shillaker 4beab68
Started splitting thread results and snapshot diffs
Shillaker f00ef03
Fix up compilation and tests
Shillaker 684875d
Small rearrange
Shillaker 378f0c1
Update comment
Shillaker 3f77e3b
Push snapshot diffs whenever pending
Shillaker 997a2e2
Add checks for zero size snapshots
Shillaker 9a21b62
Slight rework of conditional around snapshots in scheduler
Shillaker acaed2a
Added test for snapshots from child threads
Shillaker 9af666b
Correct wait statement in test
Shillaker b821891
Small comment update
Shillaker d352faa
Started experimenting with other pagetable entries
Shillaker aaca105
Reverting changes moved to other PR
Shillaker 3a3401b
Add missing subtype and context to chained batch call
Shillaker 037cf81
Force slots on dist test server
Shillaker 9b4b005
Merge branch 'dirty-page-fix-2' of github.com:faasm/faabric into dirt…
Shillaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -106,8 +106,7 @@ void Executor::executeTasks(std::vector<int> msgIdxs, | |
|
||
if (isSnapshot && !alreadyRestored) { | ||
if ((!isMaster && isThreads) || !isThreads) { | ||
SPDLOG_DEBUG( | ||
"Performing snapshot restore {} [{}]", funcStr, snapshotKey); | ||
SPDLOG_DEBUG("Restoring {} from snapshot {}", funcStr, snapshotKey); | ||
lastSnapshot = snapshotKey; | ||
restore(firstMsg); | ||
} else { | ||
|
@@ -124,6 +123,7 @@ void Executor::executeTasks(std::vector<int> msgIdxs, | |
// Note this must be done after the restore has happened | ||
if (isThreads && isSnapshot) { | ||
faabric::util::resetDirtyTracking(); | ||
pendingSnapshotPush = true; | ||
} | ||
|
||
// Set executing task count | ||
|
@@ -161,7 +161,7 @@ void Executor::threadPoolThread(int threadPoolIdx) | |
SPDLOG_DEBUG("Thread pool thread {}:{} starting up", id, threadPoolIdx); | ||
|
||
auto& sch = faabric::scheduler::getScheduler(); | ||
auto& conf = faabric::util::getSystemConfig(); | ||
const auto& conf = faabric::util::getSystemConfig(); | ||
|
||
bool selfShutdown = false; | ||
|
||
|
@@ -196,20 +196,24 @@ void Executor::threadPoolThread(int threadPoolIdx) | |
assert(req->messages_size() >= msgIdx + 1); | ||
faabric::Message& msg = req->mutable_messages()->at(msgIdx); | ||
|
||
SPDLOG_TRACE("Thread {}:{} executing task {} ({})", | ||
bool isThreads = req->type() == faabric::BatchExecuteRequest::THREADS; | ||
SPDLOG_TRACE("Thread {}:{} executing task {} ({}, thread={})", | ||
id, | ||
threadPoolIdx, | ||
msgIdx, | ||
msg.id()); | ||
msg.id(), | ||
isThreads); | ||
|
||
int32_t returnValue; | ||
try { | ||
returnValue = executeTask(threadPoolIdx, msgIdx, req); | ||
} catch (const std::exception& ex) { | ||
returnValue = 1; | ||
|
||
msg.set_outputdata(fmt::format( | ||
"Task {} threw exception. What: {}", msg.id(), ex.what())); | ||
std::string errorMessage = fmt::format( | ||
"Task {} threw exception. What: {}", msg.id(), ex.what()); | ||
SPDLOG_ERROR(errorMessage); | ||
msg.set_outputdata(errorMessage); | ||
} | ||
|
||
// Set the return value | ||
|
@@ -221,21 +225,21 @@ void Executor::threadPoolThread(int threadPoolIdx) | |
bool isLastTask = oldTaskCount == 1; | ||
|
||
SPDLOG_TRACE("Task {} finished by thread {}:{} ({} left)", | ||
msg.id(), | ||
faabric::util::funcToString(msg, true), | ||
id, | ||
threadPoolIdx, | ||
executingTaskCount); | ||
oldTaskCount - 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logging wasn't thread-safe by accessing |
||
|
||
// Get snapshot diffs _before_ we reset the executor | ||
bool isThreads = req->type() == faabric::BatchExecuteRequest::THREADS; | ||
std::vector<faabric::util::SnapshotDiff> diffs; | ||
if (isLastTask && isThreads) { | ||
// Handle snapshot diffs _before_ we reset the executor | ||
if (isLastTask && pendingSnapshotPush) { | ||
// Get diffs | ||
faabric::util::SnapshotData d = snapshot(); | ||
diffs = d.getDirtyPages(); | ||
std::vector<faabric::util::SnapshotDiff> diffs = d.getDirtyPages(); | ||
sch.pushSnapshotDiffs(msg, diffs); | ||
|
||
// Reset dirty page tracking now that we've got the diffs | ||
// Reset dirty page tracking now that we've pushed the diffs | ||
faabric::util::resetDirtyTracking(); | ||
pendingSnapshotPush = false; | ||
} | ||
|
||
// If this batch is finished, reset the executor and release its claim. | ||
|
@@ -255,14 +259,7 @@ void Executor::threadPoolThread(int threadPoolIdx) | |
// on its result to continue execution, therefore must be done once the | ||
// executor has been reset, otherwise the executor may not be reused for | ||
// a repeat invocation. | ||
if (isLastTask && isThreads) { | ||
// Send diffs along with thread result | ||
SPDLOG_DEBUG("Task {} finished, returning {} snapshot diffs", | ||
msg.id(), | ||
diffs.size()); | ||
|
||
sch.setThreadResult(msg, returnValue, diffs); | ||
} else if (isThreads) { | ||
if (isThreads) { | ||
// Set non-final thread result | ||
sch.setThreadResult(msg, returnValue); | ||
} else { | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was never implemented/ used