pub struct ScheduleDefinition {
pub job_timing_policy: ScheduleJobTimingPolicy,
pub job_creation_policy: ScheduleJobCreationPolicy,
pub labels: IndexMap<String, String>,
pub time_range: Option<ScheduleTimeRange>,
pub metadata_json: Option<String>,
pub propagate_labels_to_jobs: bool,
}
Expand description
A new schedule.
Fields§
§job_timing_policy: ScheduleJobTimingPolicy
Scheduling policy for the schedule.
job_creation_policy: ScheduleJobCreationPolicy
Policy for new jobs created by the schedule.
labels: IndexMap<String, String>
Labels of the schedule.
time_range: Option<ScheduleTimeRange>
The time range for the schedule.
The schedule must not start before start
and must end before end
.
metadata_json: Option<String>
Arbitrary metadata in JSON format.
propagate_labels_to_jobs: bool
Whether to copy schedule labels to created jobs.
Labels are not overwritten if they already exist on the job.
Note that this is a client-side operation that is done before the schedule is submitted to the server for creation.
By default, this is true
.
Implementations§
Source§impl ScheduleDefinition
impl ScheduleDefinition
Sourcepub fn immediate(self) -> Self
pub fn immediate(self) -> Self
Set the schedule to immediately create a job when started.
This is a no-op for timing policies that do not support it.
Sourcepub fn start_after(self, start: SystemTime) -> Self
pub fn start_after(self, start: SystemTime) -> Self
Set a start time for the schedule.
Sourcepub fn end_before(self, end: SystemTime) -> Self
pub fn end_before(self, end: SystemTime) -> Self
Set an end time for the schedule.
Sourcepub fn with_label(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_label( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a label to the schedule.
Note that this will not set any labels for jobs created by the schedule.
Sourcepub fn with_label_json(
self,
key: impl Into<String>,
value: impl Serialize,
) -> Self
pub fn with_label_json( self, key: impl Into<String>, value: impl Serialize, ) -> Self
Sourcepub fn replace_metadata(self, metadata: impl Serialize) -> Self
pub fn replace_metadata(self, metadata: impl Serialize) -> Self
Set additional metadata for the schedule.
Note that this will replace any existing metadata.
§Panics
If the metadata cannot be serialized to JSON.
Sourcepub fn propagate_labels(self, propagate: bool) -> Self
pub fn propagate_labels(self, propagate: bool) -> Self
Whether to propagate schedule labels to created jobs.
Labels are not overwritten if they already exist on the job.
Note that this is a client-side operation that is done before the schedule is submitted to the server for creation.
By default, this is true
.
Trait Implementations§
Source§impl Clone for ScheduleDefinition
impl Clone for ScheduleDefinition
Source§fn clone(&self) -> ScheduleDefinition
fn clone(&self) -> ScheduleDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ScheduleDefinition
impl Debug for ScheduleDefinition
Source§impl From<ScheduleDefinition> for ScheduleDefinition
impl From<ScheduleDefinition> for ScheduleDefinition
Source§fn from(definition: ScheduleDefinition) -> Self
fn from(definition: ScheduleDefinition) -> Self
Auto Trait Implementations§
impl Freeze for ScheduleDefinition
impl RefUnwindSafe for ScheduleDefinition
impl Send for ScheduleDefinition
impl Sync for ScheduleDefinition
impl Unpin for ScheduleDefinition
impl UnwindSafe for ScheduleDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<W> IntoExecutionHandler for W
impl<W> IntoExecutionHandler for W
Source§fn handler<J>(self) -> Arc<dyn ExecutionHandlerRaw + Send + Sync>where
Self: ExecutionHandler<J>,
J: JobType,
fn handler<J>(self) -> Arc<dyn ExecutionHandlerRaw + Send + Sync>where
Self: ExecutionHandler<J>,
J: JobType,
self
into a [RawHandler
] that can be registered
in workers.Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request