Ejemplo n.º 1
0
 def _list_run_infos(self, experiment_id, view_type):
     self._check_root_dir()
     if not self._has_experiment(experiment_id):
         return []
     experiment_dir = self._get_experiment_path(experiment_id,
                                                assert_exists=True)
     run_uuids = list_all(
         experiment_dir,
         filter_func=lambda x: all([
             os.path.basename(os.path.normpath(x)) != reservedFolderName
             for reservedFolderName in FileStore.RESERVED_EXPERIMENT_FOLDERS
         ]) and os.path.isdir(x),
         full_path=False)
     run_infos = []
     for r_id in run_uuids:
         try:
             # trap and warn known issues, will raise unexpected exceptions to caller
             run_info = self._get_run_info(r_id)
             if run_info is None:
                 continue
             if LifecycleStage.matches_view_type(view_type,
                                                 run_info.lifecycle_stage):
                 run_infos.append(run_info)
         except MissingConfigException as rnfe:
             # trap malformed run exception and log warning
             logging.warning("Malformed run '%s'. Detailed error %s",
                             r_id,
                             str(rnfe),
                             exc_info=True)
     return run_infos
Ejemplo n.º 2
0
 def list_artifacts(self, path=None):
     artifact_dir = self.artifact_uri
     list_dir = build_path(artifact_dir, path) if path else artifact_dir
     artifact_files = list_all(list_dir, full_path=True)
     return [
         get_file_info(f, get_relative_path(artifact_dir, f))
         for f in artifact_files
     ]
Ejemplo n.º 3
0
 def list_artifacts(self, path=None):
     artifact_dir = self.artifact_uri
     list_dir = build_path(artifact_dir, path) if path else artifact_dir
     artifact_files = list_all(list_dir, full_path=True)
     infos = [
         get_file_info(f, get_relative_path(artifact_dir, f))
         for f in artifact_files
     ]
     return sorted(infos, key=lambda f: f.path)
Ejemplo n.º 4
0
 def list_artifacts(self, path=None):
     artifact_dir = self.artifact_uri
     list_dir = self.get_path_module().join(artifact_dir, path) if path else artifact_dir
     if self.get_path_module().isdir(list_dir):
         artifact_files = list_all(list_dir, full_path=True)
         infos = [get_file_info(f, self.get_path_module().relpath(f, artifact_dir))
                  for f in artifact_files]
         return sorted(infos, key=lambda f: f.path)
     else:
         return []
Ejemplo n.º 5
0
 def list_artifacts(self, path=None):
     # NOTE: The path is expected to be in posix format.
     # Posix paths work fine on windows but just in case we normalize it here.
     if path:
         path = os.path.normpath(path)
     list_dir = os.path.join(self.artifact_dir, path) if path else self.artifact_dir
     if os.path.isdir(list_dir):
         artifact_files = list_all(list_dir, full_path=True)
         infos = [get_file_info(f,
                                relative_path_to_artifact_path(
                                    os.path.relpath(f, self.artifact_dir)))
                  for f in artifact_files]
         return sorted(infos, key=lambda f: f.path)
     else:
         return []
Ejemplo n.º 6
0
 def _list_run_uuids(self, experiment_id, run_view_type):
     self._check_root_dir()
     experiment_dir = self._get_experiment_path(experiment_id)[0]
     run_uuids = list_all(experiment_dir, os.path.isdir, full_path=False)
     if run_view_type == ViewType.ALL:
         return run_uuids
     elif run_view_type == ViewType.ACTIVE_ONLY:
         return [
             r_id for r_id in run_uuids if self._get_run_info(
                 r_id).lifecycle_stage == RunInfo.ACTIVE_LIFECYCLE
         ]
     else:
         return [
             r_id for r_id in run_uuids if self._get_run_info(
                 r_id).lifecycle_stage == RunInfo.DELETED_LIFECYCLE
         ]
Ejemplo n.º 7
0
 def _list_run_infos(self, experiment_id, view_type):
     self._check_root_dir()
     if not self._has_experiment(experiment_id):
         return []
     experiment_dir = self._get_experiment_path(experiment_id, assert_exists=True)
     run_uuids = list_all(experiment_dir, os.path.isdir, full_path=False)
     run_infos = []
     for r_id in run_uuids:
         try:
             # trap and warn known issues, will raise unexpected exceptions to caller
             run_info = self._get_run_info(r_id)
             if run_info is None:
                 continue
             if LifecycleStage.matches_view_type(view_type, run_info.lifecycle_stage):
                 run_infos.append(run_info)
         except MissingConfigException as rnfe:
             # trap malformed run exception and log warning
             logging.warning("Malformed run '%s'. Detailed error %s", r_id, str(rnfe),
                             exc_info=True)
     return run_infos
Ejemplo n.º 8
0
 def _list_run_infos(self, experiment_id, view_type):
     self._check_root_dir()
     if not self._has_experiment(experiment_id):
         return []
     experiment_dir = self._get_experiment_path(experiment_id,
                                                assert_exists=True)
     run_dirs = list_all(
         experiment_dir,
         filter_func=lambda x: all([
             os.path.basename(os.path.normpath(x)) != reservedFolderName
             for reservedFolderName in FileStore.RESERVED_EXPERIMENT_FOLDERS
         ]) and os.path.isdir(x),
         full_path=True,
     )
     run_infos = []
     for r_dir in run_dirs:
         try:
             # trap and warn known issues, will raise unexpected exceptions to caller
             run_info = self._get_run_info_from_dir(r_dir)
             if run_info.experiment_id != experiment_id:
                 logging.warning(
                     "Wrong experiment ID (%s) recorded for run '%s'. "
                     "It should be %s. Run will be ignored.",
                     str(run_info.experiment_id),
                     str(run_info.run_id),
                     str(experiment_id),
                     exc_info=True,
                 )
                 continue
             if LifecycleStage.matches_view_type(view_type,
                                                 run_info.lifecycle_stage):
                 run_infos.append(run_info)
         except MissingConfigException as rnfe:
             # trap malformed run exception and log warning
             r_id = os.path.basename(r_dir)
             logging.warning("Malformed run '%s'. Detailed error %s",
                             r_id,
                             str(rnfe),
                             exc_info=True)
     return run_infos