apiVersion: batch/v1
kind: Job
metadata:
  name: pytorch-job
spec:
  template:
    spec:
      containers:
      - name: gpu-container
        image: daemonslayer/pod:pytorch
        imagePullPolicy: Always
        command: ["/bin/sh", "-c"]
        args:
        - "cd creativeflow/temp-cosmogan/ && bash requirements.sh && cd experiments/exp1_pix2pix_2dimg/ && nvidia-smi && python3 main.py --train y --test y"
        resources:
          limits:
            nvidia.com/gpu: 4
            memory: 20Gi
            cpu: 1
          requests:
            memory: 20.0Gi
            cpu: 1
            nvidia.com/gpu: 4
        volumeMounts:
        - mountPath: /creativeflow
          name: creativeflow
      restartPolicy: Never
      volumes:
        - name: creativeflow
          persistentVolumeClaim:
            claimName: creativeflow
      initContainers:
      - name: init-clone-repo
        image: alpine/git
        args:
          - clone
          - --single-branch
          - https://gitlab.nautilus.optiputer.net/prp/nautilus-cluster
          - /opt/repo/nautilus-cluster
        volumeMounts:
          - name: creativeflow
            mountPath: /creativeflow
  backoffLimit: 5
