This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
/
training-r-mnist-workflow.yaml
99 lines (99 loc) · 3 KB
/
training-r-mnist-workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: kubeflow-r-train-
spec:
entrypoint: workflow
arguments:
parameters:
- name: version
value: 0.1
- name: github-user
value: kubeflow
- name: github-revision
value: master
- name: docker-org
value: seldonio
- name: build-push-image
value: false
volumes:
- name: docker-config
secret:
secretName: docker-config # name of an existing k8s secret
volumeClaimTemplates:
- metadata:
name: workspace
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 0.5Gi
templates:
- name: workflow
steps:
- - name: get-source
template: get-source-code
- - name: build-push
template: build-and-push
when: "{{workflow.parameters.build-push-image}} == true"
- - name: train
template: tfjob
- name: get-source-code
inputs:
artifacts:
- name: argo-source
path: /src/example-seldon
git:
repo: https://github.com/{{workflow.parameters.github-user}}/example-seldon.git
revision: "{{workflow.parameters.github-revision}}"
container:
image: alpine:latest
command: [sh, -c]
args: ["cp /src/example-seldon/models/r_mnist/train/* /workspace/; ls /workspace/"]
volumeMounts:
- name: workspace
mountPath: /workspace
- name: build-and-push
container:
image: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile","Dockerfile","--destination","{{workflow.parameters.docker-org}}/rmnistclassifier_trainer:{{workflow.parameters.version}}"]
workingDir: /src/example-seldon/models/r_mnist/train/
volumeMounts:
- name: docker-config
mountPath: "/root/.docker/"
- name: workspace
mountPath: /workspace
- name: tfjob
resource: #indicates that this is a resource template
action: create #can be any kubectl action (e.g. create, delete, apply, patch)
successCondition: status.succeeded == 1
manifest: | #put your kubernetes spec here
apiVersion: "batch/v1"
kind: "Job"
metadata:
name: "r-train"
ownerReferences:
- apiVersion: argoproj.io/v1alpha1
kind: Workflow
controller: true
name: {{workflow.name}}
uid: {{workflow.uid}}
spec:
template:
metadata:
name: "r-train"
spec:
containers:
-
image: "{{workflow.parameters.docker-org}}/rmnistclassifier_trainer:{{workflow.parameters.version}}"
name: "r-train"
volumeMounts:
-
mountPath: "/data"
name: "persistent-storage"
restartPolicy: "Never"
volumes:
-
name: "persistent-storage"
persistentVolumeClaim:
claimName: "nfs-1"