Skip to content

Commit

Permalink
remove unused argument from get_tokio_runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-J-Ward committed Oct 4, 2024
1 parent 4c34718 commit cafd59e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ impl PySessionContext {
) -> PyResult<PyRecordBatchStream> {
let ctx: TaskContext = TaskContext::from(&self.ctx.state());
// create a Tokio runtime to run the async code
let rt = &get_tokio_runtime(py).0;
let rt = &get_tokio_runtime().0;
let plan = plan.plan.clone();
let fut: JoinHandle<datafusion::common::Result<SendableRecordBatchStream>> =
rt.spawn(async move { plan.execute(part, Arc::new(ctx)) });
Expand Down
4 changes: 2 additions & 2 deletions src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ impl PyDataFrame {

fn execute_stream(&self, py: Python) -> PyResult<PyRecordBatchStream> {
// create a Tokio runtime to run the async code
let rt = &get_tokio_runtime(py).0;
let rt = &get_tokio_runtime().0;
let df = self.df.as_ref().clone();
let fut: JoinHandle<datafusion::common::Result<SendableRecordBatchStream>> =
rt.spawn(async move { df.execute_stream().await });
Expand All @@ -553,7 +553,7 @@ impl PyDataFrame {

fn execute_stream_partitioned(&self, py: Python) -> PyResult<Vec<PyRecordBatchStream>> {
// create a Tokio runtime to run the async code
let rt = &get_tokio_runtime(py).0;
let rt = &get_tokio_runtime().0;
let df = self.df.as_ref().clone();
let fut: JoinHandle<datafusion::common::Result<Vec<SendableRecordBatchStream>>> =
rt.spawn(async move { df.execute_stream_partitioned().await });
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::sync::{Arc, OnceLock};
use tokio::runtime::Runtime;

/// Utility to get the Tokio Runtime from Python
pub(crate) fn get_tokio_runtime(_: Python) -> Arc<TokioRuntime> {
pub(crate) fn get_tokio_runtime() -> Arc<TokioRuntime> {
static RUNTIME: OnceLock<Arc<TokioRuntime>> = OnceLock::new();
RUNTIME
.get_or_init(|| {
Expand All @@ -40,7 +40,7 @@ where
F: Future + Send,
F::Output: Send,
{
let runtime: &Runtime = &get_tokio_runtime(py).0;
let runtime: &Runtime = &get_tokio_runtime().0;
py.allow_threads(|| runtime.block_on(f))
}

Expand Down

0 comments on commit cafd59e

Please sign in to comment.