def __init__(self, path=None, environment=None): """ The experiment will be built at *path*. It defaults to ``<scriptdir>/data/<scriptname>/``. E.g., for the script ``experiments/myexp.py``, the default *path* will be ``experiments/data/myexp/``. *environment* must be an :ref:`Environment <environments>` instance. You can use :class:`~lab.environments.LocalEnvironment` to run your experiment on a single computer (default). If you have access to the computer grid in Basel you can use the predefined grid environment :class:`~lab.environments.BaselSlurmEnvironment`. Alternatively, you can derive your own class from :ref:`Environment <environments>`. """ tools.configure_logging() if sys.version_info < (3, 6): tools.show_deprecation_warning( "Support for Python < 3.6 is deprecated.") _Buildable.__init__(self) path = path or _get_default_experiment_dir() self.path = os.path.abspath(path) if any(char in self.path for char in (':', ',')): logging.critical('Path contains commas or colons: %s' % self.path) self.environment = environment or environments.LocalEnvironment() self.environment.exp = self self.steps = [] self.runs = [] self.set_property('experiment_file', self._script)
def get_aggregation_function(function, functions): """ Code for backwards compatibility. """ if function and functions: logging.critical( 'You cannot use "function" and "functions" kwargs for ' "Attribute at the same time.") elif functions: tools.show_deprecation_warning( '"functions" kwarg for Attribute is deprecated. Use ' '"function" instead.') if len(functions) > 1: logging.critical( "Using multiple aggregation functions is unsupported.") return functions[0] else: return function