def _prepare_resume(self):
        if not self._resumable:
            raise RuntimeError('If you create an environment to resume a run, you need to '
                               'set `continuable=True`.')

        if not self._do_single_runs:
            raise RuntimeError('You cannot resume a run if you did create an environment '
                               'with `do_single_runs=False`.')

        self._resume_path = os.path.join(self._resume_folder, self._trajectory_name)
        cnt_filename = os.path.join(self._resume_path, 'environment.ecnt')
        cnt_file = open(cnt_filename, 'rb')
        resume_dict = dill.load(cnt_file)
        cnt_file.close()
        traj = resume_dict['trajectory']

        # We need to update the information about the trajectory name
        config_name = 'config.environment.%s.trajectory.name' % self.name
        if self._traj.f_contains(config_name, shortcuts=False):
            param = self._traj.f_get(config_name, shortcuts=False)
            param.f_unlock()
            param.f_set(traj.v_name)
            param.f_lock()

        config_name = 'config.environment.%s.trajectory.timestamp' % self.name
        if self._traj.f_contains(config_name, shortcuts=False):
            param = self._traj.f_get(config_name, shortcuts=False)
            param.f_unlock()
            param.f_set(traj.v_timestamp)
            param.f_lock()

        # Merge the information so that we keep a record about the current environment
        if not traj.config.environment.f_contains(self.name, shortcuts=False):
            traj._merge_config(self._traj)
        self._traj = traj

        # User's job function
        self._runfunc = resume_dict['runfunc']
        # Arguments to the user's job function
        self._args = resume_dict['args']
        # Keyword arguments to the user's job function
        self._kwargs = resume_dict['kwargs']
        # Postproc Function
        self._postproc = resume_dict['postproc']
        # Postprog args
        self._postproc_args = resume_dict['postproc_args']
        # Postproc Kwargs
        self._postproc_kwargs = resume_dict['postproc_kwargs']

        # Unpack the trajectory
        self._traj.v_full_copy = resume_dict['full_copy']
        # Load meta data
        self._traj.f_load(load_parameters=pypetconstants.LOAD_NOTHING,
                          load_derived_parameters=pypetconstants.LOAD_NOTHING,
                          load_results=pypetconstants.LOAD_NOTHING,
                          load_other_data=pypetconstants.LOAD_NOTHING)

        # Now we have to reconstruct previous results
        result_list = []
        full_filename_list = []
        for filename in os.listdir(self._resume_path):
            _, ext = os.path.splitext(filename)

            if ext != '.rcnt':
                continue

            full_filename = os.path.join(self._resume_path, filename)
            cnt_file = open(full_filename, 'rb')
            result_list.append(dill.load(cnt_file))
            cnt_file.close()
            full_filename_list.append(full_filename)

        new_result_list = []
        for result_tuple in result_list:
            run_information = result_tuple[1]
            self._traj._update_run_information(run_information)
            new_result_list.append(result_tuple[0])
        result_sort(new_result_list)

        # Add a config parameter signalling that an experiment was resumed, and how many of them
        config_name = 'environment.%s.resumed' % self.name
        if not config_name in self._traj:
            self._traj.f_add_config(Parameter, config_name, True,
                                    comment='Added if a crashed trajectory was continued.')

        self._logger.info('I will resume trajectory `%s`.' % self._traj.v_name)

        return new_result_list
Get the list of NagCat services in the object cache
dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/environment.py/Environment._prepare_resume--crossover with--dataset/ETHPy150Open marineam/nagcat/python/nagcat/nagios.py/NagcatNagios._parse_tests