From 995f387f2f1c7a6aa5cf83f38adcf9262c84dbc5 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Thu, 28 Jan 2016 10:07:16 -0600 Subject: [PATCH 01/10] ADDED $USER TO ENV. FILE NAME; 1 GRACE INTERACTIVE JOB LIMIT --- idev | 45 ++++++++++++++++++++++++++++++++++++--------- idev_utils | 3 ++- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/idev b/idev index e0cb25f..5b53189 100755 --- a/idev +++ b/idev @@ -1,7 +1,7 @@ #!/bin/bash -#set -x -# User is forces to use either SGE or SLURM options, except -# -p and -q can both be used for either batch system +# set -x +# User is forced to use either SGE or SLURM options, except +# -p and -q can both be used for either batch system. # # For Stampede the system startup file /etc/profile.d/z95_idev. # takes care of sourcing /tmp/idev__env. if the file @@ -55,10 +55,8 @@ #Hidden grace-serial queue # Added -p option to squeue (to see queue) # Allow -n 1 for default for grace-serial queue -# Changed format from 9 to 15 chars for queue name (grace-serial is 12 chars) -# Abort if -N is used in grace-serial queue. -# 01/21/2016 KentM -# +# Changed format from 9 to 15 for queue name (grace-serial is 12 chars) +# 01/29/2016 KentM #------------------------------------------------------------------------------ # # Versions Number @@ -749,6 +747,35 @@ if [[ $total_tasks_set == no && $nodes_set == yes ]] ; then fi +# if grace-serial queue +if [[ $MY_QUEUE =~ grace-serial ]]; then + + squeue -p $MY_QUEUE "$squeue_opts" -u $USER | \ + awk '$3 ~ /idv[0-9][0-9][0-9][0-9][0-9]/' | \ + awk '{print $5}' | grep R >/dev/null + if [ $? = 0 ]; then + using_node=`squeue -p $MY_QUEUE "$squeue_opts" -u $USER | \ + awk '$3 ~ /idv[0-9][0-9][0-9][0-9][0-9]/' | \ + awk '{print $8}' ` + echo "" + echo " ERROR: Only one ONE idev interactive session allowed in $MY_QUEUE queue." + echo "" + echo " You are executing idev again in the $MY_QUEUE queue." + echo " In this queue only 1 idev interactive job is allowed." + echo " You may have multiple windows open to the job (node) for an active" + echo " IDEV session by opening a new window on a login node, and SSHing" + echo " to the node of the job with the command:" + echo "" + echo " ssh -Y $using_node " + echo "" + echo " In a new window you can customize your environment if" + echo " you want to work interactively on different projects." + echo "" + do_exit=yes; OPT_ERR=2 + fi +fi + + ############################################end Dependent options @@ -1395,6 +1422,7 @@ $MY_RESERVATION $idev_pwd_cmd $idev_rm_perl5 +# Remove old files (needed for grace-serial queue). rm -rf /tmp/idev_${USER}_${idev_login_shell}_env.[0-9]* $DIR/idev_utils env_replication ${idev_login_shell} \$SLURM_JOB_ID $CREATE_NODE_LIST_CMD @@ -1495,7 +1523,7 @@ fi ##### while [ $found_env_file == 1 ]; do - ssh -o "StrictHostKeyChecking no" $node "ls /tmp/idev_${idev_login_shell}_env.${JOBID}" >& /dev/null + ssh -o "StrictHostKeyChecking no" $node "ls /tmp/idev_${USER}_${idev_login_shell}_env.${JOBID}" >& /dev/null if [[ $? == 0 ]]; then found_env_file=0 if [[ $time_waited_env_file > 0 ]]; then @@ -1537,4 +1565,3 @@ fi #trapping #http://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash #http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files - diff --git a/idev_utils b/idev_utils index f723dd3..d557e66 100755 --- a/idev_utils +++ b/idev_utils @@ -157,7 +157,8 @@ sub env_replication(@){ ## Changed for 9.2 my_... --> idev_... ## $myenv_filename = "/tmp/idev_${my_shell}_env.${my_idev}"; - $myenv_filename = "/tmp/idev_${USER}_${my_shell}_env.${my_idev}"; +## $myenv_filename = "/tmp/idev_${USER}_${my_shell}_env.${my_idev}"; + $myenv_filename = "/tmp/idev_$ENV{USER}_${my_shell}_env.${my_idev}"; if ( $my_shell eq "bash" ){ $CMD = "export "; $UNCMD = "unset "; From 51a4cbb6fc7bbcffa7706c37fb898b62ea7ed512 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Thu, 28 Jan 2016 10:37:09 -0600 Subject: [PATCH 02/10] COMMENT TEXT CHANGE: NOT KNOW TO NOT KNOWN. --- idev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idev b/idev index 5b53189..5b633f1 100755 --- a/idev +++ b/idev @@ -694,7 +694,7 @@ fi fi if [[ $known_option == "no" ]]; then - echo -e "\n ERROR: **The $1 option is not know." + echo -e "\n ERROR: **The $1 option is not known." echo -e " To see options, execute: idev -help." do_exit=yes; OPT_ERR=2 From 8927cfbef1678f2a93a2b51c6914cdbe33115cfd Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Thu, 28 Jan 2016 11:23:07 -0600 Subject: [PATCH 03/10] UPDATE HISTORY WITH GRACE QUEUE INFO --- idev | 1 + 1 file changed, 1 insertion(+) diff --git a/idev b/idev index 5b53189..6d6b435 100755 --- a/idev +++ b/idev @@ -56,6 +56,7 @@ # Added -p option to squeue (to see queue) # Allow -n 1 for default for grace-serial queue # Changed format from 9 to 15 for queue name (grace-serial is 12 chars) +# grace-serial queue users are allowed only 1 interactive job # 01/29/2016 KentM #------------------------------------------------------------------------------ # From f6f2eb701198e3e95dab955f804355eb7c90dde4 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Thu, 28 Jan 2016 12:30:27 -0600 Subject: [PATCH 04/10] ADD HISTORY INFO FOR INTERACTIVE GRACE QUEUE LIMIT. --- idev | 1 + 1 file changed, 1 insertion(+) diff --git a/idev b/idev index 5b633f1..7c357c8 100755 --- a/idev +++ b/idev @@ -56,6 +56,7 @@ # Added -p option to squeue (to see queue) # Allow -n 1 for default for grace-serial queue # Changed format from 9 to 15 for queue name (grace-serial is 12 chars) +# Interactive job limit for grace queue = 1. # 01/29/2016 KentM #------------------------------------------------------------------------------ # From c95246634b410cc8f899783982441783e4dfd8a5 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Sun, 7 Feb 2016 08:59:00 -0600 Subject: [PATCH 05/10] ADDED REFERENCE AT GIT --- idev | 1 + 1 file changed, 1 insertion(+) diff --git a/idev b/idev index 1620bdc..8a011f8 100755 --- a/idev +++ b/idev @@ -1566,3 +1566,4 @@ fi #trapping #http://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash #http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files +#http://github.com/milfeld/idivx From f226888df27b61a71173647a68105534e16da979 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Sun, 7 Feb 2016 10:25:02 -0600 Subject: [PATCH 06/10] ADDED GIT MILFELD2 REF --- idev | 1 + 1 file changed, 1 insertion(+) diff --git a/idev b/idev index 8a011f8..5257744 100755 --- a/idev +++ b/idev @@ -1563,6 +1563,7 @@ fi fi fi +#http://github.com/milfeld2/idivx #trapping #http://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash #http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files From 09ffe5c2a2654a8a5e9e89aa0fee0b5c37d1ade1 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Sun, 7 Feb 2016 10:41:22 -0600 Subject: [PATCH 07/10] ADDED TODO --- idev | 3 +++ 1 file changed, 3 insertions(+) diff --git a/idev b/idev index 8a011f8..e3a03e7 100755 --- a/idev +++ b/idev @@ -58,6 +58,8 @@ # Changed format from 9 to 15 for queue name (grace-serial is 12 chars) # grace-serial queue users are allowed only 1 interactive job # 01/29/2016 KentM +# TODO +# Update version number. #------------------------------------------------------------------------------ # # Versions Number @@ -1563,6 +1565,7 @@ fi fi fi +#http://github.com/milfeld2/idivx #trapping #http://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash #http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files From 81d0c5a3efde0d5ec2820d3e80cc2f075559d8c2 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Sun, 7 Feb 2016 10:59:47 -0600 Subject: [PATCH 08/10] NOTE ABOUT HOSTNAME --- idev | 1 + 1 file changed, 1 insertion(+) diff --git a/idev b/idev index 1620bdc..e4fb4d6 100755 --- a/idev +++ b/idev @@ -64,6 +64,7 @@ IDEV_VER=1.00 IDEV_SETUP_VER=1.00 +#NOTE: use hostname -f #Determine the system myhostname=`hostname -f` if [[ $myhostname =~ nid ]] ; then From 1acdc7bcaa9b00fd70845365a310d60b1b65c947 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Sun, 7 Feb 2016 11:10:22 -0600 Subject: [PATCH 09/10] 800 fix --- idev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idev b/idev index e3a03e7..307a7ca 100755 --- a/idev +++ b/idev @@ -74,7 +74,7 @@ MY_SYS=`echo $myhostname | awk 'BEGIN { FS = "." } ; { print $2 }'` fi - +#800 comment her 800_Wfix srun=off # Don't use srun on Stampede # trap ctrl-c and call ctrl_c() trap ctrl_c INT EXIT From 5629bdb9e6f67ae29920a522ddb57b35104da127 Mon Sep 17 00:00:00 2001 From: Kent Milfeld Date: Sun, 7 Feb 2016 11:17:27 -0600 Subject: [PATCH 10/10] 900 FIX --- idev | 1 + 1 file changed, 1 insertion(+) diff --git a/idev b/idev index 307a7ca..e187632 100755 --- a/idev +++ b/idev @@ -81,6 +81,7 @@ trap ctrl_c INT EXIT did_exit=no exit_msg="" +#800 comment for 900_Wfix # Trap Function. Deletes job on exit of this script function ctrl_c() { #Job submitted, and job id available.