Fix issue #1395
create_job function was not printing the current status of the job. Modified the create_job function to call read_namespaced_job_status in order to get the current job status
This commit is contained in:
parent
b313b5e74f
commit
7bb0851217
@ -20,6 +20,8 @@ from os import path
|
||||
|
||||
import yaml
|
||||
|
||||
from time import sleep
|
||||
|
||||
from kubernetes import client, config
|
||||
|
||||
JOB_NAME = "pi"
|
||||
@ -53,7 +55,16 @@ def create_job(api_instance, job):
|
||||
api_response = api_instance.create_namespaced_job(
|
||||
body=job,
|
||||
namespace="default")
|
||||
print("Job created. status='%s'" % str(api_response.status))
|
||||
# Need to wait for a second for the job status to update
|
||||
sleep(1)
|
||||
print("Job created. status='%s'" % str(get_job_status(api_instance)))
|
||||
|
||||
|
||||
def get_job_status(api_instance):
|
||||
api_response = api_instance.read_namespaced_job_status(
|
||||
name=JOB_NAME,
|
||||
namespace="default")
|
||||
return api_response.status
|
||||
|
||||
|
||||
def update_job(api_instance, job):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user