Commit 79c89650 authored by Yori Fournier's avatar Yori Fournier
Browse files

started the generation of manifest for steps

parent 6d30dcb1
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ project_name }}-artifacts-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ artifacts_volume.storage_size }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ project_name }}-archives-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ archives_volume.storage_size }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ job.step_name }}
spec:
template:
spec:
volumes:
- name: artifacts
persistentVolumeClaim:
claimName: {{ project_name }}-artifacts-pv-claim
- name: archives
persistentVolumeClaim:
claimName: {{ project_name }}-archives-pv-claim
containers:
- name: {{ job.container.name }}
image: {{ job.container.image }}
imagePullPolicy: Never
volumeMounts:
- mountPath: {{ job.container.artifact_volume.mount_path }}
name: artifacts
subPath: {{ job.container.artifact_volume.sub_path }}
{% for n in range(job.container.deps_volume | length) -%}
- mountPath: {{ job.container.deps_volume[n].mount_path }}
name: artifacts
subPath: {{ job.container.deps_volume[n].sub_path }}
{% endfor %}
{%- for n in range(job.container.archives_volume | length) -%}
- mountPath: {{ job.container.archives_volume[n].mount_path }}
name: archives
subPath: {{ job.container.archives_volume[n].sub_path }}
{%- endfor %}
restartPolicy: Never
backoffLimit: 1
\ No newline at end of file
from jinja2 import Template
import toml
with open('multi-manifest.yaml', 'r') as fd:
template = Template(fd.read())
with open('step_config.toml', 'r') as fd:
config = toml.load(fd)
#print(config)
rendered = template.render(**config)
print(rendered)
# sources:
# https://stackoverflow.com/a/50557523
# https://stackoverflow.com/a/50333856
project_name = "ml-solar-plates"
[artifacts_volume]
storage_size = "1Gi"
[archives_volume]
storage_size = "1Gi"
[job]
step_name = "select-features"
[job.artifacts_volume]
name = "artifacts"
[job.archives_volume]
name = "archives"
[job.container]
name = "select-features"
image = "select-features:latest"
[job.container.artifact_volume]
mount_path = "home/fournier/artifact/"
sub_path = "select-features-ghjdhsgd-ghsteydjs-hdjsksush"
[[job.container.deps_volume]]
mount_path = "home/fournier/extract-features/"
sub_path = "extract-features-ghjdhsgd-ghsteydjs-hdjsksush"
[[job.container.deps_volume]]
mount_path = "home/fournier/label-features/"
sub_path = "label-features-ghjdhsgd-ghsteydjs-hdjsksush"
[[job.container.archives_volume]]
mount_path = "home/fournier/archives/ml_solar_plates"
sub_path = "ml_solar_plates"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment