[docs]defdownload(experiment_id,local_output_path="",files_to_get=None):""" Download HIV output file(s) to local disk. Just gets ReportHIVByAgeAndGender.csv. Intended to be used command line: python -m emopyhiv.download <COMPS Experiment ID> <Optional Output Path> <Files To Get> Note that target files need to include "output/" if that's where they are. """fromidmtools.core.platform_factoryimportPlatformplatform=Platform("Calculon",node_group="idm_48cores",priority="Highest")fromidmtools_platform_comps.utils.download.downloadimportDownloadWorkItem,CompressTypeiffiles_to_getisNone:files_to_get=["output/ReportHIVByAgeAndGender.csv"]eliftype(files_to_get)isstr:files_to_get=files_to_get.split(',')print(f"Attempting to download {files_to_get} for experiment {experiment_id} into {local_output_path}.")dl_wi=DownloadWorkItem(related_experiments=[experiment_id],file_patterns=files_to_get,output_path=local_output_path,)dl_wi.run(wait_on_done=True,platform=platform)
if__name__=="__main__":importsysiflen(sys.argv)==1:print("Usage: python -m emopyhiv.download <COMPS Experiment ID> <Optional Output Path> <Optional List Of Files To Get>")sys.exit()download(sys.argv[1],(sys.argv[2]iflen(sys.argv)>2else""),(sys.argv[3]iflen(sys.argv)==4elseNone))