Esempio n. 1
0
    def __init__(self, outputdir, max_workers=1):
        if not os.path.isdir(outputdir):
            raise ValueError('Output directory (%s) is not a directory' % outputdir)
        self._outputdir = outputdir

        self._write_lock = threading.Lock()

        _Runner.__init__(self, max_workers)
Esempio n. 2
0
    def __init__(self, program, connection_dict, remote_workdir, local_outputdir,
                 dispatcher_class, **dispatcher_kwargs):
        _Runner.__init__(self, program)

        self._local_outputdir = local_outputdir

        self._dispatcher = \
            dispatcher_class(program, self._queue_options, self._queue_results,
                             connection_dict, remote_workdir, local_outputdir,
                             **dispatcher_kwargs)
Esempio n. 3
0
    def __init__(self, outputdir, workdir=None, overwrite=True,
                 max_workers=1):
        """
        Creates a new runner to run several simulations.

        Use :meth:`put` to add simulation to the run and then use the method
        :meth:`start` to start the simulation(s).
        Status of the simulations can be retrieved using the method
        :meth:`report`.
        The method :meth:`join` before closing an application to ensure that
        all simulations were run and all workers are stopped.

        :arg program: program used to run the simulations

        :arg outputdir: output directory for saving the results from the
            simulation. The directory must exists.

        :arg workdir: work directory for the simulation temporary files.
            If ``None``, a temporary folder is created and removed after each
            simulation is run. If not ``None``, the directory must exists.

        :arg overwrite: whether to overwrite already existing simulation file(s)

        :arg nbprocesses: number of processes/threads to use (default: 1)
        """
        if not os.path.isdir(outputdir):
            raise ValueError('Output directory (%s) is not a directory' % outputdir)
        self._outputdir = outputdir

        if workdir is not None and not os.path.isdir(workdir):
            raise ValueError('Work directory (%s) is not a directory' % workdir)
        self._workdir = workdir

        self._overwrite = overwrite

        self._write_lock = threading.Lock()

        _Runner.__init__(self, max_workers)