Pooyan
12/11/2023, 11:55 PMMarvin
12/11/2023, 11:56 PMKubernetesJob
infrastructure object allows you to execute flow runs in a Kubernetes Job. It is essential to understand that local storage is not supported, and you must configure remote storage. Additionally, a Prefect server or Prefect Cloud API endpoint must be set in your agent's configuration.
- Requirements: kubectl
must be available in your environment to manage and interact with Kubernetes resources.
- Capturing Logs: While the documentation provided does not explicitly mention how to capture logs, in a Kubernetes context, you usually would use kubectl logs <POD_NAME>
to retrieve logs from a pod. This command can be issued after your job has been submitted and while it's running or after completion, within the job retention period configured by finished_job_ttl
.
Most likely, you would use Kubernetes tools and commands to capture these logs rather than a Prefect-specific feature. If your flow logs are not showing up in the Kubernetes job logs, it could be due to how the logging is configured within your flow or Docker image.
Remember to set any necessary environment variables using the env
attribute of the KubernetesJob
to ensure that your logging configuration is passed to the container correctly.
If you are having trouble capturing logs or need more specific guidance, it would be best to specify your setup details, and I can assist further.Nate
12/11/2023, 11:57 PMPooyan
12/12/2023, 12:02 AMrun_namespaced_job
off of a k8s job yaml file. so looking to get logs from another container basically. The logs I get from run_namespaced_job
are the following format but not really the logs from container
[Completed(message=None, type=COMPLETED, result=PersistedResult(type='reference', artifact_type='result', artifact_description='Result of type `dict` persisted to: `/root/.prefect/storage/e5317eff71814a1bab6af0fdc248b5c8`', serializer_type='pickle', storage_block_id=UUID('cb8cba71-7bdb-43b6-87a4-4a76ac598b72'), storage_key='e5317eff71814a1bab6af0fdc248b5c8'))]
Nate
12/12/2023, 12:25 AMrun_namespaced_job
and it seems that this dict
here
are the logs from your job invoked viaCopy code'Result of type `dict` persisted to: `/root/.prefect/storage/e5317eff71814a1bab6af0fdc248b5c8`'
run_namespaced_job
Nate
12/12/2023, 12:26 AM/root/.prefect/storage
on what i imagine is your ephemeral containerized runtimePooyan
12/12/2023, 1:00 AM