Set default trial job container deadline
When creating a "sleep" container for a trial job, set the active deadline seconds to twice the sleep time (plus 1) if it is either unset or set to a value less than the sleep time.
@@ -533,6 +533,10 @@ func createJob(trial *redskyv1alpha1.Trial) *batchv1.Job {
if trial.Spec.StartTimeOffset != nil {
s = &metav1.Duration{Duration: s.Duration + trial.Spec.StartTimeOffset.Duration}
}
+ if job.Spec.ActiveDeadlineSeconds == nil || *job.Spec.ActiveDeadlineSeconds <= int64(s.Duration/time.Second) {
+ ads := int64(s.Duration/time.Second)*2 + 1
+ job.Spec.ActiveDeadlineSeconds = &ads
+ }
job.Spec.Template.Spec.Containers = []corev1.Container{
{
Name: "default-trial-run",
