-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: Add task abortion test #11881
base: main
Are you sure you want to change the base?
feat: Add task abortion test #11881
Conversation
This pull request was exported from Phabricator. Differential Revision: D67267972 |
✅ Deploy Preview for meta-velox canceled.
|
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.
@zation99 LGTM % minors. Please also have an review from @tanjialiang Thanks!
Summary: A new thread to randomly tasks. It uses flag seconds_to_abort to control the frequency. Reviewed By: xiaoxmeng Differential Revision: D67267972
b8e89af
to
f5e6175
Compare
This pull request was exported from Phabricator. Differential Revision: D67267972 |
Summary: A new thread to randomly tasks. It uses flag seconds_to_abort to control the frequency. Reviewed By: xiaoxmeng Differential Revision: D67267972
f5e6175
to
59c3877
Compare
This pull request was exported from Phabricator. Differential Revision: D67267972 |
Summary: A new thread to randomly tasks. It uses flag seconds_to_abort to control the frequency. Reviewed By: xiaoxmeng Differential Revision: D67267972
59c3877
to
48978e8
Compare
This pull request was exported from Phabricator. Differential Revision: D67267972 |
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.
if (FLAGS_task_abort_interval_ms == 0) { | ||
return; | ||
} | ||
while (!stop) { | ||
std::this_thread::sleep_for( | ||
std::chrono::milliseconds(FLAGS_task_abort_interval_ms)); | ||
auto tasksList = Task::getRunningTasks(); | ||
auto index = getRandomIndex(rng_, tasksList.size() - 1); | ||
++taskAbortRequestCount; | ||
tasksList[index]->requestAbort(); | ||
} |
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.
Shall we have error handling in this thread, by having a try and catch all block
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.
Also we can consider to use folly:FunctionScheduler to achieve the periodic scheduling of this task. It provides better functionality and encapsulations.
Summary: A new thread to randomly tasks. It uses flag seconds_to_abort to control the frequency. Reviewed By: xiaoxmeng Differential Revision: D67267972
48978e8
to
4d5ad71
Compare
This pull request was exported from Phabricator. Differential Revision: D67267972 |
Summary: A new thread to randomly tasks. It uses flag seconds_to_abort to control the frequency. Reviewed By: xiaoxmeng Differential Revision: D67267972
4d5ad71
to
fa37bf4
Compare
This pull request was exported from Phabricator. Differential Revision: D67267972 |
Summary: A new thread to randomly tasks. It uses flag
task_abort_interval_ms
to control the frequency.Differential Revision: D67267972