func SchedulerTaskFromTask(t core.Task) *ScheduledTask { st := &ScheduledTask{ ID: t.ID(), Name: t.GetName(), Deadline: t.DeadlineDuration().String(), CreationTimestamp: t.CreationTime().Unix(), LastRunTimestamp: t.LastRunTime().Unix(), HitCount: int(t.HitCount()), MissCount: int(t.MissedCount()), FailedCount: int(t.FailedCount()), LastFailureMessage: t.LastFailureMessage(), State: t.State().String(), } if st.LastRunTimestamp < 0 { st.LastRunTimestamp = -1 } return st }
func taskURI(host string, t core.Task) string { return fmt.Sprintf("%s://%s/v1/tasks/%s", protocolPrefix, host, t.ID()) }