apiVersion: v1
kind: ConfigMap
metadata:
  name: trial-template-labeled
  namespace: kubeflow
  labels:
    app: katib-trial-templates
data:
  defaultTrialTemplate.yaml: |-
    apiVersion: batch/v1
    kind: Job
    metadata:
      name: {{.Trial}}
      namespace: {{.NameSpace}}
    spec:
      template:
        spec:
          containers:
          - name: {{.Trial}}
            image: docker.io/kubeflowkatib/mxnet-mnist
            command:
            - "python3"
            - "/opt/mxnet-mnist/mnist.py"
            - "--batch-size=64"
            {{- with .HyperParameters}}
            {{- range .}}
            - "{{.Name}}={{.Value}}"
            {{- end}}
            {{- end}}
          restartPolicy: Never
  enasCPUTemplate: |-
    apiVersion: batch/v1
    kind: Job
    metadata:
      name: {{.Trial}}
      namespace: {{.NameSpace}}
    spec:
      template:
        spec:
          containers:
          - name: {{.Trial}}
            image: docker.io/kubeflowkatib/enas-cnn-cifar10-cpu
            command:
            - "python3.5"
            - "-u"
            - "RunTrial.py"
            {{- with .HyperParameters}}
            {{- range .}}
            - "--{{.Name}}=\"{{.Value}}\""
            {{- end}}
            {{- end}}
            - "--num_epochs=1"
          restartPolicy: Never
  pytorchJobTemplate: |-
    apiVersion: "kubeflow.org/v1"
    kind: PyTorchJob
    metadata:
      name: {{.Trial}}
      namespace: {{.NameSpace}}
    spec:
     pytorchReplicaSpecs:
      Master:
        replicas: 1
        restartPolicy: OnFailure
        template:
          spec:
            containers:
              - name: pytorch
                image: gcr.io/kubeflow-ci/pytorch-dist-mnist-test:v1.0
                imagePullPolicy: Always
                command:
                  - "python"
                  - "/var/mnist.py"
                  {{- with .HyperParameters}}
                  {{- range .}}
                  - "{{.Name}}={{.Value}}"
                  {{- end}}
                  {{- end}}
      Worker:
        replicas: 2
        restartPolicy: OnFailure
        template:
          spec:
            containers:
              - name: pytorch
                image: gcr.io/kubeflow-ci/pytorch-dist-mnist-test:v1.0
                imagePullPolicy: Always
                command:
                  - "python"
                  - "/var/mnist.py"
                  {{- with .HyperParameters}}
                  {{- range .}}
                  - "{{.Name}}={{.Value}}"
                  {{- end}}
                  {{- end}}
