diff --git a/signac/project.py b/signac/project.py index f05829958..2961bdfeb 100644 --- a/signac/project.py +++ b/signac/project.py @@ -1389,7 +1389,7 @@ def _build_index(self, include_job_document=False): raise yield job_id, doc - def _update_in_memory_cache(self, validate=False): + def _update_in_memory_cache(self): """Update the in-memory state point cache to reflect the workspace.""" logger.debug("Updating in-memory cache...") start = time.time() @@ -1402,7 +1402,7 @@ def _update_in_memory_cache(self, validate=False): del self._sp_cache[id_] def _add(id_): - self._sp_cache[id_] = self._get_statepoint_from_workspace(id_, validate) + self._sp_cache[id_] = self._get_statepoint_from_workspace(id_) to_add_chunks = _split_and_print_progress( iterable=list(to_add), @@ -1429,7 +1429,7 @@ def _remove_persistent_cache_file(self): if error.errno != errno.ENOENT: raise error - def update_cache(self, validate=True): + def update_cache(self): """Update the persistent state point cache. This function updates a persistent state point cache, which @@ -1437,17 +1437,12 @@ def update_cache(self, validate=True): including iteration and filtering or selection are expected to be significantly faster after calling this function, especially for large data spaces. - - Parameters - ---------- - validate : bool - When True, validate that any statepoint read from disk matches the job_id. """ logger.info("Update cache...") start = time.time() cache = self._read_cache() cached_ids = set(self._sp_cache) - self._update_in_memory_cache(validate) + self._update_in_memory_cache() if cache is None or set(cache) != cached_ids: fn_cache = self.fn(self.FN_CACHE) fn_cache_tmp = fn_cache + "~" diff --git a/tests/test_project.py b/tests/test_project.py index 19f13418e..2b75e2eb5 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -513,7 +513,11 @@ def test_rename_workspace(self): with pytest.raises(JobsCorruptedError): self.project.check() # ... we reinitialize the initial job, ... - job.init() + try: + job.init() + except JobsCorruptedError: + # ... which raises the JobsCorruptedError in update_cache + pass with pytest.raises(JobsCorruptedError): # ... which means the repair attempt must fail. self.project.repair() @@ -2102,7 +2106,7 @@ class UpdateCacheAfterInitJob(signac.job.Job): def init(self, *args, **kwargs): job = super().init(*args, **kwargs) - self._project.update_cache(validate=False) + self._project.update_cache() return job