Josef Trefil
11/12/2020, 11:36 AMRunNamespacedJob
to TASK RUN window in the UI?
So far I'm getting just:
12:21:32
INFO
RunNamespacedJob
Job test-app has been created.
12:21:37
INFO
RunNamespacedJob
Job test-app has been completed.
12:21:37
INFO
RunNamespacedJob
Job test-app has been deleted.
but I'd also like to see what's going on INSIDE the job itself.
Thank you in advance! 🙂👍Dylan
11/12/2020, 2:07 PMlog_stdout=True
in your task decorator 👍Josef Trefil
11/12/2020, 2:15 PMnamespace = 'default'
postgres_deployment_body = read_yaml('../postgres_deployment.yml')
app_job_body = read_yaml('../app_job.yml')
postgres_deployment = CreateNamespacedDeployment(body=postgres_deployment_body, namespace=namespace, kubernetes_api_key_secret=None)
app_job = RunNamespacedJob(body=app_job_body, kubernetes_api_key_secret=None, log_stdout=True)
delete_postgres_deployment = DeleteNamespacedDeployment(kubernetes_api_key_secret=None)
with Flow("first-attempt-deploy") as flow:
# name = prefect.Parameter("name", default='John')
patch_k8s = patch_kubernetes()
postgres_deployment_result = postgres_deployment(upstream_tasks=[patch_k8s])
app_job_result = app_job(upstream_tasks=[postgres_deployment_result])
delete_postgres_deployment(deployment_name=postgres_deployment_body['metadata']['name'],
upstream_tasks=[app_job_result])
flow.storage = Docker()
flow.register(project_name="myproject")
but it didn't do anything. I've tried to put logger.info() , logger.error() and print() statements into the job, but niether showed up.
Is this the way you mean, or is there another one?Dylan
11/12/2020, 2:24 PMread_namespaced_pod_log
from the kubernetes library to get the logs from the pod that the job creates. Prefect doesn’t have access to the logs by default because the job is running in a separate containerJosef Trefil
11/12/2020, 5:39 PMDylan
11/12/2020, 5:51 PMJoël Luijmes
11/25/2020, 12:00 PMDylan
11/25/2020, 3:42 PM