exp show: don't cache collection errors

This commit is contained in:
Peter Rowlands
2023-03-06 15:25:27 +09:00
committed by Peter Rowlands (변기호)
parent 83835afa69
commit 1d2892efac
2 changed files with 11 additions and 3 deletions
+10
View File
@@ -117,6 +117,16 @@ class SerializableExp:
except (TypeError, json.JSONDecodeError) as exc:
raise DeserializeError("failed to load SerializableExp") from exc
@property
def contains_error(self) -> bool:
return (
self.error is not None
or self.params.get("error")
or any(value.get("error") for value in self.params.values())
or self.metrics.get("error")
or any(value.get("error") for value in self.metrics.values())
)
@dataclass(frozen=True)
class _ExpDep:
+1 -3
View File
@@ -97,14 +97,12 @@ def collect_experiment_commit(
force=force,
**kwargs,
)
if exp_rev != "workspace" and not param_deps:
if exp_rev != "workspace" and not param_deps and not exp.contains_error:
cache.put(exp, force=True)
return _format_exp(exp)
except Exception as exc: # noqa: BLE001, pylint: disable=broad-except
logger.debug("", exc_info=True)
error = SerializableError(str(exc), type(exc).__name__)
if not (exp_rev == "workspace" or param_deps or status == ExpStatus.Running):
cache.put(error, rev=exp_rev, force=True)
return _format_error(error)