-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.py
27 lines (25 loc) · 971 Bytes
/
verify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Experiment metrics are saved as YAML files
import yaml
# Use the DVC api for loading the YAML parameters
import dvc.api
# Find all files matching a pattern in directory
import glob
# Script entrypoint
if __name__ == "__main__":
# Load the parameters file
params = dvc.api.params_show("params.yaml")
# Collect all verification output filenames
outputs = glob.glob(
f"{params['build']['output_dir']}/verification_output/*.npy"
)
# Extract the verification status for each verification output by matching
# to the SUCCESS string contained in the filename
status = all([
out.split("_")[-1].split(".")[0] == "SUCCESS" for out in outputs
])
# Dump the verification status as yaml
with open("verification.yaml", "w") as file:
# Construct a dictionary reporting the verification status as string
yaml.safe_dump(
{"verification": {True: "success", False: "fail"}[status]}, file
)