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

Oracle is throwing a logging-related exception if curator comment is written in upper case #22

Closed
seasidesparrow opened this issue Jul 24, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@seasidesparrow
Copy link
Member

Several uncaught exceptions were generated when "DELETE" was used instead of "delete" in the curator comment field. At oracle_util L360, the code checks to see if the curator comment is one of 'update', 'add', 'delete', but this is not case-insensitive. If the curator uses 'DELETE', the if-then condition is met, and the code logs a warning and then drops the row from the result set. Logging appears to be successful, but subsequent to logging the code is throwing an exception:

Message: 'Error: Bad curator comment at'
Arguments: ('2023arXiv230706859A',)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/__init__.py", line 1081, in emit
    msg = self.format(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 925, in format
    return fmt.format(record)
  File "/usr/local/lib/python3.8/dist-packages/adsputils/__init__.py", line 598, in format
    msg = jsonlogger.JsonFormatter.format(self, record)
  File "/usr/local/lib/python3.8/dist-packages/pythonjsonlogger/jsonlogger.py", line 128, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.8/logging/__init__.py", line 369, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "run.py", line 198, in <module>
    main()
  File "run.py", line 157, in main
    status = oracle_util.update_db_curated_matches(filename)
  File "/app/adsdocmatch/oracle_util.py", line 501, in update_db_curated_matches
    matches = self.read_google_sheet(input_filename)
  File "/app/adsdocmatch/oracle_util.py", line 361, in read_google_sheet
    logger.warning('Error: Bad curator comment at', row.source_bib)
@seasidesparrow seasidesparrow self-assigned this Jul 24, 2023
@seasidesparrow seasidesparrow added the bug Something isn't working label Jul 24, 2023
@seasidesparrow
Copy link
Member Author

Two changes are needed here, one to allow flexibility in curator tagging, and one to fix the logging message:

            comments = ['update', 'add', 'delete']
            row.curator_comment = row.curator_comment.lower()
            if row.curator_comment not in comments:
                logger.warning('Error: Bad curator comment at %s' % row.source_bib)
                dt.drop(index, inplace=True)

@seasidesparrow
Copy link
Member Author

Resolved by #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant