Hello team, KubernetesEnvironment fails to submit ...
# prefect-community
v
Hello team, KubernetesEnvironment fails to submit job with the following error
Copy code
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Job.batch \"\" is invalid: [metadata.name: Required value: name or generateName is required, spec.template.spec.containers[0].name: Required value, spec.template.spec.restartPolicy: Required value: valid values: \"OnFailure\", \"Never\"]","reason":"Invalid","details":{"group":"batch","kind":"Job","causes":[{"reason":"FieldValueRequired","message":"Required value: name or generateName is required","field":"metadata.name"},{"reason":"FieldValueRequired","message":"Required value","field":"spec.template.spec.containers[0].name"},{"reason":"FieldValueRequired","message":"Required value: valid values: \"OnFailure\", \"Never\"","field":"spec.template.spec.restartPolicy"}]},"code":422}
1
Ok, I was able to make it work with
KubernetesJobEnvironment(labels=agent_labels, unique_job_name=True)
unigque_job_name solved job submission
Now, even the simplest python hello-world is failing with error
Copy code
[19 Dec 2020 5:05pm]: Failed to load and execute Flow's environment: KeyError('name')
solved, it is always MUST be provided - job spec in yaml