Skip to content

Commit

Permalink
added a more helpful message when using -m/-mongo_db and the pymongo …
Browse files Browse the repository at this point in the history
…package is missing
  • Loading branch information
Qwlouse committed Jan 13, 2016
1 parent 1e9a84a commit e2acfa3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Release History
---------------

0.6.8 (2016-??-??)
0.6.8 (2016-01-14)
++++++++++++++++++
* Feature: Added automatic conversion of ``pandas`` datastructures in the
custom info dict to json-format in the MongoObserver.
Expand All @@ -19,6 +19,7 @@ Release History
* Bugfix: Fixed a problem with numpy datatypes in the configuration
* Bugfix: More helpful error messages when using ``return`` or ``yield`` in a
config scope
* Bugfix: Be more helpful when using -m/--mongo_db and pymongo is not installed

0.6.7 (2015-09-11)
++++++++++++++++++
Expand Down
13 changes: 13 additions & 0 deletions sacred/observers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# coding=utf-8
from __future__ import division, print_function, unicode_literals

from sacred.commandline_options import CommandLineOption

from sacred.observers.base import RunObserver
import sacred.optional as opt

Expand All @@ -10,4 +12,15 @@
else:
MongoObserver = opt.MissingDependencyMock('pymongo')

class MongoDbOption(CommandLineOption):
"""To use the MongoObserver you need to install pymongo first."""

arg = 'DB'

@classmethod
def apply(cls, args, run):
raise ImportError('cannot use -m/--mongo_db flag: '
'missing pymongo dependency')


__all__ = ('RunObserver', 'MongoObserver')

0 comments on commit e2acfa3

Please sign in to comment.