-
Notifications
You must be signed in to change notification settings - Fork 34
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: Spawn layout evaluation #2348
Merged
Merged
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
308d804
.
AdamGS 6978c28
.
AdamGS bea1dbc
.
AdamGS 29e1da2
enable feature
AdamGS c78ed3a
.
AdamGS ef2bf80
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS 322c72a
nicer version
AdamGS b4a5b08
.
AdamGS a90fd9d
.
AdamGS 96e119d
.
AdamGS aead48a
.
AdamGS be57a8f
some work, need to unifiy to one spawn
AdamGS c744f90
.
AdamGS bd4c6ff
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS 6dbab42
.
AdamGS defc115
VortexResult::flatten -> unnest (#2361)
AdamGS 45b39a1
.
AdamGS fadcc6d
.
AdamGS 8a127ec
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS bf14120
.
AdamGS 539bacb
.
AdamGS 6032cbe
go back to higher default concurrency, not sure how to pick that number
AdamGS 625789d
.
AdamGS 3e91ef8
.
AdamGS 8c568e9
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS d6381e4
.
AdamGS cab3012
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS df579e9
.
AdamGS 78f4eb0
.
AdamGS 41aa3d1
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS a643a5d
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS b1133f1
cleanup ScanExecutor, move some tests to rstest
AdamGS 169bea9
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS f210bbc
Merge branch 'develop' into adamg/spawn-evaluate
AdamGS 5e171f2
Merge branch 'develop' into adamg/spawn-evaluate
gatesn f3ecbb7
typo
AdamGS 32067e1
CR comments
AdamGS ea6103c
.
AdamGS a775f89
remove unused code
AdamGS 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#[cfg(feature = "tokio")] | ||
mod tokio; | ||
|
||
use std::future::Future; | ||
use std::pin::Pin; | ||
use std::task::{Context, Poll}; | ||
|
||
use futures::channel::oneshot; | ||
use futures::FutureExt as _; | ||
#[cfg(feature = "tokio")] | ||
pub use tokio::*; | ||
use vortex_error::{vortex_err, VortexResult}; | ||
|
||
pub struct JoinHandle<T> { | ||
inner: oneshot::Receiver<T>, | ||
} | ||
|
||
impl<T> Future for JoinHandle<T> { | ||
type Output = VortexResult<T>; | ||
|
||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | ||
match self.inner.poll_unpin(cx) { | ||
Poll::Ready(Ok(v)) => Poll::Ready(Ok(v)), | ||
Poll::Ready(Err(_)) => Poll::Ready(Err(vortex_err!("Task was canceled"))), | ||
Poll::Pending => Poll::Pending, | ||
} | ||
} | ||
} | ||
|
||
pub trait Spawn { | ||
fn spawn<F>(&self, f: F) -> JoinHandle<F::Output> | ||
where | ||
F: Future + Send + 'static, | ||
<F as Future>::Output: Send + 'static; | ||
} | ||
|
||
#[derive(Default, Clone)] | ||
pub struct InlineExecutor; | ||
|
||
#[async_trait::async_trait] | ||
impl Spawn for InlineExecutor { | ||
fn spawn<F>(&self, f: F) -> JoinHandle<F::Output> | ||
where | ||
F: Future + Send + 'static, | ||
<F as Future>::Output: Send + 'static, | ||
{ | ||
let (tx, rx) = oneshot::channel(); | ||
// This is very hacky and probably not a great idea, but I don't have a much better idea on how to have a sane default here. | ||
futures::executor::block_on(async move { | ||
_ = tx.send(f.await); | ||
}); | ||
|
||
JoinHandle { inner: rx } | ||
} | ||
} | ||
|
||
#[derive(Clone)] | ||
pub enum Executor { | ||
Inline(InlineExecutor), | ||
#[cfg(feature = "tokio")] | ||
Tokio(TokioExecutor), | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl Spawn for Executor { | ||
fn spawn<F>(&self, f: F) -> JoinHandle<F::Output> | ||
where | ||
F: Future + Send + 'static, | ||
<F as Future>::Output: Send + 'static, | ||
{ | ||
match self { | ||
Executor::Inline(inline_executor) => inline_executor.spawn(f), | ||
#[cfg(feature = "tokio")] | ||
Executor::Tokio(tokio_executor) => tokio_executor.spawn(f), | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::future::Future; | ||
|
||
use futures::channel::oneshot; | ||
use tokio::runtime::Handle; | ||
|
||
use super::{JoinHandle, Spawn}; | ||
|
||
#[derive(Clone)] | ||
pub struct TokioExecutor(Handle); | ||
|
||
impl TokioExecutor { | ||
pub fn new(handle: Handle) -> Self { | ||
Self(handle) | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl Spawn for TokioExecutor { | ||
fn spawn<F>(&self, f: F) -> JoinHandle<F::Output> | ||
where | ||
F: Future + Send + 'static, | ||
<F as Future>::Output: Send + 'static, | ||
{ | ||
let (tx, rx) = oneshot::channel(); | ||
|
||
self.0.spawn(async move { | ||
let v = f.await; | ||
_ = tx.send(v); | ||
}); | ||
|
||
JoinHandle { inner: rx } | ||
} | ||
} |
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 is a flyby but seems like it can be blocking now? potentially not even needed but I'm not sure what are your plans for it