public interface ScheduleBuilder
triggerByTime(String)
or triggerOnPartitions(String, int)
. To set the constraints for the schedule, use methods withConcurrency(int)
, withDelay(long, TimeUnit)
, withTimeWindow(String,
String)
, withTimeWindow(String, String, TimeZone)
, and withDurationSinceLastRun(long, TimeUnit)
. If no constraint is specified, the schedule will
immediately launch the program once the schedule is triggered.Modifier and Type | Method and Description |
---|---|
ScheduleBuilder |
setDescription(String description)
Set the description of the schedule.
|
ScheduleBuilder |
setProperties(Map<String,String> properties)
Set properties of the schedule.
|
ScheduleBuilder |
setTimeout(long time,
TimeUnit unit)
Sets a timeout on the schedule.
|
ScheduleCreationSpec |
triggerByTime(String cronExpression)
Create a schedule which is triggered based upon the given cron expression.
|
ScheduleCreationSpec |
triggerOn(Trigger trigger)
Creates a schedule which is triggered when the given
Trigger is satisfied |
ScheduleCreationSpec |
triggerOnPartitions(String datasetName,
int numPartitions)
Create a schedule which is triggered whenever at least a certain number of new partitions are
added to a certain dataset in the same namespace as the app.
|
ScheduleCreationSpec |
triggerOnPartitions(String datasetNamespace,
String datasetName,
int numPartitions)
Create a schedule which is triggered whenever at least a certain number of new partitions are
added to a certain dataset in the specified namespace.
|
ScheduleCreationSpec |
triggerOnProgramStatus(ProgramType programType,
String program,
ProgramStatus... programStatuses)
Creates a schedule which is triggered when the given program in the same namespace,
application, and application version transitions to any one of the given program statuses.
|
ScheduleCreationSpec |
triggerOnProgramStatus(String application,
ProgramType programType,
String program,
ProgramStatus... programStatuses)
Creates a schedule which is triggered when the given program in the given application in the
same namespace transitions to any one of the given program statuses.
|
ScheduleCreationSpec |
triggerOnProgramStatus(String programNamespace,
String application,
ProgramType programType,
String program,
ProgramStatus... programStatuses)
Create a schedule which is triggered when the given program in the given namespace and
application with default version transitions to any one of the given program statuses.
|
ScheduleCreationSpec |
triggerOnProgramStatus(String programNamespace,
String application,
String appVersion,
ProgramType programType,
String program,
ProgramStatus... programStatuses)
Create a schedule which is triggered when the given program in the given namespace,
application, and application version transitions to any one of the given program statuses.
|
ConstraintProgramScheduleBuilder |
withConcurrency(int max)
Set the max number of concurrently runs of the schedule program.
|
ScheduleBuilder |
withDelay(long delay,
TimeUnit unit)
Set a certain amount of delay passed after the schedule is triggered, before launching the
program.
|
ConstraintProgramScheduleBuilder |
withDurationSinceLastRun(long duration,
TimeUnit unit)
Set a certain duration passed since the last launching of the program before launching the
program again.
|
ConstraintProgramScheduleBuilder |
withTimeWindow(String startTime,
String endTime)
Set a time range in a day starting from
startTime and ending at endTime ,
between which the program is allowed to be launched. |
ConstraintProgramScheduleBuilder |
withTimeWindow(String startTime,
String endTime,
TimeZone timeZone)
Set a time range in a day starting from
startTime and ending at endTime in the
given time zone, between which the program is allowed to be launched. |
ScheduleBuilder setDescription(String description)
description
- given description of the scheduleScheduleBuilder
containing the given descriptionScheduleBuilder setProperties(Map<String,String> properties)
properties
- a Map
with property names of class String
as keys and
property values of class String
as valuesScheduleBuilder
containing the given propertiesScheduleBuilder setTimeout(long time, TimeUnit unit)
time
- the time duration in the given unitunit
- the unit of the time argumentScheduleBuilder
containing the given timeoutConstraintProgramScheduleBuilder withConcurrency(int max)
max
- the max number of concurrently running programs allowedConstraintProgramScheduleBuilder
containing the given max number of concurrent
runsScheduleBuilder withDelay(long delay, TimeUnit unit)
delay
- delay in the given unit to wait after the schedule is triggered
before launching the programunit
- the time unit of the delay argumentScheduleBuilder
containing the given delay. Note that the delay constraint does
not have the option to abort the schedule if the constraint is not met.ConstraintProgramScheduleBuilder withTimeWindow(String startTime, String endTime)
startTime
and ending at endTime
,
between which the program is allowed to be launched. endTime
must be later than startTime
. JVM's default time zone will be used to interpret startTime
and endTime
.startTime
- the start time (inclusive) in the format of "HH:mm", for instance 2am
should be "02:00"endTime
- the end time (exclusive) in the format of "HH:mm", for instance 5pm should
be "17:00"ConstraintProgramScheduleBuilder
containing the time rangeConstraintProgramScheduleBuilder withTimeWindow(String startTime, String endTime, TimeZone timeZone)
startTime
and ending at endTime
in the
given time zone, between which the program is allowed to be launched.startTime
- the start time (inclusive) in the format of "HH:mm", for instance 2am
should be "02:00"endTime
- the end time (exclusive) in the format of "HH:mm", for instance 5pm should
be "17:00"timeZone
- the time zone of startTime
and endTime
ConstraintProgramScheduleBuilder
containing the time rangeConstraintProgramScheduleBuilder withDurationSinceLastRun(long duration, TimeUnit unit)
duration
- duration in the given unit to wait after the last launch of the
program before launching the programunit
- the time unit of the duration argumentConstraintProgramScheduleBuilder
containing the given durationScheduleCreationSpec triggerByTime(String cronExpression)
cronExpression
- the cron expression to specify the time to trigger the scheduleScheduleCreationSpec
ScheduleCreationSpec triggerOnPartitions(String datasetName, int numPartitions)
datasetName
- the name of the dataset in the same namespace of the appnumPartitions
- the minimum number of new partitions added to the dataset to trigger
the scheduleScheduleCreationSpec
ScheduleCreationSpec triggerOnPartitions(String datasetNamespace, String datasetName, int numPartitions)
datasetNamespace
- the namespace where the dataset is defineddatasetName
- the name of the dataset in the specified namespace of the appnumPartitions
- the minimum number of new partitions added to the dataset to trigger
the scheduleScheduleCreationSpec
ScheduleCreationSpec triggerOnProgramStatus(String programNamespace, String application, String appVersion, ProgramType programType, String program, ProgramStatus... programStatuses)
programNamespace
- the namespace where this program is definedapplication
- the name of the application where this program is definedappVersion
- the version of the applicationprogramType
- the type of the program, as supported by the systemprogram
- the name of the programprogramStatuses
- the set of statuses to trigger the schedule. The schedule will be
triggered if the status of the specific program transitioned to one of these statuses.ScheduleCreationSpec
ScheduleCreationSpec triggerOnProgramStatus(String programNamespace, String application, ProgramType programType, String program, ProgramStatus... programStatuses)
ScheduleCreationSpec triggerOnProgramStatus(String application, ProgramType programType, String program, ProgramStatus... programStatuses)
ScheduleCreationSpec triggerOnProgramStatus(ProgramType programType, String program, ProgramStatus... programStatuses)
ScheduleCreationSpec triggerOn(Trigger trigger)
Trigger
is satisfiedtrigger
- the Trigger
to be satisfied to trigger the schedule. Trigger
can be created by calling methods from TriggerFactory
obatined from AbstractApplication.getTriggerFactory()
ScheduleCreationSpec
Copyright © 2023 Cask Data, Inc. Licensed under the Apache License, Version 2.0.