Skip to content

Instantly share code, notes, and snippets.

@Jeffwan
Last active March 31, 2020 05:10
Show Gist options
  • Save Jeffwan/d1a688a5bb85b684eed079fcd5f2a54e to your computer and use it in GitHub Desktop.
Save Jeffwan/d1a688a5bb85b684eed079fcd5f2a54e to your computer and use it in GitHub Desktop.
elastic_job.yaml
apiVersion: elastic.pytorch.org/v1alpha1
kind: ElasticJob
metadata:
name: imagenet
namespace: elastic-job
spec:
# Use "etcd-service:2379" if you already apply etcd.yaml
rdzvEndpoint: "etcd-service:2379"
minReplicas: 1
maxReplicas: 5
replicaSpecs:
Worker:
replicas: 2
restartPolicy: ExitCode
template:
apiVersion: v1
kind: Pod
spec:
containers:
- name: elasticjob-worker
image: seedjeffwan/examples:0.1.0rc1
imagePullPolicy: Always
args:
- "s3://torchelastic-shjiaxin-1h71m-s3bucket-m1b9b9pjldqw/petctl/shjiaxin/imagenet-job/main.py"
- "--input_path"
- "/data/tiny-imagenet-200/train"
- "--epochs"
- "10"
resources:
limits:
nvidia.com/gpu: 1
@Jeffwan
Copy link
Author

Jeffwan commented Mar 31, 2020

@Jeffwan
Copy link
Author

Jeffwan commented Mar 31, 2020

020-03-31T05:08:27.055Z	DEBUG	controller-runtime.controller	Successfully Reconciled	{"controller": "elasticjob", "request": "elastic-job/imagenet"}
time="2020-03-31T05:08:30Z" level=info msg="Reconciling for job imagenet"
time="2020-03-31T05:08:30Z" level=info msg="Ignoring inactive pod elastic-job/imagenet-worker-1 in state Failed, deletion time 2020-03-31 05:07:53 +0000 UTC"
time="2020-03-31T05:08:30Z" level=warning msg="The label index is not expected: 1, pod: elastic-job/imagenet-worker-1" job=elastic-job.imagenet replica-type=worker uid=24f9ba80-730c-11ea-8300-0e6ac959ddc0
time="2020-03-31T05:08:30Z" level=info msg="Deleting pod elastic-job/imagenet-worker-1, Job name: imagenet" job=elastic-job.imagenet uid=24f9ba80-730c-11ea-8300-0e6ac959ddc0
2020-03-31T05:08:30.805Z	INFO	controllers.ElasticJob	Update on delete function: elastic-job-controller create object imagenet-worker-1
time="2020-03-31T05:08:30Z" level=warning msg="ReconcilePods error pods \"imagenet-worker-1\" not found"
time="2020-03-31T05:08:30Z" level=info msg="Reconcile ElasticJob error pods \"imagenet-worker-1\" not found" job=elastic-job.imagenet uid=24f9ba80-730c-11ea-8300-0e6ac959ddc0
2020-03-31T05:08:30.806Z	ERROR	controller-runtime.controller	Reconciler error	{"controller": "elasticjob", "request": "elastic-job/imagenet", "error": "pods \"imagenet-worker-1\" not found"}
github.com/go-logr/zapr.(*zapLogger).Error
	/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.3.0/pkg/internal/controller/controller.go:218
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.3.0/pkg/internal/controller/controller.go:192
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.3.0/pkg/internal/controller/controller.go:171
k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1
	/go/pkg/mod/k8s.io/apimachinery@v0.15.11-beta.0/pkg/util/wait/wait.go:152
k8s.io/apimachinery/pkg/util/wait.JitterUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.15.11-beta.0/pkg/util/wait/wait.go:153
k8s.io/apimachinery/pkg/util/wait.Until
	/go/pkg/mod/k8s.io/apimachinery@v0.15.11-beta.0/pkg/util/wait/wait.go:88
2020-03-31T05:08:30.806Z	DEBUG	controller-runtime.manager.events	Warning	{"object": {"kind":"ElasticJob","namespace":"elastic-job","name":"imagenet","uid":"24f9ba80-730c-11ea-8300-0e6ac959ddc0","apiVersion":"elastic.pytorch.org/v1alpha1","resourceVersion":"4061536"}, "reason": "FailedDeletePod", "message": "Error deleting: pods \"imagenet-worker-1\" not found"}
time="2020-03-31T05:08:31Z" level=info msg="Reconciling for job imagenet"
time="2020-03-31T05:08:31Z" level=info msg="ElasticJob=imagenet, ReplicaType=Worker expected=1, running=1, succeeded=0 , failed=0" job=elastic-job.imagenet uid=24f9ba80-730c-11ea-8300-0e6ac959ddc0
time="2020-03-31T05:08:31Z" level=info msg="ElasticJob imagenet is running." job=elas

@Jeffwan
Copy link
Author

Jeffwan commented Mar 31, 2020

Why we delete pod and get event and reconcile it again? Did we miss the logic to handle terminating pods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment