diff --git a/src/pages/dashboard.py b/src/pages/dashboard.py index ff317a2499c7c15642e3ac637ce0d621e9c0fb3b..f8607354b6bfbc37c955fb9933047116018cae40 100644 --- a/src/pages/dashboard.py +++ b/src/pages/dashboard.py @@ -1336,8 +1336,17 @@ def ml_downscaling_output_download(download_button, job_dict, plot_dict): job_description = {'Executable': f"/p/project/deepacf/intelliaq/schroeder5/downscaling_maelstrom/HPC_batch_scripts/inference_destine_test_{variable}.sh", 'Arguments': [ f"{jobnr.upper()}/CTM/", year, month, day ] } job = client.new_job(job_description) - else: - os.symlink(downscaling_filename, infile) + # wait for the job to finish: + while str(job.status) != 'JobStatus.SUCCESSFUL': + sleep(3) + # transfer the result file + base_directory = f"{UNICORE_USER}/{jobnr.upper()}/CTM/{year}{month}/{day}" + transport = uc_client.Transport(credentials) + scratch = uc_client.Storage(transport, f"{base_url}/storages/SCRATCH") + dfile = scratch.stat(f"{base_directory}/downscaling_{variable}_{year}{month}{day}00.nc") + dfile.download(downscaling_filename) + + os.symlink(downscaling_filename, infile) return dcc.send_file( infile