Interface ModelSchedulesContextReadWrite.NewScheduleBuilder
- Enclosing interface:
ModelSchedulesContextReadWrite
public static interface ModelSchedulesContextReadWrite.NewScheduleBuilder
A builder object helping to add or update a model schedule.
The following code creates (or updates if already existing) a ModelSchedule named "mySchedule" which will run "refresh_model" action every 7 days from 01/01/2020 12:42
model.schedulesContext().newSchedule("mySchedule") .setStartDate(api.parseDateTime("yyyy-MM-dd'T'HH:mm:ss", "2020-01-01T12:42:00")) .setPeriod(7, PeriodUnit.DAY) .setAction("refresh_model") .addOrUpdate()The time value of the start date is important when the period is greater or equal to one day as it will define the time of the day the model action will be executed. In the previous example, every 7 days the action will be executed at 12:42.
- Since:
- 11.0 Paper Plane
-
Method Summary
Modifier and TypeMethodDescriptionAdds or updates the configured model schedule.Sets the model action to be executed once at the beginning of each period.setPeriod
(int quantity, ModelSchedulesContextReadOnly.PeriodUnit unit) Sets the period of the model action execution.setStartDate
(DateTime date) Sets the start date and time of the model schedule.
-
Method Details
-
setStartDate
Sets the start date and time of the model schedule.- Parameters:
date
- the start date and time- Returns:
- this builder
- Since:
- 11.0 Paper Plane
-
setPeriod
ModelSchedulesContextReadWrite.NewScheduleBuilder setPeriod(int quantity, ModelSchedulesContextReadOnly.PeriodUnit unit) Sets the period of the model action execution.For example
setPeriod(12, PeriodUnit.HOUR)
sets a period of 12 hours.- Parameters:
quantity
- the quantity of a unit of durationunit
- the unit of duration- Returns:
- this builder
- Since:
- 11.0 Paper Plane
-
setAction
Sets the model action to be executed once at the beginning of each period.- Parameters:
action
- the model action to be executed- Returns:
- this builder
- Since:
- 11.0 Paper Plane
-
addOrUpdate
ModelSchedulesContextReadOnly.ModelSchedule addOrUpdate()Adds or updates the configured model schedule.- Returns:
- the added or updated model schedule
- Throws:
IllegalArgumentException
- if the given values are invalid- Since:
- 11.0 Paper Plane
-