| 1 | from sluurp.job import SControlShowJobCommand |
| 2 | |
| 3 | |
| 4 | def test_slurm_scontrol_show_job_output(): |
| 5 | """make sure slurm output can be correctly interpret""" |
| 6 | output = """ |
| 7 | JobId=4109679 JobName=my_script_for_slurm.sh |
| 8 | UserId=payno(81067) GroupId=soft(3401) MCS_label=N/A |
| 9 | Priority=400 Nice=0 Account=(null) QOS=normal |
| 10 | JobState=RUNNING Reason=None Dependency=(null) |
| 11 | Requeue=1 Restarts=0 BatchFlag=1 Reboot=0 ExitCode=0:0 |
| 12 | RunTime=00:00:03 TimeLimit=02:00:00 TimeMin=N/A |
| 13 | SubmitTime=2022-08-17T16:44:10 EligibleTime=2022-08-17T16:44:10 |
| 14 | AccrueTime=2022-08-17T16:44:10 |
| 15 | StartTime=2022-08-17T16:44:41 EndTime=2022-08-17T18:44:41 Deadline=N/A |
| 16 | SuspendTime=None SecsPreSuspend=0 LastSchedEval=2022-08-17T16:44:41 Scheduler=Backfill |
| 17 | Partition=nice AllocNode:Sid=p9-04:4192388 |
| 18 | ReqNodeList=(null) ExcNodeList=(null) |
| 19 | NodeList=hib3-3004 |
| 20 | BatchHost=hib3-3004 |
| 21 | NumNodes=1 NumCPUs=1 NumTasks=1 CPUs/Task=1 ReqB:S:C:T=0:0:*:* |
| 22 | TRES=cpu=1,mem=4000M,node=1,billing=1 |
| 23 | Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* |
| 24 | MinCPUsNode=1 MinMemoryCPU=4000M MinTmpDiskNode=0 |
| 25 | Features=(null) DelayBoot=00:00:00 |
| 26 | OverSubscribe=OK Contiguous=0 Licenses=(null) Network=(null) |
| 27 | Command=/tmp/pytest-of-payno/pytest-16/test_sbatchjob_script_submissi0/test_image_key_upgrader/my_script_for_slurm.sh |
| 28 | WorkDir=/home/esrf/payno/tomwer |
| 29 | StdErr=/home/esrf/payno/tomwer/slurm-4109679.out |
| 30 | StdIn=/dev/null |
| 31 | StdOut=/home/esrf/payno/tomwer/slurm-4109679.out |
| 32 | Power= |
| 33 | """ |
| 34 | res = SControlShowJobCommand.stdout_to_dict(output) |
| 35 | assert isinstance(res, dict) |
| 36 | assert res["StartTime"] == "2022-08-17T16:44:41" |
| 37 | assert res["JobId"] == "4109679" |
| 38 | assert res["StdOut"] == "/home/esrf/payno/tomwer/slurm-4109679.out" |
| 39 | assert res["Power"] == "" |