forked from LLNL/magpie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagpie-submission-convert
executable file
·78 lines (73 loc) · 2.89 KB
/
magpie-submission-convert
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#############################################################################
# Copyright (C) 2013 Lawrence Livermore National Security, LLC.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Albert Chu <chu11@llnl.gov>
# LLNL-CODE-644248
#
# This file is part of Magpie, scripts for running Hadoop on
# traditional HPC systems. For details, see <URL>.
#
# Magpie is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Magpie is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Magpie. If not, see <http://www.gnu.org/licenses/>.
#############################################################################
source ${MAGPIE_SCRIPTS_HOME}/magpie-helper-functions
Magpie_calc_slurm_magpie_timelimit () {
# Do not excessively call this
if [ "${MAGPIE_TIMELIMIT_MINUTES}X" == "X" ]
then
timelimitwalltime=`squeue -j ${SLURM_JOB_ID} -h -o %l`
Magpie_walltime_to_minutes ${timelimitwalltime}
export MAGPIE_TIMELIMIT_MINUTES=${walltimetominutes}
fi
}
if [ "${MAGPIE_SUBMISSION_TYPE}" == "slurmsbatch" ]
then
export MAGPIE_CLUSTER_NODERANK="${SLURM_NODEID:=0}"
export MAGPIE_NODE_COUNT="${SLURM_NNODES}"
export MAGPIE_NODELIST="${SLURM_JOB_NODELIST}"
export MAGPIE_JOB_NAME="${SLURM_JOB_NAME}"
export MAGPIE_JOB_ID="${SLURM_JOB_ID}"
# Legacy: Use if user set SBATCH_TIMELIMIT
if [ "${SBATCH_TIMELIMIT}X" != "X" ]
then
export MAGPIE_TIMELIMIT_MINUTES="${SBATCH_TIMELIMIT}"
else
Magpie_calc_slurm_magpie_timelimit
fi
fi
if [ "${MAGPIE_SUBMISSION_TYPE}" == "msubslurm" ]
then
export MAGPIE_CLUSTER_NODERANK="${SLURM_NODEID:=0}"
export MAGPIE_NODE_COUNT="${SLURM_NNODES}"
export MAGPIE_NODELIST="${SLURM_JOB_NODELIST}"
export MAGPIE_JOB_NAME="${MOAB_JOBNAME}"
export MAGPIE_JOB_ID="${SLURM_JOB_ID}"
# Legacy: Use if user set MAGPIE_TIMELIMIT_MINUTES
if [ "${MAGPIE_TIMELIMIT_MINUTES}X" == "X" ]
then
Magpie_calc_slurm_magpie_timelimit
fi
fi
if [ "${MAGPIE_SUBMISSION_TYPE}" == "msubtorque" ]
then
export MAGPIE_CLUSTER_NODERANK="$(($(echo ${MOAB_NODELIST} | sed 's/&/\n/g' | grep -n ${HOSTNAME} | cut -f1 -d:) - 1))"
export MAGPIE_NODE_COUNT="${PBS_NUM_NODES}"
export MAGPIE_NODELIST=$(echo ${MOAB_NODELIST} | sed 's/&/,/g')
export MAGPIE_JOB_NAME="${MOAB_JOBNAME}"
export MAGPIE_JOB_ID="${PBS_JOBID}"
if [ "${MAGPIE_TIMELIMIT_MINUTES}X" == "X" ]
then
export MAGPIE_TIMELIMIT_MINUTES=$(expr ${PBS_WALLTIME} / 60)
fi
fi