mirror of
https://github.com/hanzo-ml/trainer.git
synced 2026-09-24 00:31:34 +00:00
* feat(api): Sync TrainJob JobsStatus from JobSet ReplicatedJobsStatus Signed-off-by: Antonin Stefanutti <[email protected]> * Add integration tests Signed-off-by: Antonin Stefanutti <[email protected]> * Update e2e tests Signed-off-by: Antonin Stefanutti <[email protected]> * Remove extra check Signed-off-by: Antonin Stefanutti <[email protected]> * Sort JobsStatus in e2e tests Signed-off-by: Antonin Stefanutti <[email protected]> * Fix e2e test for MPI job Signed-off-by: Antonin Stefanutti <[email protected]> * Fail-fast when multiple terminal condition and JobsStatus plugins exist Signed-off-by: Antonin Stefanutti <[email protected]> * Fold TerminalCondition and JobsStatus plugins Signed-off-by: Antonin Stefanutti <[email protected]> --------- Signed-off-by: Antonin Stefanutti <[email protected]>
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
/*
|
|
Copyright 2024 The Kubeflow Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package util
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/google/go-cmp/cmp/cmpopts"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
trainer "github.com/kubeflow/trainer/v2/pkg/apis/trainer/v1alpha1"
|
|
)
|
|
|
|
const (
|
|
Timeout = 5 * time.Second
|
|
TimeoutE2E = 10 * time.Minute // E2Es require a longer timeout due to large image pull
|
|
ConsistentDuration = time.Second
|
|
Interval = time.Millisecond * 250
|
|
)
|
|
|
|
var (
|
|
IgnoreObjectMetadata = cmp.Options{
|
|
cmpopts.IgnoreTypes(metav1.TypeMeta{}),
|
|
cmpopts.IgnoreFields(metav1.ObjectMeta{}, "UID", "ResourceVersion", "Generation", "CreationTimestamp", "ManagedFields"),
|
|
}
|
|
IgnoreConditions = cmp.Options{
|
|
cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime", "ObservedGeneration"),
|
|
}
|
|
SortJobsStatus = cmp.Options{
|
|
cmpopts.SortSlices(func(a, b trainer.JobStatus) bool { return a.Name < b.Name }),
|
|
}
|
|
)
|