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

can not get error logs when running with async_=True #482

Open
huwngnosleep opened this issue Mar 26, 2025 · 1 comment
Open

can not get error logs when running with async_=True #482

huwngnosleep opened this issue Mar 26, 2025 · 1 comment

Comments

@huwngnosleep
Copy link

huwngnosleep commented Mar 26, 2025

I am running pyhive cursor.execute with async_=True, but when my query got error and I tried to get error message with cursor.fetch_logs() it returned an empty list. Did i do anything wrong, here is my code:

cursor.execute(sql_query, async_=True)

while True:
    # Get operation status
    status_code = cursor.poll().operationState
    status_name = OPERATION_STATES.get(status_code, f'UNKNOWN_STATE_{status_code}')
    
    _logger.info("Query status: %s", status_name)
    
    if status_code in [2, 3, 4]:
        _logger.info("Query completed with status: %s", status_name)
        break
    elif status_code == 5:
        error_message = cursor.fetch_logs()
        _logger.info("Query failed with error: %s", error_message)
        raise Exception(f"Query failed: {error_message}")
@huwngnosleep huwngnosleep changed the title can not get error logs when running with _async=True can not get error logs when running with async_=True Mar 26, 2025
@huwngnosleep
Copy link
Author

by the way, the reason for me to do this is: we have a very long run time query (more than 1 hour), then after 1 hour, hiveserver2 (actually we are using SparkThrift server) do not return the status to pyhive client, although that query might be executed successfully. So I have to poll query status periodically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant