[GE users] Named floating resources

dangruhn Dan.Gruhn at groupw.com
Wed Mar 18 15:06:41 GMT 2009


Isaac,

Perhaps someone else has a better idea, but IMHO you will need to use 
Grid Engine to schedule jobs based on the router resources you have 
available AND write a script or program that each job will need to run 
to actually allocate the particular routers.  Something like the 
following should work. Note that the router list file needs to be in 
some globally accessible location so that each node will be able to 
update it.  Also, this is a bash script:

#!/bin/bash

# File that is our router "database"
routerFile=/<NFS available directory tree>/router.list

# Cleanup our lock file, if any
cleanup()
{
    rm -f $routerFile.lock
}

# Decode the comamnd line parameters
desiredNumRouters=0
desiredReleaseRouters=""

while [ $# -gt 0 ]
do
    case $1 in
    --release)
        desiredReleaseRouters="$desiredReleaseRouters $2"
        shift 2
        ;;

    --allocate)
        desiredNumRouters=$2
        shift 2
        ;;

    *)
        echo "Unknown parameter $1" 1>&2
        exit 1
        ;;
    esac
       
done

# Attempt to lock the router list file
lockSleepTime=2
lockDelay=0
lockMaxDelay=60

until ln $routerFile $routerFile.lock >/dev/null 2>&1
do
    sleep $lockSleepTime
    lockDelay=`expr $lockDelay + $lockSleepTime`

    # If we've waited 1 minutes
    if [ $lockDelay -gt $lockMaxDelay ]
    then
        echo "Abandoning attemps to get lock file $routerFile and 
continuing with operation" 1>&2
        break;
    fi

done

trap cleanup INT HUP QUIT TERM

myRouters=""
numRouters=0
newRouterList=""
for router in `cat $routerFile`
do
    case $router in
    *.inUse)
        # For each router we should release
        for releaseRouter in $desiredReleaseRouters
        do
            # If we should release this router
            if [ $releaseRouter.inUse = $router ]
            then
                # Remove ".inUse" from router listing
                router=$releaseRouter
                break
            fi
        done

        newRouterList="$newRouterList $router"
        ;;
    *)
        # If we have gotten all the routers we need
        if [ $numRouters -ge $desiredNumRouters ]
        then
            newRouterList="$newRouterList $router"
        else
            myRouters="$myRouters $router"
            numRouters=`expr $numRouters + 1`
            newRouterList="$newRouterList $router.inUse"
        fi
        ;;
    esac
done

# If we don't have our routers
if [ $numRouters -lt $desiredNumRouters ]
then
    rm $routerFile.lock
    echo "Error: only able to allocate $numRouters routers" 1>&2
    exit 1
fi

# Update the router list file
for router in $newRouterList
do
    echo $router
done >$routerFile

# Remove the lock file
cleanup

# If we needed to get some routers
if [ $desiredNumRouters -gt 0 ]
then
    # Output our routers
    echo $myRouters
fi



iwagner wrote:
> How do I add these resources to SGE?  I can't run the SGE daemons on 
> them because they are routers.  So, they can't be compute nodes.  Once 
> added to SGE how do I request them?
>
>
> On Wed, Mar 18, 2009 at 6:05 AM, olesen 
> <Mark.Olesen at emcontechnologies.com 
> <mailto:Mark.Olesen at emcontechnologies.com>> wrote:
>
>     > router_a
>     > router_b
>     > ...
>     > router_z
>
>     > I want to make the generic request to give me say 2 of those
>     routers.
>     > I need to know which two were allocated to me by name.  Make sense?
>
>     > Does anyone know if SGE can be configured in such a way?
>
>     It looks to me like you actually have a parallel job (ie, multiple
>     slots/machines at once) even if you aren't actually using mpirun or
>     equivalent to run things.
>
>     If you setup and use a parallel environment, you can always get at the
>     exact machine names from the $PE_HOSTFILE contents - see qsub(1). You
>     might find the script under $SGE_ROOT/mpi/startmpi.sh provides a good
>     hint for extracting the names.
>
>     /mark
>
>     This e-mail message and any attachments may contain
>     legally privileged, confidential or proprietary Information,
>     or information otherwise protected by law of EMCON
>     Technologies, its affiliates, or third parties. This notice
>     serves as marking of its "Confidential" status as defined
>     in any confidentiality agreements concerning the sender
>     and recipient. If you are not the intended recipient(s),
>     or the employee or agent responsible for delivery of this
>     message to the intended recipient(s), you are hereby
>     notified that any dissemination, distribution or copying
>     of this e-mail message is strictly prohibited.
>     If you have received this message in error, please
>     immediately notify the sender and delete this e-mail
>     message from your computer.
>
>     ------------------------------------------------------
>     http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=135195
>     <http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=135195>
>
>     To unsubscribe from this discussion, e-mail:
>     [users-unsubscribe at gridengine.sunsource.net
>     <mailto:users-unsubscribe at gridengine.sunsource.net>].
>
>

-- 
Dan Gruhn
Group W Inc.
8315 Lee Hwy, Suite 303
Fairfax, VA, 22031
PH: (703) 752-5831
FX: (703) 752-5851

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=135415

To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].



More information about the gridengine-users mailing list