Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if Job failed? #194

Open
rickymedrano opened this issue Jul 31, 2024 · 2 comments
Open

Check if Job failed? #194

rickymedrano opened this issue Jul 31, 2024 · 2 comments
Labels
backlog Created in internal backlog (does not guarantee actual plan and implementation) enhancement New feature or request

Comments

@rickymedrano
Copy link

rickymedrano commented Jul 31, 2024

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
Copy link
Author

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.

@apiotrowskiMicroStrategy
Copy link
Contributor

Hi @rickymedrano

We will provide the code snippet required to do exactly that with next release.

@apiotrowskiMicroStrategy apiotrowskiMicroStrategy added enhancement New feature or request backlog Created in internal backlog (does not guarantee actual plan and implementation) labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Created in internal backlog (does not guarantee actual plan and implementation) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants