Keep restart input provenance separate from destination output records
This commit is contained in:
@@ -137,18 +137,18 @@ def main():
|
|||||||
path = (path if path.is_absolute() else source / path).resolve()
|
path = (path if path.is_absolute() else source / path).resolve()
|
||||||
if word == '--restart-snapshot':
|
if word == '--restart-snapshot':
|
||||||
snapshot_file = path / 'accepted_state.txt' if path.is_dir() else path
|
snapshot_file = path / 'accepted_state.txt' if path.is_dir() else path
|
||||||
folder = snapshot_file.parent
|
prior_folder = snapshot_file.parent
|
||||||
if not (folder / 'metadata.txt').is_file():
|
if not (prior_folder / 'metadata.txt').is_file():
|
||||||
folder = folder.parent
|
prior_folder = prior_folder.parent
|
||||||
prior_manifest = folder.parent / 'provenance.json'
|
prior_manifest = prior_folder.parent / 'provenance.json'
|
||||||
prior_run = folder.parent / (folder.name + '_run.json')
|
prior_run = prior_folder.parent / (prior_folder.name + '_run.json')
|
||||||
prior = json.loads(prior_manifest.read_text())
|
prior = json.loads(prior_manifest.read_text())
|
||||||
saved_run = json.loads(prior_run.read_text())
|
saved_run = json.loads(prior_run.read_text())
|
||||||
if prior['mesh_sha256'] != provenance['mesh_sha256']:
|
if prior['mesh_sha256'] != provenance['mesh_sha256']:
|
||||||
raise RuntimeError('Restart mesh differs from the snapshot campaign.')
|
raise RuntimeError('Restart mesh differs from the snapshot campaign.')
|
||||||
for saved_file in (snapshot_file, folder / 'metadata.txt', folder / 'layout.csv'):
|
for saved_file in (snapshot_file, prior_folder / 'metadata.txt', prior_folder / 'layout.csv'):
|
||||||
value = digest(saved_file)
|
value = digest(saved_file)
|
||||||
key = str(saved_file.relative_to(folder))
|
key = str(saved_file.relative_to(prior_folder))
|
||||||
if value != saved_run['output_hashes'][key]:
|
if value != saved_run['output_hashes'][key]:
|
||||||
raise RuntimeError('Restart input no longer matches its original run: ' + key)
|
raise RuntimeError('Restart input no longer matches its original run: ' + key)
|
||||||
state_files[str(saved_file)] = value
|
state_files[str(saved_file)] = value
|
||||||
|
|||||||
Reference in New Issue
Block a user