InMemoryJobState

Struct InMemoryJobState 

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

Implementation of JobState which keeps all state in memory. If using InMemoryJobState no job state will be shared between schedulers

Implementations§

Source§

impl InMemoryJobState

Source

pub fn new( scheduler: impl Into<String>, session_builder: fn(SessionConfig) -> SessionState, ) -> Self

Trait Implementations§

Source§

impl JobState for InMemoryJobState

Source§

fn submit_job<'life0, 'life1, 'async_trait>( &'life0 self, job_id: String, graph: &'life1 ExecutionGraph, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submit a new job to the JobState. It is assumed that the submitter owns the job. In local state the job should be save as JobStatus::Active and in shared state it should be saved as JobStatus::Running with scheduler set to the current scheduler
Source§

fn get_job_status<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<JobStatus>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch the job status
Source§

fn get_execution_graph<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ExecutionGraph>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the ExecutionGraph for job. The job may or may not belong to the caller and should return the ExecutionGraph for the given job (if it exists) at the time this method is called with no guarantees that the graph has not been subsequently updated by another scheduler.
Source§

fn try_acquire_job<'life0, 'life1, 'async_trait>( &'life0 self, _job_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ExecutionGraph>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempt to acquire ownership of the given job. If the job is still in a running state and is successfully acquired by the caller, return the current ExecutionGraph, otherwise return None
Source§

fn save_job<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, job_id: &'life1 str, graph: &'life2 ExecutionGraph, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist the current state of an owned job to global state. This should fail if the job is not owned by the caller.
Source§

fn get_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<SessionContext>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the SessionContext associated with session_id. Returns an error if the session does not exist
Source§

fn create_session<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 KapotConfig, ) -> Pin<Box<dyn Future<Output = Result<Arc<SessionContext>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new saved session
Source§

fn update_session<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 str, config: &'life2 KapotConfig, ) -> Pin<Box<dyn Future<Output = Result<Arc<SessionContext>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn remove_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<SessionContext>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn job_state_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<JobStateEventStream>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a stream of all JobState events. An event should be published any time that status of a job changes in state
Source§

fn remove_job<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a job from the global state
Source§

fn get_jobs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashSet<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a Vec of all active job IDs in the JobState
Source§

fn accept_job(&self, job_id: &str, job_name: &str, queued_at: u64) -> Result<()>

Accept job into a scheduler’s job queue. This should be called when a job is received by the scheduler but before it is planned and may or may not be saved in global state
Source§

fn pending_job_number(&self) -> usize

Get the number of queued jobs. If it’s big, then it means the scheduler is too busy. In normal case, it’s better to be 0.
Source§

fn fail_unscheduled_job<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 str, reason: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a job which has not been submitted as failed. This should be called if a job fails during planning (and does not yet have an ExecutionGraph)

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> 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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: 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: 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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