45 lines
1.0 KiB
Python
Executable File
45 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import time
|
|
from pathlib import Path
|
|
|
|
from logzero import logger
|
|
|
|
from apocalypse.arghandler import get_apo_input
|
|
from apocalypse.create_bash_script import create_script
|
|
from apocalypse.logcfg import set_loglvl
|
|
from apocalypse.wait_for_file import wait_for_message
|
|
|
|
|
|
def main():
|
|
set_loglvl()
|
|
|
|
args = get_apo_input()
|
|
|
|
# replace by funcs so testable?
|
|
timestamp = time.strftime(args.slurm_job_date)
|
|
slurm_job = f"ap_job{timestamp}.sh"
|
|
slurm_job = Path(slurm_job).absolute()
|
|
|
|
send_done_pth = Path(__file__).parent.joinpath("apocalypse", "send_done.py")
|
|
|
|
args.slurm_job = slurm_job
|
|
args.send_done_pth = send_done_pth
|
|
create_script(args)
|
|
file_written(args.slurm_job)
|
|
wait_for_message(args)
|
|
|
|
|
|
def file_written(pth):
|
|
"""
|
|
pth(pathlib.Path): path to slurm script
|
|
"""
|
|
if not Path(pth).is_file():
|
|
msg = "slurm script file failed to create, exiting"
|
|
logger.error(msg)
|
|
raise SystemExit(msg)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|