Skip to content

Commit 995f387

Browse files
committed
ADDED $USER TO ENV. FILE NAME; 1 GRACE INTERACTIVE JOB LIMIT
1 parent 2efe635 commit 995f387

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

idev

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
2-
#set -x
3-
# User is forces to use either SGE or SLURM options, except
4-
# -p and -q can both be used for either batch system
2+
# set -x
3+
# User is forced to use either SGE or SLURM options, except
4+
# -p and -q can both be used for either batch system.
55
#
66
# For Stampede the system startup file /etc/profile.d/z95_idev.<csh|sh>
77
# takes care of sourcing /tmp/idev_<csh|sh>_env.<jobid> if the file
@@ -55,10 +55,8 @@
5555
#Hidden grace-serial queue
5656
# Added -p <queue_name> option to squeue (to see queue)
5757
# Allow -n 1 for default for grace-serial queue
58-
# Changed format from 9 to 15 chars for queue name (grace-serial is 12 chars)
59-
# Abort if -N is used in grace-serial queue.
60-
# 01/21/2016 KentM
61-
#
58+
# Changed format from 9 to 15 for queue name (grace-serial is 12 chars)
59+
# 01/29/2016 KentM
6260
#------------------------------------------------------------------------------
6361
#
6462
# Versions Number
@@ -749,6 +747,35 @@ if [[ $total_tasks_set == no && $nodes_set == yes ]] ; then
749747

750748
fi
751749

750+
# if grace-serial queue
751+
if [[ $MY_QUEUE =~ grace-serial ]]; then
752+
753+
squeue -p $MY_QUEUE "$squeue_opts" -u $USER | \
754+
awk '$3 ~ /idv[0-9][0-9][0-9][0-9][0-9]/' | \
755+
awk '{print $5}' | grep R >/dev/null
756+
if [ $? = 0 ]; then
757+
using_node=`squeue -p $MY_QUEUE "$squeue_opts" -u $USER | \
758+
awk '$3 ~ /idv[0-9][0-9][0-9][0-9][0-9]/' | \
759+
awk '{print $8}' `
760+
echo ""
761+
echo " ERROR: Only one ONE idev interactive session allowed in $MY_QUEUE queue."
762+
echo ""
763+
echo " You are executing idev again in the $MY_QUEUE queue."
764+
echo " In this queue only 1 idev interactive job is allowed."
765+
echo " You may have multiple windows open to the job (node) for an active"
766+
echo " IDEV session by opening a new window on a login node, and SSHing"
767+
echo " to the node of the job with the command:"
768+
echo ""
769+
echo " ssh -Y $using_node "
770+
echo ""
771+
echo " In a new window you can customize your environment if"
772+
echo " you want to work interactively on different projects."
773+
echo ""
774+
do_exit=yes; OPT_ERR=2
775+
fi
776+
fi
777+
778+
752779
############################################end Dependent options
753780

754781

@@ -1395,6 +1422,7 @@ $MY_RESERVATION
13951422
13961423
$idev_pwd_cmd
13971424
$idev_rm_perl5
1425+
# Remove old files (needed for grace-serial queue).
13981426
rm -rf /tmp/idev_${USER}_${idev_login_shell}_env.[0-9]*
13991427
$DIR/idev_utils env_replication ${idev_login_shell} \$SLURM_JOB_ID
14001428
$CREATE_NODE_LIST_CMD
@@ -1495,7 +1523,7 @@ fi
14951523
#####
14961524
while [ $found_env_file == 1 ]; do
14971525

1498-
ssh -o "StrictHostKeyChecking no" $node "ls /tmp/idev_${idev_login_shell}_env.${JOBID}" >& /dev/null
1526+
ssh -o "StrictHostKeyChecking no" $node "ls /tmp/idev_${USER}_${idev_login_shell}_env.${JOBID}" >& /dev/null
14991527
if [[ $? == 0 ]]; then
15001528
found_env_file=0
15011529
if [[ $time_waited_env_file > 0 ]]; then
@@ -1537,4 +1565,3 @@ fi
15371565
#trapping
15381566
#http://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash
15391567
#http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files
1540-

idev_utils

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ sub env_replication(@){
157157

158158
## Changed for 9.2 my_<shell>... --> idev_<shell>...
159159
## $myenv_filename = "/tmp/idev_${my_shell}_env.${my_idev}";
160-
$myenv_filename = "/tmp/idev_${USER}_${my_shell}_env.${my_idev}";
160+
## $myenv_filename = "/tmp/idev_${USER}_${my_shell}_env.${my_idev}";
161+
$myenv_filename = "/tmp/idev_$ENV{USER}_${my_shell}_env.${my_idev}";
161162
if ( $my_shell eq "bash" ){
162163
$CMD = "export ";
163164
$UNCMD = "unset ";

0 commit comments

Comments
 (0)