Skip to content

Commit aa0a1b8

Browse files
committed
Output to both web/public and web/src/data
1 parent d70f6df commit aa0a1b8

File tree

4 files changed

+13
-26
lines changed

4 files changed

+13
-26
lines changed

ad.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ def try_float(value):
124124

125125

126126
def html(_args):
127+
web_dir = Path(__file__).parent / "web"
128+
json_output_dirs = [web_dir / "src" / "data", web_dir / "public"]
129+
127130
results = os.environ["RESULTS_JSON"]
128131
print("-------- $RESULTS_JSON --------")
129132
print(results)
@@ -151,8 +154,9 @@ def html(_args):
151154
model_name = entry["model_name"]
152155
results = {k: try_float(v) for k, v in entry["results"].items()}
153156
new_data[model_name] = results
154-
with open("web/src/data/adtests.json", "w") as f:
155-
json.dump(new_data, f, indent=2)
157+
for dir in json_output_dirs:
158+
with open(dir / "adtests.json", "w") as f:
159+
json.dump(new_data, f, indent=2)
156160

157161
# Process Manifest
158162
try:
@@ -164,8 +168,9 @@ def html(_args):
164168
except KeyError as e:
165169
print("MANIFEST environment variable not set, reading from Manifest.toml")
166170
manifest = get_manifest_dict()
167-
with open("web/src/data/manifest.json", "w") as f:
168-
json.dump(manifest, f, indent=2)
171+
for dir in json_output_dirs:
172+
with open(dir / "manifest.json", "w") as f:
173+
json.dump(new_data, f, indent=2)
169174

170175
# Process model definitions
171176
model_keys = list(new_data.keys())
@@ -174,8 +179,9 @@ def html(_args):
174179
model_definitions = {}
175180
for model_key in model_keys:
176181
model_definitions[model_key] = get_model_definition(model_key)
177-
with open("web/src/data/model_definitions.json", "w") as f:
178-
json.dump(model_definitions, f, indent=2)
182+
for dir in json_output_dirs:
183+
with open(dir / "model_definitions.json", "w") as f:
184+
json.dump(new_data, f, indent=2)
179185

180186

181187
def parse_arguments():

web/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ dist-ssr
2424
*.sw?
2525

2626
src/data/*.json
27+
public/*.json

web/public/.gitkeep

Whitespace-only changes.

web/src/data/a.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)