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

Guarding against result.summary being unset #130

Open
mhauru opened this issue Apr 24, 2024 · 0 comments
Open

Guarding against result.summary being unset #130

mhauru opened this issue Apr 24, 2024 · 0 comments

Comments

@mhauru
Copy link

mhauru commented Apr 24, 2024

I'm trying King Arthur out, and have run into a couple of instances where the job result is None or result.summary is None, but the code tries to get fields from it and crashes. I put in some quick if result.summary: clauses to the plug the hole in my local version, but I wonder if that's just masking some deeper issue about an assumed guarantee of when result.summary is set that is not being respected.

I've seen this happen with at least this snippet from scheduler.py:

            logger.error("Job #%s (task: %s) failed but will be resumed",
                         job_id, task_id)

            if result.summary.fetched > 0:
                task.backend_args['next_from_date'] = result.summary.max_updated_on

                if result.summary.max_offset:
                    task.backend_args['next_offset'] = result.summary.max_offset

which raises AttributeError: 'NoneType' object has no attribute 'summary', and this one in jobs.py

    logger.debug("Job #%s (task: %s) completed (%s) - %s/%s items (%s) fetched",
                 result.job_id, task_id, result.backend,
                 str(result.summary.fetched), str(result.summary.skipped),
                 result.category)

which raises AttributeError: 'NoneType' object has no attribute 'fetched'.

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