forked from alan-turing-institute/simulate-damBreak
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.py
More file actions
37 lines (26 loc) · 902 Bytes
/
entry.py
File metadata and controls
37 lines (26 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
from pathlib import Path
from distutils.dir_util import copy_tree
import subprocess
import requests
import json
from simulate.status import update_status
from simulate.config import CONFIG
from simulate.storage import upload, zip_dir
JOB_ID = CONFIG["JOB_ID"]
if CONFIG.get("PBS_JOB_ID"):
PBS_JOB_ID = CONFIG["PBS_JOB_ID"]
TMPDIR = f"/tmp/pbs.{PBS_JOB_ID}"
print("INFO: Copying required job files")
copy_tree(".", TMPDIR)
os.chdir(TMPDIR)
update_status("RUNNING")
subprocess.run("python simulate/patch.py", shell=True)
subprocess.run("bash ./Allrun", shell=True)
sas_token = update_status("FINALIZING")
subprocess.run("python simulate/metrics.py", shell=True)
subprocess.run("python simulate/outputs.py", shell=True)
upload("metrics.json", sas_token=sas_token)
zip_dir("damBreak.zip", ".")
upload("damBreak.zip", sas_token=sas_token)
update_status("COMPLETED")