INNER CODE UNIT · Python
open_resource
IDSIA/sacred · sacred/run.py:121
def open_resource(self, filename, mode="r"):
"""Open a file and also save it as a resource.
Opens a file, reports it to the observers as a resource, and returns
the opened file.
In Sacred terminology a resource is a file that the experiment needed
to access during a run. In case of a MongoObserver that means making
sure the file is stored in the database (but avoiding duplicates) along
its path and md5 sum.
See also :py:meth:`sacred.Experiment.open_resource`.
Parameters
----------
filename : str
name of the file that should be opened
mode : str