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

Return already fetched metadata upon connection error #134

Open
adamovanja opened this issue Jul 19, 2022 · 0 comments
Open

Return already fetched metadata upon connection error #134

adamovanja opened this issue Jul 19, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@adamovanja
Copy link
Contributor

As a plugin user,
in case of a connection error to NCBI (Error with gaierror is not JSON serializable), I want get-metadata to store all already retrieved metadata to an artifact.

Current behaviour

get-metadata fails without outputting any artifact by displaying the following Error: EntrezPy failed to connect to NCBI. Please check your internet connection and try again. It may help to wait a few minutes before retrying.

Expected behaviour

get-metadata should store the already retrieved metadata to an artifact and raise a connection warning for the remaining run IDs.

Note for solving

I believe a change here is needed:

def handle_threaded_exception(args):
    logger = set_up_logger('DEBUG', logger_name='ThreadedErrorsManager')
    msg = 'Data fetching was interrupted by the following error: \n'


    if 'gaierror is not JSON serializable' in str(args.exc_value):
        msg += 'EntrezPy failed to connect to NCBI. Please check your ' \
               'internet connection and try again. It may help to wait ' \
               'a few minutes before retrying.'
    # silence threads exiting correctly
    elif issubclass(args.exc_type, SystemExit) and str(args.exc_value) == '0':
        return
    else:
        msg += f'Caught {args.exc_type} with value "{args.exc_value}" ' \
               f'in thread {args.thread}'


    logger.exception(msg)


    # This will send a SIGINT to the main thread, which will gracefully
    # kill the running Q2 action. No artifacts will be saved.
    os.kill(os.getpid(), signal.SIGINT)
@adamovanja adamovanja added the enhancement New feature or request label Jul 19, 2022
@adamovanja adamovanja added this to the Release follow-up 🔜 milestone Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant