src-d / modelforge

Python library to share machine learning models easily and reliably.
Apache License 2.0
18 stars 13 forks source link

Trailing dots in log message raise AssertionError-s #105

Closed warenlg closed 5 years ago

warenlg commented 5 years ago

A function decorater has been added to check if log messages end with a dot https://github.com/src-d/modelforge/commit/9111b3516ce6fd41973e3e8589c5ef31482c529d. And indeed it works well since it is raising errors when such log message appear:

➜  ~ modelforge publish -f .modelforge/bot_detection/bot_detection.asdf --meta .modelforge/bot_detection/template_meta.json
INFO:0189:generic:Reading /home/waren/.modelforge/bot_detection/bot_detection.asdf (100.0 kB)...
INFO:0189:gcs-backend:Connecting to the bucket...
INFO:0189:gcs-backend:Uploading bot-detection from /home/waren/.modelforge/bot_detection/bot_detection.asdf...
[################################] 98304/100278 - 00:00:00
INFO:0189:publish_model:Uploaded as https://storage.googleapis.com/models.cdn.sourced.tech/models%2Fbot-detection%2F599cf161-8e51-44ad-a576-3dd1518afb80.asdf
INFO:0189:publish_model:Updating the models index...
INFO:0189:GitIndex:Loaded /home/waren/.local/lib/python3.6/site-packages/modelforge/templates/template_model.md.jinja2
INFO:0189:GitIndex:Loaded /home/waren/.local/lib/python3.6/site-packages/modelforge/templates/template_readme.md.jinja2
INFO:0189:GitIndex:Added /home/waren/.modelforge/cache/source{d}/warenlg/models/bot-detection/599cf161-8e51-44ad-a576-3dd1518afb80.md
INFO:0189:GitIndex:Updated /home/waren/.modelforge/cache/source{d}/warenlg/models/README.md
INFO:0189:GitIndex:Writing the new index.json ...
INFO:0189:GitIndex:Committing the index without DCO
INFO:0189:GitIndex:Pushing the updated index ...
Push to ssh://git@github.com/warenlg/models successful.
Traceback (most recent call last):
  File "/home/waren/.local/bin/modelforge", line 11, in <module>
    sys.exit(main())
  File "/home/waren/.local/lib/python3.6/site-packages/modelforge/__main__.py", line 122, in main
    return handler(args)
  File "/home/waren/.local/lib/python3.6/site-packages/modelforge/backends.py", line 93, in wrapped_supply_backend
    return func(args, backend, log)
  File "/home/waren/.local/lib/python3.6/site-packages/modelforge/registry.py", line 84, in publish_model
    log.info("Successfully published.")
  File "/usr/lib/python3.6/logging/__init__.py", line 1308, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
    self.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
    self.emit(record)
  File "/home/waren/.local/lib/python3.6/site-packages/modelforge/slogging.py", line 75, in decorated_with_check_trailing_dot
    (record.name, msg))
AssertionError: Log message is not allowed to have a trailing dot: publish_model: "Successfully published."

So, let's fix those log messages once for all.