|
1 | 1 | #!/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. |
5 | 5 | # |
6 | 6 | # For Stampede the system startup file /etc/profile.d/z95_idev.<csh|sh> |
7 | 7 | # takes care of sourcing /tmp/idev_<csh|sh>_env.<jobid> if the file |
|
55 | 55 | #Hidden grace-serial queue |
56 | 56 | # Added -p <queue_name> option to squeue (to see queue) |
57 | 57 | # 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 |
62 | 60 | #------------------------------------------------------------------------------ |
63 | 61 | # |
64 | 62 | # Versions Number |
@@ -749,6 +747,35 @@ if [[ $total_tasks_set == no && $nodes_set == yes ]] ; then |
749 | 747 |
|
750 | 748 | fi |
751 | 749 |
|
| 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 | + |
752 | 779 | ############################################end Dependent options |
753 | 780 |
|
754 | 781 |
|
@@ -1395,6 +1422,7 @@ $MY_RESERVATION |
1395 | 1422 |
|
1396 | 1423 | $idev_pwd_cmd |
1397 | 1424 | $idev_rm_perl5 |
| 1425 | +# Remove old files (needed for grace-serial queue). |
1398 | 1426 | rm -rf /tmp/idev_${USER}_${idev_login_shell}_env.[0-9]* |
1399 | 1427 | $DIR/idev_utils env_replication ${idev_login_shell} \$SLURM_JOB_ID |
1400 | 1428 | $CREATE_NODE_LIST_CMD |
|
1495 | 1523 | ##### |
1496 | 1524 | while [ $found_env_file == 1 ]; do |
1497 | 1525 |
|
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 |
1499 | 1527 | if [[ $? == 0 ]]; then |
1500 | 1528 | found_env_file=0 |
1501 | 1529 | if [[ $time_waited_env_file > 0 ]]; then |
|
1537 | 1565 | #trapping |
1538 | 1566 | #http://rimuhosting.com/knowledgebase/linux/misc/trapping-ctrl-c-in-bash |
1539 | 1567 | #http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files |
1540 | | - |
|
0 commit comments