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

ARROW-17350: [C++] Create a scheduler for asynchronous work #13912

Merged
merged 10 commits into from
Sep 2, 2022

Conversation

westonpace
Copy link
Member

No description provided.

@westonpace
Copy link
Member Author

This is a draft, there is still a flaky test and a deadlock in the exec plans but those should be pretty straightforward to address. I was able to replace the dataset writer's scheduling with the new AsyncTaskScheduler and all dataset writer tests are passing so I think the scheduler itself is getting pretty solid.

@github-actions
Copy link

@github-actions
Copy link

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks reasonable. I left some minor comments.

/// If the scheduler is in an ended state then this call will cause an abort. This
/// represents a logic error in the program and should be avoidable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should error instead just so that a bug doesn't, say, tear down a notebook kernel or crash the R interpreter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change it to a warning. It is "pretty safe" to just ignore the task. However, once a scheduler has ended the scheduler, and any resources tied to it, are effectively available for deletion. So even if we don't abort here it is likely that there will be some dangling references/pointers that will explode later on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, in that case it might be better to crash in a controlled fashion. Maybe adding a message to the DCHECK to give some context would help?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a message to the dcheck and added a lengthier explanation in a comment before the dcheck which will hopefully assist future developers.

There is potentially one scenario where adding a task after the scheduler has ended is ok and this is where the code doing the task-adding is a task on the scheduler itself. This scenario popped up in the tpc-h generator but I was able to work around it. For the moment I'd like to keep things as they are but I'm open to possibly softening this requirement down the road.

It's may be possible to get of End entirely by requiring that all tasks are added by existing tasks. Creating the initial scheduler would then require supplying an "initial_task". In that case we would know that a scheduler is finished when it runs out of tasks and would never need an End call. I'll leave that for a follow-up (ARROW-17509)

cpp/src/arrow/util/async_util.h Show resolved Hide resolved
cpp/src/arrow/util/async_util.cc Show resolved Hide resolved
cpp/src/arrow/dataset/file_base.cc Show resolved Hide resolved
@westonpace westonpace force-pushed the experiment/task-group branch from ba573ab to 317368d Compare August 24, 2022 00:09
@westonpace westonpace marked this pull request as ready for review August 24, 2022 00:25
@westonpace westonpace requested a review from lidavidm August 24, 2022 00:25
@westonpace
Copy link
Member Author

The ASAN error seems legitimate but I believe I've addressed review comments and fixed most of the bugs. This is probably ready for another review while I work through this issue.

cpp/src/arrow/util/async_util.cc Show resolved Hide resolved
cpp/src/arrow/util/async_util_benchmark.cc Outdated Show resolved Hide resolved
@westonpace westonpace force-pushed the experiment/task-group branch from 65efaff to ee646b0 Compare August 24, 2022 23:36
@westonpace
Copy link
Member Author

Sorry, let this linger a bit, I'm going to rebase and then merge if still green.

@westonpace westonpace force-pushed the experiment/task-group branch from ee646b0 to f6b3491 Compare August 29, 2022 21:47
@westonpace westonpace merged commit 0527197 into apache:master Sep 2, 2022
@ursabot
Copy link

ursabot commented Sep 2, 2022

Benchmark runs are scheduled for baseline = a8bb7f4 and contender = 0527197. 0527197 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Failed ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed] test-mac-arm
[Failed ⬇️0.55% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️1.74% ⬆️0.46%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 0527197c ec2-t3-xlarge-us-east-2
[Failed] 0527197c test-mac-arm
[Failed] 0527197c ursa-i9-9960x
[Finished] 0527197c ursa-thinkcentre-m75q
[Failed] a8bb7f4b ec2-t3-xlarge-us-east-2
[Failed] a8bb7f4b test-mac-arm
[Failed] a8bb7f4b ursa-i9-9960x
[Finished] a8bb7f4b ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@ursabot
Copy link

ursabot commented Sep 2, 2022

['Python', 'R'] benchmarks have high level of regressions.
ursa-i9-9960x

zagto pushed a commit to zagto/arrow that referenced this pull request Oct 7, 2022
fatemehp pushed a commit to fatemehp/arrow that referenced this pull request Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants