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 TaskListener #1404
Add TaskListener #1404
Conversation
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
2b12137
to
3a5a5a9
Compare
@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Add a mechanism to register a listener to receive task completion events. This is useful for logging and debugging. Pull Request resolved: facebookincubator#1404 Differential Revision: D35579103 Pulled By: mbasmanova fbshipit-source-id: ef8537fe86ceca442e545c9e036e150f2883cf6d
3a5a5a9
to
5b15b73
Compare
This pull request was exported from Phabricator. Differential Revision: D35579103 |
Summary: Add a mechanism to register a listener to receive task completion events. This is useful for logging and debugging. Pull Request resolved: facebookincubator#1404 Differential Revision: D35579103 Pulled By: mbasmanova fbshipit-source-id: 66030ecf75571e731dc0cde2d8b10985b518bbc9
5b15b73
to
608b388
Compare
This pull request was exported from Phabricator. Differential Revision: D35579103 |
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.
@mbasmanova great addition! Just have some minor comments.
|
||
bool unregisterTaskListener(const std::shared_ptr<TaskListener>& listener) { | ||
return listeners().withWLock([&](auto& listeners) { | ||
for (auto it = listeners.begin(); it != listeners.end(); ++it) { |
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.
can we use for (const auto& entry : listeners)
?
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 realized erase
needs an iterator.
I saw another erase-remove-idiom listeners.erase(std::remove(listeners.begin(), listeners.end(), listener), listeners.end());
here https://stackoverflow.com/questions/3385229/c-erase-vector-element-by-value-rather-than-by-position
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 find this one more readable. What do you think?
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.
Yeah, it is verbose. The current pattern is fine.
velox/exec/Task.cpp
Outdated
|
||
void registerTaskListener(std::shared_ptr<TaskListener> listener) { | ||
listeners().withWLock( | ||
[&](auto& listeners) { listeners.push_back(std::move(listener)); }); |
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.
should we check if the listener is already added? It could happen due to an incorrect user application.
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.
We could have a check and not add a duplicate if already exists.
This pull request was exported from Phabricator. Differential Revision: D35579103 |
Summary: Add a mechanism to register a listener to receive task completion events. This is useful for logging and debugging. Pull Request resolved: facebookincubator#1404 Differential Revision: D35579103 Pulled By: mbasmanova fbshipit-source-id: 89d86ad3cc10a92902febdfa93f824590cb146b5
608b388
to
57d8f18
Compare
@majetideepak Deepak, thank you for review. Updated to address the comments. |
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.
@mbasmanova thanks, Masha.
Summary: Add a mechanism to register a listener to receive task completion events. This is useful for logging and debugging. Pull Request resolved: facebookincubator#1404 Reviewed By: pedroerp Differential Revision: D35579103 Pulled By: mbasmanova fbshipit-source-id: f81d18b66660f04c5dc3ab5779ac8cb3232ef9c1
This pull request was exported from Phabricator. Differential Revision: D35579103 |
57d8f18
to
b586d73
Compare
Summary: Add a mechanism to register a listener to receive runtime statistics about expression evaluation at destruction of ExprSet. This is useful for logging and debugging. An earlier PR facebookincubator#1404 introduced a similar mechanism to receive runtime statistics about Task execution. Pull Request resolved: facebookincubator#1428 Differential Revision: D35656774 Pulled By: mbasmanova fbshipit-source-id: c26bf2a38eb8122324d04bf9aceee2f9e2720b0f
Summary: Add a mechanism to register a listener to receive runtime statistics about expression evaluation at destruction of ExprSet. This is useful for logging and debugging. An earlier PR facebookincubator#1404 introduced a similar mechanism to receive runtime statistics about Task execution. Pull Request resolved: facebookincubator#1428 Reviewed By: pedroerp Differential Revision: D35656774 Pulled By: mbasmanova fbshipit-source-id: 87d17f50788106b090b3585d07d21ff401acc6be
Summary: Add a mechanism to register a listener to receive runtime statistics about expression evaluation at destruction of ExprSet. This is useful for logging and debugging. An earlier PR #1404 introduced a similar mechanism to receive runtime statistics about Task execution. Pull Request resolved: #1428 Reviewed By: pedroerp Differential Revision: D35656774 Pulled By: mbasmanova fbshipit-source-id: 6f18a75d622b44800ec6d8a28984d58cd592ac3f
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.
Thanks for this API.
Summary: Add a mechanism to register a listener to receive runtime statistics about expression evaluation at destruction of ExprSet. This is useful for logging and debugging. An earlier PR facebookincubator#1404 introduced a similar mechanism to receive runtime statistics about Task execution. Pull Request resolved: facebookincubator#1428 Reviewed By: pedroerp Differential Revision: D35656774 Pulled By: mbasmanova fbshipit-source-id: 6f18a75d622b44800ec6d8a28984d58cd592ac3f
Summary: Add a mechanism to register a listener to receive task completion events. This is useful for logging and debugging. Pull Request resolved: facebookincubator#1404 Reviewed By: pedroerp Differential Revision: D35579103 Pulled By: mbasmanova fbshipit-source-id: 0fd6f9a199ea151a482ef43d72c8c8c18dc547f8
Summary: Add a mechanism to register a listener to receive runtime statistics about expression evaluation at destruction of ExprSet. This is useful for logging and debugging. An earlier PR facebookincubator#1404 introduced a similar mechanism to receive runtime statistics about Task execution. Pull Request resolved: facebookincubator#1428 Reviewed By: pedroerp Differential Revision: D35656774 Pulled By: mbasmanova fbshipit-source-id: 6f18a75d622b44800ec6d8a28984d58cd592ac3f
…le select from empty table/partition (facebookincubator#1345) What changes were proposed in this pull request? Bug fix no result returned in max/min/sum/count while select from empty table/partition the related pr of clickhouse backend: Kyligence/ClickHouse#424 the related issue: Kyligence/ClickHouse#425 fix issue facebookincubator#1404 How was this patch tested? by unit test
Add a mechanism to register a listener to receive task completion events. This
is useful for logging and debugging.