Skip to content

Commit

Permalink
added (warned) support for running sacred in interactive mode
Browse files Browse the repository at this point in the history
(cherry picked from commit f590871)
  • Loading branch information
Qwlouse committed Apr 1, 2016
1 parent e603908 commit 04b6dfd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions sacred/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,19 @@ def is_local_source(filename, modname, experiment_path):

def gather_sources_and_dependencies(globs):
dependencies = set()
main = Source.create(globs.get('__file__'))
sources = {main}
experiment_path = os.path.dirname(main.filename)
filename = globs.get('__file__')

if filename is None:
import warnings
warnings.warn("Defining an experiment in interactive mode! "
"The sourcecode cannot be stored and the experiment "
"won't be reproducible")
sources = set()
experiment_path = os.path.abspath(os.path.curdir)
else:
main = Source.create(globs.get('__file__'))
sources = {main}
experiment_path = os.path.dirname(main.filename)
for glob in globs.values():
if isinstance(glob, module):
mod_path = glob.__name__
Expand Down

0 comments on commit 04b6dfd

Please sign in to comment.