<p>I have a python program launching a batch job. The job outputs a json file, I'd like to know what is the easiest way to get this result back to the python program that launched it.</p>
<p>So far I thought of these solutions:</p>
<ul>
<li><p>Upload the json file to S3 (pretty heavy)</p>
</li>
<li><p>Display it in the pod logs then read the logs from the python program (pretty hacky/dirty)</p>
</li>
<li><p>Mount a PVC, launch a second pod with the same PVC, and create a shared disk between this pod and the job (pretty overkill)</p>
</li>
</ul>
<p>The json file is pretty lightweight. Isn't there a solution to do something like adding some metadata to the pod when the job completes? The python program can then just poll those metadata.</p>

E-Kami
<p>An easy way not involving any other databases/pods is to run the first pod as an init container, mount a volume that is shared in both containers and use the JSON file in the next python program. (Also, this approach does not need a persistent volume, just a shared one), see this example:</p>
<p><a href="https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/</a></p>
<p>Also, depending on the complexity of these jobs, would recommend taking a look at Argo workflows or any dag-related job schedulers.</p>
