[slurm-users] Fwd: question about time statistics for sbatch

mohammed shambakey shambakey1 at gmail.com
Sun Jul 9 22:35:17 UTC 2023


Hi

I'm doing a simple benchmark to record the time for issuing a sbatch
command. The contents of the script are:
#!/bin/bash

IFS='= ' read _ local_clusterid <<< $(scontrol show config |grep -i
clustername) # Extract local cluster name
echo "Local cluster: "$local_clusterid

# Check input clusters to submit job(s)
if [ -z $1 ]; then
clusterid=$local_clusterid
else
clusterid=$1
fi

# Check input constraints
if [ -z $2 ]; then
cons=''
else
cons=$2
fi

# Check input number of tasks
if [ -z $3 ]; then
no_tasks=1
else
no_tasks=$3
fi

echo "start time before sbatch "$(date +%s.%N)
job_cluster_id=$(sbatch --parsable --wait -M$clusterid --constraint=$cons -n
$no_tasks test_srun_with_time.sh) # Since sbatch is a non-blocking
operation, --wait is used to block sbatch until response is received. Input
arguments are cluster(s) name(s), constraints, number of tasks
echo "end time after sbatch "$(date +%s.%N)
IFS=';' read jobid clusterid <<< $job_cluster_id # Extract job ID and
cluster ID (if not local cluster)
echo "JOB ID: "$jobid", clusterid: "$clusterid
sacct -j $jobid -M$clusterid --json > "test_"$jobid"_cluster_"$clusterid
".json" # Extract job statistics into a JSON file

The "elapsed" time in the resulting JSON file gives me 4 secs, while the
time difference between the start and end time in the previous script gives
about 10 secs. I wonder why there is much difference between the 2 records?
and which one I should use.

The output of the previous scripts is:
Local cluster: slurmcluster1
start time before sbatch 1688937564.063906087
end time after sbatch 1688937574.160335632
JOB ID: 200, clusterid: slurmcluster1

and the resulting JSON file is attached

Regards
-- 
Mohammed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20230710/57d4205c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_200_cluster_slurmcluster1.json
Type: application/json
Size: 22323 bytes
Desc: not available
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20230710/57d4205c/attachment-0001.json>


More information about the slurm-users mailing list