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

Add TaskListener #1404

Closed
wants to merge 1 commit into from
Closed

Conversation

mbasmanova
Copy link
Contributor

Add a mechanism to register a listener to receive task completion events. This
is useful for logging and debugging.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 12, 2022
@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

mbasmanova added a commit to mbasmanova/velox-1 that referenced this pull request Apr 12, 2022
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D35579103

mbasmanova added a commit to mbasmanova/velox-1 that referenced this pull request Apr 12, 2022
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D35579103

Copy link
Collaborator

@majetideepak majetideepak left a 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) {
Copy link
Collaborator

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) ?

Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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.


void registerTaskListener(std::shared_ptr<TaskListener> listener) {
listeners().withWLock(
[&](auto& listeners) { listeners.push_back(std::move(listener)); });
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D35579103

mbasmanova added a commit to mbasmanova/velox-1 that referenced this pull request Apr 12, 2022
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
@mbasmanova
Copy link
Contributor Author

@majetideepak Deepak, thank you for review. Updated to address the comments.

Copy link
Collaborator

@majetideepak majetideepak left a 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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D35579103

@mbasmanova mbasmanova mentioned this pull request Apr 14, 2022
mbasmanova added a commit to mbasmanova/velox-1 that referenced this pull request Apr 14, 2022
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
mbasmanova added a commit to mbasmanova/velox-1 that referenced this pull request Apr 14, 2022
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
facebook-github-bot pushed a commit that referenced this pull request Apr 15, 2022
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
Copy link
Collaborator

@aditi-pandit aditi-pandit left a 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.

Arty-Maly pushed a commit to Arty-Maly/velox that referenced this pull request May 13, 2022
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
shiyu-bytedance pushed a commit to shiyu-bytedance/velox-1 that referenced this pull request Aug 18, 2022
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
shiyu-bytedance pushed a commit to shiyu-bytedance/velox-1 that referenced this pull request Aug 18, 2022
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
marin-ma pushed a commit to marin-ma/velox-oap that referenced this pull request Dec 15, 2023
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants