예제 #1
0
 def _get_run_info_dict(self, run_id):
     """Get the RunInfo for a run, as a dict."""
     run_info_path = os.path.join(self._settings.info_dir, run_id, 'info')
     if os.path.exists(run_info_path):
         # We copy the RunInfo as a dict, so we can add stuff to it to pass to the template.
         return RunInfo(run_info_path).get_as_dict()
     else:
         return None
예제 #2
0
    def _get_all_run_infos(self):
        """Find the RunInfos for all runs since the last clean-all."""
        info_dir = self._settings.info_dir
        if not os.path.isdir(info_dir):
            return []
        paths = [os.path.join(info_dir, x) for x in os.listdir(info_dir)]

        # We copy the RunInfo as a dict, so we can add stuff to it to pass to the template.
        # We filter only those that have a timestamp, to avoid a race condition with writing
        # that field.
        return filter(lambda d: 'timestamp' in d, [
            RunInfo(os.path.join(p, 'info')).get_as_dict()
            for p in paths if os.path.isdir(p) and not os.path.islink(p)
        ])