pypet/storageservice.py
def _trj_load_meta_data(self, traj, load_data, as_new, with_run_information, force):
        """Loads meta information about the trajectory

        Checks if the version number does not differ from current pypet version
        Loads, comment, timestamp, name, version from disk in case trajectory is not loaded
        as new. Updates the run information as well.

        """

        metatable = self._overview_group.info
        metarow = metatable[0]

        try:
            version = metarow['version'].decode('utf-8')
        except (IndexError, ValueError) as ke:
            self._logger.error('Could not check version due to: %s' % str(ke))
            version = '`COULD NOT BE LOADED`'

        try:
            python = metarow['python'].decode('utf-8')
        except (IndexError, ValueError) as ke:
            self._logger.error('Could not check version due to: %s' % str(ke))
            python = '`COULD NOT BE LOADED`'

        self._trj_check_version(version, python, force)

        # Load the skeleton information
        self._grp_load_group(traj, load_data=load_data,
                             with_links=False, recursive=False, _traj=traj,
                             _as_new=as_new, _hdf5_group=self._trajectory_group)

        if as_new:
            length = int(metarow['length'])
            for irun in range(length):
                traj._add_run_info(irun)
        else:
            traj._comment =  metarow['comment'].decode('utf-8')
            traj._timestamp = float(metarow['timestamp'])
            traj._trajectory_timestamp = traj._timestamp
            traj._time = metarow['time'].decode('utf-8')
            traj._trajectory_time = traj._time
            traj._name = metarow['name'].decode('utf-8')
            traj._trajectory_name = traj._name
            traj._version = version
            traj._python = python

            single_run_table = self._overview_group.runs

            if with_run_information:
                for row in single_run_table.iterrows():
                    name = row['name'].decode('utf-8')
                    idx = int(row['idx'])
                    timestamp = float(row['timestamp'])
                    time_ = row['time'].decode('utf-8')
                    completed = int(row['completed'])
                    summary = row['parameter_summary'].decode('utf-8')
                    hexsha = row['short_environment_hexsha'].decode('utf-8')


                    # To allow backwards compatibility we need this try catch block
                    try:
                        runtime = row['runtime'].decode('utf-8')
                        finish_timestamp = float(row['finish_timestamp'])
                    except (IndexError, ValueError) as ke:
                        runtime = ''
                        finish_timestamp = 0.0
                        self._logger.debug('Could not load runtime, ' + repr(ke))

                    info_dict = {'idx': idx,
                                 'timestamp': timestamp,
                                 'finish_timestamp': finish_timestamp,
                                 'runtime': runtime,
                                 'time': time_,
                                 'completed': completed,
                                 'name': name,
                                 'parameter_summary': summary,
                                 'short_environment_hexsha': hexsha}

                    traj._add_run_info(**info_dict)
            else:
                traj._length = single_run_table.nrows

        # Load explorations
        self._trj_load_exploration(traj)
        # Load the hdf5 config data:
        self._srvc_load_hdf5_settings()
def _trj_load_meta_data(self, traj, load_data, as_new, with_run_information, force):
        metatable = self._overview_group.info
        metarow = metatable[0]

        try:
            version = metarow['version'].decode('utf-8')
        except (IndexError, ValueError) as ke:
            self._logger.error('Could not check version due to: %s' % str(ke))
            version = '`COULD NOT BE LOADED`'

        try:
            python = metarow['python'].decode('utf-8')
        except (IndexError, ValueError) as ke:
            self._logger.error('Could not check version due to: %s' % str(ke))
            python = '`COULD NOT BE LOADED`'

        self._trj_check_version(version, python, force)

        # Load the skeleton information
        self._grp_load_group(traj, load_data=load_data,
                             with_links=False, recursive=False, _traj=traj,
                             _as_new=as_new, _hdf5_group=self._trajectory_group)

        if as_new:
            length = int(metarow['length'])
            for irun in range(length):
                traj._add_run_info(irun)
        else:
            traj._comment =  metarow['comment'].decode('utf-8')
            traj._timestamp = float(metarow['timestamp'])
            traj._trajectory_timestamp = traj._timestamp
            traj._time = metarow['time'].decode('utf-8')
            traj._trajectory_time = traj._time
            traj._name = metarow['name'].decode('utf-8')
            traj._trajectory_name = traj._name
            traj._version = version
            traj._python = python

            single_run_table = self._overview_group.runs

            if with_run_information:
                for row in single_run_table.iterrows():
                    name = row['name'].decode('utf-8')
                    idx = int(row['idx'])
                    timestamp = float(row['timestamp'])
                    time_ = row['time'].decode('utf-8')
                    completed = int(row['completed'])
                    summary = row['parameter_summary'].decode('utf-8')
                    hexsha = row['short_environment_hexsha'].decode('utf-8')


                    # To allow backwards compatibility we need this try catch block
                    try:
                        runtime = row['runtime'].decode('utf-8')
                        finish_timestamp = float(row['finish_timestamp'])
                    except (IndexError, ValueError) as ke:
                        runtime = ''
                        finish_timestamp = 0.0
                        self._logger.debug('Could not load runtime, ' + repr(ke))

                    info_dict = {'idx': idx,
                                 'timestamp': timestamp,
                                 'finish_timestamp': finish_timestamp,
                                 'runtime': runtime,
                                 'time': time_,
                                 'completed': completed,
                                 'name': name,
                                 'parameter_summary': summary,
                                 'short_environment_hexsha': hexsha}

                    traj._add_run_info(**info_dict)
            else:
                traj._length = single_run_table.nrows

        # Load explorations
        self._trj_load_exploration(traj)
        # Load the hdf5 config data:
        self._srvc_load_hdf5_settings()
def _trj_load_meta_data ( self , traj , load_data , as_new , with_run_information , force ) : metatable = self . _overview_group . info metarow = metatable [ 0 ] try : version = metarow [ 'version' ] . decode ( 'utf-8' ) except ( IndexError , ValueError ) as ke : self . _logger . error ( 'Could not check version due to: %s' % str ( ke ) ) version = '`COULD NOT BE LOADED`' try : python = metarow [ 'python' ] . decode ( 'utf-8' ) except ( IndexError , ValueError ) as ke : self . _logger . error ( 'Could not check version due to: %s' % str ( ke ) ) python = '`COULD NOT BE LOADED`' self . _trj_check_version ( version , python , force ) # Load the skeleton information self . _grp_load_group ( traj , load_data = load_data , with_links = False , recursive = False , _traj = traj , _as_new = as_new , _hdf5_group = self . _trajectory_group ) if as_new : length = int ( metarow [ 'length' ] ) for irun in range ( length ) : traj . _add_run_info ( irun ) else : traj . _comment = metarow [ 'comment' ] . decode ( 'utf-8' ) traj . _timestamp = float ( metarow [ 'timestamp' ] ) traj . _trajectory_timestamp = traj . _timestamp traj . _time = metarow [ 'time' ] . decode ( 'utf-8' ) traj . _trajectory_time = traj . _time traj . _name = metarow [ 'name' ] . decode ( 'utf-8' ) traj . _trajectory_name = traj . _name traj . _version = version traj . _python = python single_run_table = self . _overview_group . runs if with_run_information : for row in single_run_table . iterrows ( ) : name = row [ 'name' ] . decode ( 'utf-8' ) idx = int ( row [ 'idx' ] ) timestamp = float ( row [ 'timestamp' ] ) time_ = row [ 'time' ] . decode ( 'utf-8' ) completed = int ( row [ 'completed' ] ) summary = row [ 'parameter_summary' ] . decode ( 'utf-8' ) hexsha = row [ 'short_environment_hexsha' ] . decode ( 'utf-8' ) # To allow backwards compatibility we need this try catch block try : runtime = row [ 'runtime' ] . decode ( 'utf-8' ) finish_timestamp = float ( row [ 'finish_timestamp' ] ) except ( IndexError , ValueError ) as ke : runtime = '' finish_timestamp = 0.0 self . _logger . debug ( 'Could not load runtime, ' + repr ( ke ) ) info_dict = { 'idx' : idx , 'timestamp' : timestamp , 'finish_timestamp' : finish_timestamp , 'runtime' : runtime , 'time' : time_ , 'completed' : completed , 'name' : name , 'parameter_summary' : summary , 'short_environment_hexsha' : hexsha } traj . _add_run_info ( * * info_dict ) else : traj . _length = single_run_table . nrows # Load explorations self . _trj_load_exploration ( traj ) # Load the hdf5 config data: self . _srvc_load_hdf5_settings ( )
Loads meta information about the trajectory

        Checks if the version number does not differ from current pypet version
        Loads, comment, timestamp, name, version from disk in case trajectory is not loaded
        as new. Updates the run information as well.
Loads meta information about the trajectory