예제 #1
0
    def __init__(self, pipefile=None, feedback=2):

        # Read in the parameters.
        self.params, self.task_params = parse_ini.parse(pipefile, self.params_init, prefix=self.prefix, return_undeclared=True, feedback=feedback)
        self.tasks = self.params['tasks']

        # set environment var
        os.environ['TL_OUTPUT'] = self.params['outdir'] + '/'

        # copy pipefile to outdir if required
        if self.params['copy']:
            base_name = path.basename(pipefile)
            dst_file = '%s/%s' % (self.params['outdir'], base_name)
            outdir = output_path(dst_file, relative=False, mkdir=True)
            if mpiutil.rank0:
                if self.params['overwrite']:
                    shutil.copy2(pipefile, dst_file)
                else:
                    if not path.exists(dst_file):
                        shutil.copy2(pipefile, dst_file)
                    else:
                        base, ext = path.splitext(dst_file)
                        for cnt in itertools.count(1):
                            dst = '%s_%d%s' % (base, cnt, ext) # add cnt to file name
                            if not path.exists(dst):
                                shutil.copy2(pipefile, dst)
                                break

            mpiutil.barrier()
예제 #2
0
    def __init__(self, pipefile=None, feedback=2):

        # Read in the parameters.
        self.params, self.task_params = parse_ini.parse(pipefile, self.params_init, prefix=self.prefix, return_undeclared=True, feedback=feedback)
        self.tasks = self.params['tasks']

        # timing the running
        if self.params['timing']:
            self.start_time = datetime.datetime.now()
            if mpiutil.rank0:
                print 'Start the pipeline at %s...' % self.start_time

        # set environment var
        os.environ['TL_OUTPUT'] = self.params['outdir'] + '/'

        # copy pipefile to outdir if required
        if self.params['copy']:
            base_name = path.basename(pipefile)
            dst_file = '%s/%s' % (self.params['outdir'], base_name)
            outdir = output_path(dst_file, relative=False, mkdir=True)
            if mpiutil.rank0:
                if self.params['overwrite']:
                    shutil.copy2(pipefile, dst_file)
                else:
                    if not path.exists(dst_file):
                        shutil.copy2(pipefile, dst_file)
                    else:
                        base, ext = path.splitext(dst_file)
                        for cnt in itertools.count(1):
                            dst = '%s_%d%s' % (base, cnt, ext) # add cnt to file name
                            if not path.exists(dst):
                                shutil.copy2(pipefile, dst)
                                break

            mpiutil.barrier()
예제 #3
0
    def __init__(self, parameter_file_or_dict=None, feedback=2):

        # get all params that has merged params of the all super classes
        all_params = self.__class__._get_params()

        # Read in the parameters.
        self.params = parse_ini.parse(parameter_file_or_dict, all_params, prefix=self.prefix, feedback=feedback)

        # setup pipeline
        self._pipeline_setup()
예제 #4
0
    def __init__(self, parameter_file_or_dict=None, feedback=2):

        # get all params that has merged params of the all super classes
        all_params = self.__class__._get_params()

        # Read in the parameters.
        self.params = parse_ini.parse(parameter_file_or_dict, all_params, prefix=self.prefix, feedback=feedback)

        # setup pipeline
        self._pipeline_setup()