def list_index_files(self): index_dirname = IndexFileLocationUtils.get_index_path(self.path) # index files are json files or csv files ending with string ".csv" or ".json" index_files_regex = r"(.+)\.(json|csv)$" index_files = list_files_in_directory(index_dirname, file_regex=index_files_regex) return sorted(index_files)
def list_event_files(self, start_after_key=None): # event files are ending with string ".tfevents" event_file_regex = r"(.+)\.(tfevents)$" event_files = list_files_in_directory( get_path_to_events_directory(self.path), file_regex=event_file_regex ) event_files.sort() start_after_index = bisect_left(event_files, start_after_key) return event_files[start_after_index:]
def _refresh_event_file_list_local_mode(self, trace_root_folder): path = os.path.expanduser(trace_root_folder) event_dir = os.path.join(path, self.prefix, "") event_files = list_files_in_directory( event_dir, file_regex=self._get_event_file_regex()) for event_file in event_files: timestamp = self._get_timestamp_from_filename(event_file) if timestamp is None: self.logger.debug( f"Unable to find timestamp from event file name {event_file}." ) continue if timestamp in self._timestamp_to_filename: if event_file not in self._timestamp_to_filename[timestamp]: self._timestamp_to_filename[timestamp].append(event_file) else: self._timestamp_to_filename[timestamp] = [event_file] for timestamp in self._timestamp_to_filename: self._timestamp_to_filename[timestamp].sort()
def list_event_files(self, start_after_key=None): event_files = list_files_in_directory(get_path_to_events_directory(self.path)) event_files.sort() start_after_index = bisect_left(event_files, start_after_key) return event_files[start_after_index:]
def list_index_files(self): index_dirname = IndexFileLocationUtils.get_index_path(self.path) index_files = list_files_in_directory(index_dirname) return sorted(index_files)
def _get_collection_files(self) -> list: return list_files_in_directory(get_path_to_collections(self.path))