Пример #1
0
    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()

        _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(f"Path contains commas or colons: {self.path}")
        self.environment = environment or environments.LocalEnvironment()
        self.environment.exp = self

        self.steps = []
        self.runs = []

        self.set_property("experiment_file", self._script)
Пример #2
0
 def __init__(self):
     tools.configure_logging()
     self.file_parsers = defaultdict(_FileParser)
Пример #3
0
A module for running FS experiments.
"""

import logging
import os.path

from downward.experiment import FastDownwardRun, FastDownwardExperiment, _DownwardAlgorithm
from lab.experiment import Run
from lab import tools

from .cached_revision import FSCachedRevision

DIR = os.path.dirname(os.path.abspath(__file__))
DOWNWARD_SCRIPTS_DIR = os.path.join(DIR, 'scripts')

RUN_TPL = """#! /usr/bin/env python
# -*- coding: utf-8 -*-

import logging
import os
import platform

from fslab.call import Call
from lab import tools

tools.configure_logging()

logging.info('node: {}'.format(platform.node()))

run_log = open('run.log', 'w')
run_err = open('run.err', 'w', buffering=1)  # line buffering