@@ -138,6 +138,22 @@ def _parse_args(cmd) -> argparse.Namespace:
138138 return args
139139
140140
141+ def _report_serve_exclusive_parse_arg (cmd ):
142+ """Parses additional args exclusively for report.web"""
143+ web_parser = argparse .ArgumentParser (add_help = False )
144+ web_parser .add_argument ('--with-csv' ,
145+ '-csv' ,
146+ help = 'Will write a CSV file with the results.' ,
147+ action = 'store_true' )
148+ web_parser .add_argument ('--with-google-sheets' ,
149+ '-gs' ,
150+ help = 'Will write to Google Sheets.' ,
151+ action = 'store_true' )
152+
153+ report_arg , all_exp_arg_list = web_parser .parse_known_args (cmd )
154+ return report_arg , all_exp_arg_list
155+
156+
141157def _run_command (command : list [str ], shell = False ):
142158 """Runs a command and return its exit code."""
143159 process = subprocess .run (command , shell = shell , check = False )
@@ -177,7 +193,8 @@ def main(cmd=None):
177193 """Main entrypoint"""
178194 if os .path .isfile ('/experiment/data-dir.zip' ):
179195 subprocess .check_call (
180- 'apt-get install -y zip && zip -s0 data-dir.zip --out newd.zip && unzip newd.zip && rm ./data-dir.z*' ,
196+ 'apt-get install -y zip && zip -s0 data-dir.zip --out newd.zip && '
197+ 'unzip newd.zip && rm ./data-dir.z*' ,
181198 shell = True ,
182199 cwd = '/experiment' )
183200 if os .path .isdir (DATA_DIR ):
@@ -221,11 +238,23 @@ def run_on_data_from_scratch(cmd=None):
221238
222239 local_results_dir = 'results'
223240
224- # Generate a report and upload it to GCS
225- report_process = subprocess .Popen ([
241+ # split additional args that are exclusive to upload_report.sh,
242+ # pass the rest to run_all_experiment.py
243+ report_arg , args .additional_args = _report_serve_exclusive_parse_arg (
244+ args .additional_args )
245+
246+ report_cmd = [
226247 "bash" , "report/upload_report.sh" , local_results_dir , gcs_report_dir ,
227248 args .benchmark_set , args .model
228- ] + args .additional_args )
249+ ]
250+
251+ if report_arg .with_csv :
252+ report_cmd .append ('--with-csv' )
253+ if report_arg .with_google_sheets :
254+ report_cmd .append ('--with-google-sheets' )
255+
256+ # Generate a report and upload it to GCS
257+ report_process = subprocess .Popen (report_cmd )
229258
230259 # Launch run_all_experiments.py
231260 # some notes:
@@ -377,11 +406,23 @@ def run_standard(cmd=None):
377406 # Trends report use a similarly named path.
378407 gcs_trend_report_path = f"{ args .sub_dir } /{ experiment_name } .json"
379408
380- # Generate a report and upload it to GCS
381- report_process = subprocess .Popen ([
409+ # split additional args that are exclusive to upload_report.sh,
410+ # pass the rest to run_all_experiment.py
411+ report_arg , args .additional_args = _report_serve_exclusive_parse_arg (
412+ args .additional_args )
413+
414+ report_cmd = [
382415 "bash" , "report/upload_report.sh" , local_results_dir , gcs_report_dir ,
383416 args .benchmark_set , args .model
384- ] + args .additional_args )
417+ ]
418+
419+ if report_arg .with_csv :
420+ report_cmd .append ('--with-csv' )
421+ if report_arg .with_google_sheets :
422+ report_cmd .append ('--with-google-sheets' )
423+
424+ # Generate a report and upload it to GCS
425+ report_process = subprocess .Popen (report_cmd )
385426
386427 # Prepare the command to run experiments
387428 run_cmd = [
0 commit comments