@@ -124,6 +124,9 @@ def try_float(value):
124
124
125
125
126
126
def html (_args ):
127
+ web_dir = Path (__file__ ).parent / "web"
128
+ json_output_dirs = [web_dir / "src" / "data" , web_dir / "public" ]
129
+
127
130
results = os .environ ["RESULTS_JSON" ]
128
131
print ("-------- $RESULTS_JSON --------" )
129
132
print (results )
@@ -151,8 +154,9 @@ def html(_args):
151
154
model_name = entry ["model_name" ]
152
155
results = {k : try_float (v ) for k , v in entry ["results" ].items ()}
153
156
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 )
156
160
157
161
# Process Manifest
158
162
try :
@@ -164,8 +168,9 @@ def html(_args):
164
168
except KeyError as e :
165
169
print ("MANIFEST environment variable not set, reading from Manifest.toml" )
166
170
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 )
169
174
170
175
# Process model definitions
171
176
model_keys = list (new_data .keys ())
@@ -174,8 +179,9 @@ def html(_args):
174
179
model_definitions = {}
175
180
for model_key in model_keys :
176
181
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 )
179
185
180
186
181
187
def parse_arguments ():
0 commit comments