Scheduling CreateNamespace
This commit is contained in:
@@ -55,17 +55,17 @@ type WorkflowSchedule struct {
|
||||
func NewScheduler(mode int, start string, end string, durationInS float64, cron string) *WorkflowSchedule {
|
||||
ws := &WorkflowSchedule{
|
||||
UUID: uuid.New().String(),
|
||||
Start: time.Now().Add(asapBuffer),
|
||||
Start: time.Now().UTC().Add(asapBuffer),
|
||||
BookingMode: booking.BookingMode(mode),
|
||||
DurationS: durationInS,
|
||||
Cron: cron,
|
||||
}
|
||||
s, err := time.Parse("2006-01-02T15:04:05", start)
|
||||
s, err := time.ParseInLocation("2006-01-02T15:04:05", start, time.UTC)
|
||||
if err == nil && ws.BookingMode == booking.PLANNED {
|
||||
ws.Start = s // can apply a defined start other than now, if planned
|
||||
}
|
||||
|
||||
e, err := time.Parse("2006-01-02T15:04:05", end)
|
||||
e, err := time.ParseInLocation("2006-01-02T15:04:05", end, time.UTC)
|
||||
if err == nil {
|
||||
ws.End = &e
|
||||
}
|
||||
@@ -153,7 +153,7 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*
|
||||
// Obsolescence check: abort if any session execution's start date has passed.
|
||||
executions := loadSessionExecs(ws.UUID)
|
||||
for _, exec := range executions {
|
||||
if !exec.ExecDate.IsZero() && exec.ExecDate.Before(time.Now()) {
|
||||
if !exec.ExecDate.IsZero() && exec.ExecDate.Before(time.Now().UTC()) {
|
||||
return ws, nil, nil, fmt.Errorf("execution %s is obsolete (start date in the past)", exec.GetID())
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func (ws *WorkflowSchedule) Schedules(wfID string, request *tools.APIRequest) (*
|
||||
}
|
||||
|
||||
for _, exec := range executions {
|
||||
go WatchExecDeadline(exec.GetID(), exec.ExecDate, selfID, request)
|
||||
go WatchExecDeadline(exec.GetID(), exec.ExecutionsID, exec.ExecDate, selfID, request)
|
||||
}
|
||||
|
||||
obj, _, _ := workflow.NewAccessor(request).LoadOne(wfID)
|
||||
|
||||
Reference in New Issue
Block a user