Check if Job failed?
Opened this issue · 1 comments
rickymedrano commented
Hi, how would it be possible to know if a Job failed? Specifically, I'm refreshing a cube with:
def refresh_cube(conn, cube_id) -> str:
# Get cube object
cube = OlapCube(connection=conn, id=cube_id)
# Refresh cube
job = cube.publish()
# Give API enough time to register publish request
time.sleep(5)
# Get the latest status of the cube
cube.refresh_status()
tic = time.perf_counter()
# Keep checking the status until the cube is done refreshing
while 'Processing' in cube.show_status():
time.sleep(10)
cube.refresh_status()
toc = time.perf_counter()
status = f'Finished refreshing {cube.name} in {get_time_elapsed(tic, toc)}'
return status
But if the refresh fails, it doesnt detect it, it's only checking if the refresh is still happening.
I'm not seeing any obvious methods in the Job or OlapCube objects to determine if a refresh failed.
Ideally I can detect when it fails and display the reason for failure, the same error message I see in Workstation>Monitors>Jobs tab.
Thanks
rickymedrano commented
I've also tried getting job.status
but it always returns JobStatus.EXECUTING
, way after the job already completed. So I try using job.fetch() to see if it will update the JobStatus but the method immediately errors out saying the Job is not found once the job finishes.