Skip to main content

ExecutionContext

Struct ExecutionContext 

Source
pub struct ExecutionContext { /* private fields */ }
Expand description

Immutable execution configuration shared by native query execution.

The context owns or shares the cudf::Runtime used for all device work in a query. The runtime determines the CUDA device, stream, and memory resource; the query engine layers its own chunk-planning, reservation, retry, and boundary policies on top of that runtime. Cloning the context is cheap and keeps the same runtime/cache handles.

Implementations§

Source§

impl ExecutionContext

Source

pub fn validate_admitted_plan_capabilities( &self, plan: &QueryPlan, ) -> Result<()>

Universal pre-GPU gate for service-created execution contexts. Direct contexts remain unrestricted and return success without evidence.

Source

pub fn with_admitted_gpu_inputs( &self, plan: &QueryPlan, gpu_inputs: &GpuResidentInputMap, ) -> Result<Self>

Activates the deferred-resident phase for plan from its exact materialized resident inputs.

Expected producer, occurrence, and schema identities come from the admitted compiled binding. Runtime frame identities are recorded only after those independent facts have matched.

Source

pub fn validate_admitted_composed_attempt( &self, consumer_plan: &QueryPlan, occurrence_ids: &[String], ) -> Result<Option<AttemptComposedScheduleProjection>>

Validates one composed attempt against its admitted capability and resident-input identity contracts. Physical allocation remains owned by the immutable grant and live resident handles.

Source§

impl ExecutionContext

Source

pub fn service_stream_pool(&self) -> QueryServiceStreamPool

Returns the service-level CUDA stream pool used by source-read workers.

The pool is wrapped with this context’s service epoch and query anchor, so a lease taken through it is revoked with the attempt and keeps the service from reaching idle. A standalone context wraps neither.

Source

pub fn lakehouse_cache_fill_acquire_timeout(&self) -> Duration

Timeout used by blocking lakehouse cache maintenance resource acquisition.

Source

pub fn lakehouse_cache_fill_budget(&self) -> CacheFillByteBudget

Returns the service-wide background lakehouse cache-fill byte budget.

Source§

impl ExecutionContext

Source

pub fn runtime(&self) -> Result<CudfRuntime>

Returns the cudf runtime used for all GPU operations.

Source

pub fn acquire_io_lease( &self, operation: &'static str, ) -> Result<Option<IoLifecycleLease>>

Acquire permission for one file-backed native I/O call.

Standalone library contexts without a server lifecycle remain unrestricted. Server contexts carry one generation gate and reject acquisitions after graceful shutdown begins.

Source

pub fn with_io_lifecycle(self, lifecycle: IoLifecycle) -> Self

Attach a server-generation I/O lifecycle to this context clone.

Source

pub fn shared_runtime(&self) -> Result<Arc<CudfRuntime>>

Returns a shared handle to the runtime.

The caller receives the same runtime object. A new runtime with copied configuration is not created.

Source

pub fn gpu_executor(&self) -> Result<GpuExecutorLease>

Returns an opaque lifecycle-bound executor for synchronous GPU work on this context’s device.

The lease’s query-execution job follows this context’s own claim on the attempt: a root context runs it as root-class work, while an auxiliary fragment context, which is a second native island of the same attempt, runs it as auxiliary work backed by the attempt auxiliary permit that context already holds. Root capacity is one job per admitted attempt, so a second island charging it would fail where it has a reserved auxiliary slot of its own.

Source

pub fn query_id(&self) -> Option<&QueryId>

Returns the query-wide diagnostic correlation id.

Source

pub fn trace_id(&self) -> Option<&TraceId>

Returns the optional parent trace id.

Source

pub fn runtime_observation(&self) -> &RuntimeObservationHandle

Returns the shared recording handle without terminal-seal authority.

Source

pub fn runtime_execution_scope( &self, ) -> Option<&RuntimeExecutionObservationScope>

Returns the active native plan-execution scope.

Source

pub fn with_runtime_gpu_stream_scope( &self, scope: RuntimeStreamLeaseScope, ) -> Self

Returns a clone carrying explicit GPU job/worker correlation.

Source

pub fn with_query_id(&self, query_id: impl Into<QueryId>) -> Result<Self>

Returns a cloned context with a diagnostic query id consistent with observation identity.

Source

pub fn with_trace_id(&self, trace_id: impl Into<TraceId>) -> Result<Self>

Returns a cloned context with a trace id consistent with observation identity.

Source

pub fn is_query_service_admitted(&self) -> bool

Returns whether this context is backed by a QueryService admission slot.

Source

pub fn cancellation(&self) -> &ExecutionCancellation

Returns the cooperative cancellation flag for this execution.

Source

pub fn check_cancellation(&self, operation: &'static str) -> Result<()>

Fails with a structured cancellation error if the execution was cancelled.

The service epoch, the query epoch, and the cancellation token are checked in that order. All three fail with QueryErrorCode::Cancelled; the reason fact names the closed epoch or the elapsed deadline, and a caller cancellation carries none.

Source

pub fn device(&self) -> DeviceId

CUDA device that runs this context’s work.

Source

pub fn memory_control_policy(&self) -> MemoryControlPolicy

Returns the engine-level memory control policy.

Source

pub fn memory_grant(&self) -> Result<Option<MemoryGrant>>

Returns the soft governor grant carried by this context, when present.

The clone is bound to this context’s resource epoch. Resident owner leases derived from it keep only the service generation (see QueryServiceResourceEpoch::service_generation_only), because frozen residents outlive the attempt.

Source

pub fn execution_budget_token( &self, request: ExecutionBudgetRequest, ) -> Result<ExecutionBudgetToken>

Shares this stream’s member for a budgeted execution stage.

The stage request cannot change the immutable query-domain cap.

Source

pub fn attempt_allocation_domain_id(&self) -> Option<u64>

Returns the immutable domain id for this admitted attempt.

Source

pub fn attempt_allocation_domain_usage( &self, ) -> Result<Option<QueryMemoryDomainUsage>>

Samples the allocation-domain current and peak usage.

Source

pub fn device_budget_bytes(&self) -> u64

Returns the device budget used by reservation tracking.

Source

pub fn source_scheduler_policy(&self) -> SourceSchedulerPolicy

Returns source scheduling controls for bounded source execution.

Source

pub fn source_chunk_planning_mode(&self) -> SourceChunkPlanningMode

Returns the source chunk planning mode.

Source

pub fn statistical_aggregate_execution_mode( &self, ) -> StatisticalAggregateExecutionMode

Returns the selected execution contract for floating statistical aggregates.

Source

pub fn datafusion_order_tracking(&self) -> bool

Returns whether this query preserves DataFusion input order for floating statistical aggregates.

Native execution derives this per query from the aggregate execution mode and the plan shape, then carries it on every context clone so source-read workers on spawned threads observe the same scope as the caller thread.

Source

pub fn with_datafusion_order_tracking(self, enabled: bool) -> Self

Attaches the per-query DataFusion exact-order scope to this context clone.

Source

pub fn aggregate_strategy_execution_options( &self, ) -> AggregateStrategyExecutionOptions

Returns grouped aggregate strategy execution policy.

Source

pub fn planning_policy(&self) -> PlanningPolicy

Join and dynamic-filter thresholds a plan executed without an admission artifact is admitted under.

Source

pub fn source_chunk_planning_options(&self) -> SourceChunkPlanningOptions

Returns expert local-throughput source chunk planning policy.

Trait Implementations§

Source§

impl Clone for ExecutionContext

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExecutionContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more