unm.maui.wiki
Class Wiki

java.lang.Object
  extended byunm.maui.rm.BasicRM
      extended byunm.maui.wiki.Wiki
All Implemented Interfaces:
java.util.EventListener, MauiListener, RM, java.lang.Runnable, SchedListener, java.io.Serializable

public class Wiki
extends BasicRM
implements java.lang.Runnable

Wiki.

Wiki stands for Wiki Resource Manager.

See Also:
Serialized Form

Field Summary
protected  int bufSize
          Read/write buffer sizes.
static java.lang.String classProperty
           
protected  CryptixWrapper crypto
          Cryptix security library wrapper.
protected  java.lang.String epilogExe
          Job epilog.
static java.lang.String epilogLocalProperty
           
protected  java.util.Hashtable hostHash
          Hashtable of InetAddress -> hostname.
protected  boolean multicast
          Do multicast to nodes?
protected  java.net.InetAddress multicastAddr
          Multicast group.
static java.lang.String multicastGroupProperty
           
static java.lang.String multicastProperty
           
protected  int multicastTTL
          Multicast time to live.
static java.lang.String multicastTTLProperty
           
protected  java.net.MulticastSocket multisock
          Multicast socket.
protected  int nodeTimeout
          Node timeout (in secs).
static java.lang.String nodeTimeoutProperty
           
protected  int pollInterval
          Sleep interval in milliseconds
static java.lang.String pollIntervalProperty
           
protected  java.lang.String prefix
          Properties prefix.
protected  java.lang.String prologExe
          Job prolog.
static java.lang.String prologLocalProperty
           
protected  int purgeDelay
          Seconds delay before purging a job from our tables.
static java.lang.String purgeDelayProperty
           
static java.lang.String rmIDProperty
           
protected  int sockTimeout
          Socket timeout (in secs).
static java.lang.String sockTimeoutProperty
           
protected  java.net.DatagramSocket srv
          Server socket.
protected  boolean stripFQDN
          Strip FQDN.
static java.lang.String stripFQDNProperty
           
protected  int tcpPort
          TCP Port.
static java.lang.String tcpPortProperty
           
protected  java.lang.Thread thread
          Wiki Listener thread.
static java.lang.String udpBufSizeProperty
           
protected  int udpBurst
          UDP busts.
static java.lang.String udpBurstProperty
           
protected  int udpPortAsyn
          UDP Port to send multicast.
protected  int udpPortComm
          UDP Port of Wiki Listener.
static java.lang.String udpPortProperty
           
protected  int udpReattempt
          Reattempt sleep value.
static java.lang.String udpReattemptProperty
           
protected  java.util.Hashtable unknownHash
          Unknown jobs.
protected  java.util.Hashtable wikiJobsHash
          Hashtable of Job ID -> Job.
protected  java.util.Hashtable wikiNodesHash
          Hashtable of NodeID -> WikiNode.
 
Fields inherited from class unm.maui.rm.BasicRM
counter, rmID, scheduler
 
Constructor Summary
Wiki()
          Construct.
 
Method Summary
 void assignProperties(java.lang.String prefix, java.util.Properties props)
          Set properties.
 void cancelJob(java.lang.String jobID)
          Cancel job.
 void checkJob(Job job)
          "Preflight" job to see if RM would accept it.
protected  void doCancel(Job job)
          Cancel the remote job.
 void event(SchedEvent evt)
          A Scheduler event.
protected  void execTask(java.lang.String exe, java.util.Vector safeEnv)
          Execute task.
static java.lang.String getHostPart(java.lang.String id)
           
 java.util.Hashtable getNodeIDHash()
          Get hashtable.
 Node[] getNodes()
          Gets the nodes.
This should return the nodes from the last call to poll().
protected  void init()
          Initialize.
 void loadAndGo(JobReservation jobRes)
          Submit and start job.
 void run()
          Runnable interface.
protected  void runPrologEpilog(Job job, java.lang.String local)
          Run prolog.
protected  void sendAndRecvTCP(WikiComm comm, java.lang.String host)
          Send message to a remote Wiki daemon and receive response (through TCP).
protected  void sendAndRecvUDP(WikiComm comm)
          Multicast a message to remote Wiki daemons and wait for UDP responses.
protected  void shutdown()
          Shutdown.
protected  void startJob(JobReservation jobRes)
          Send start signal to job.
protected  void updateJob(WikiJobUpdate update)
          Update job.
protected  void updateNode(WikiNodeUpdate update)
          Update node.
protected  void updateResponse(WikiResponse update)
          Update response.
 
Methods inherited from class unm.maui.rm.BasicRM
getRMID, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tcpPortProperty

public static final transient java.lang.String tcpPortProperty
See Also:
Constant Field Values

udpPortProperty

public static final transient java.lang.String udpPortProperty
See Also:
Constant Field Values

classProperty

public static final transient java.lang.String classProperty
See Also:
Constant Field Values

stripFQDNProperty

public static final transient java.lang.String stripFQDNProperty
See Also:
Constant Field Values

udpBufSizeProperty

public static final transient java.lang.String udpBufSizeProperty
See Also:
Constant Field Values

multicastProperty

public static final transient java.lang.String multicastProperty
See Also:
Constant Field Values

multicastGroupProperty

public static final transient java.lang.String multicastGroupProperty
See Also:
Constant Field Values

multicastTTLProperty

public static final transient java.lang.String multicastTTLProperty
See Also:
Constant Field Values

udpReattemptProperty

public static final transient java.lang.String udpReattemptProperty
See Also:
Constant Field Values

udpBurstProperty

public static final transient java.lang.String udpBurstProperty
See Also:
Constant Field Values

pollIntervalProperty

public static final transient java.lang.String pollIntervalProperty
See Also:
Constant Field Values

sockTimeoutProperty

public static final transient java.lang.String sockTimeoutProperty
See Also:
Constant Field Values

nodeTimeoutProperty

public static final transient java.lang.String nodeTimeoutProperty
See Also:
Constant Field Values

prologLocalProperty

public static final transient java.lang.String prologLocalProperty
See Also:
Constant Field Values

epilogLocalProperty

public static final transient java.lang.String epilogLocalProperty
See Also:
Constant Field Values

rmIDProperty

public static final transient java.lang.String rmIDProperty
See Also:
Constant Field Values

purgeDelayProperty

public static final transient java.lang.String purgeDelayProperty
See Also:
Constant Field Values

srv

protected transient java.net.DatagramSocket srv
Server socket.


multisock

protected transient java.net.MulticastSocket multisock
Multicast socket.


thread

protected transient java.lang.Thread thread
Wiki Listener thread.


tcpPort

protected int tcpPort
TCP Port.


udpPortComm

protected int udpPortComm
UDP Port of Wiki Listener.


udpPortAsyn

protected int udpPortAsyn
UDP Port to send multicast.


bufSize

protected int bufSize
Read/write buffer sizes.


wikiNodesHash

protected java.util.Hashtable wikiNodesHash
Hashtable of NodeID -> WikiNode.


wikiJobsHash

protected java.util.Hashtable wikiJobsHash
Hashtable of Job ID -> Job.


hostHash

protected java.util.Hashtable hostHash
Hashtable of InetAddress -> hostname.


unknownHash

protected java.util.Hashtable unknownHash
Unknown jobs.


pollInterval

protected int pollInterval
Sleep interval in milliseconds


nodeTimeout

protected int nodeTimeout
Node timeout (in secs).


sockTimeout

protected int sockTimeout
Socket timeout (in secs).


prologExe

protected java.lang.String prologExe
Job prolog.


epilogExe

protected java.lang.String epilogExe
Job epilog.


crypto

protected transient CryptixWrapper crypto
Cryptix security library wrapper.


stripFQDN

protected boolean stripFQDN
Strip FQDN.


multicast

protected boolean multicast
Do multicast to nodes?


multicastAddr

protected java.net.InetAddress multicastAddr
Multicast group.


multicastTTL

protected int multicastTTL
Multicast time to live.


udpReattempt

protected int udpReattempt
Reattempt sleep value.


udpBurst

protected int udpBurst
UDP busts.


prefix

protected java.lang.String prefix
Properties prefix.


purgeDelay

protected int purgeDelay
Seconds delay before purging a job from our tables.

This is needed for the delay between cancelling a job and having the remote node daemons acknowlege it.

Constructor Detail

Wiki

public Wiki()
Construct.

Method Detail

getHostPart

public static final java.lang.String getHostPart(java.lang.String id)

assignProperties

public void assignProperties(java.lang.String prefix,
                             java.util.Properties props)
Set properties.

Specified by:
assignProperties in interface RM
Parameters:
prefix - String properties prefix
props - Properties

event

public void event(SchedEvent evt)
Description copied from interface: SchedListener
A Scheduler event.

Specified by:
event in interface SchedListener
Parameters:
evt - SchedEvent
See Also:
SchedListener.event(unm.maui.sched.SchedEvent)

checkJob

public void checkJob(Job job)
              throws RMException
Description copied from interface: RM
"Preflight" job to see if RM would accept it.

Specified by:
checkJob in interface RM
Parameters:
job - Job
Throws:
RMException
See Also:
RM.checkJob(unm.maui.rm.Job)

loadAndGo

public void loadAndGo(JobReservation jobRes)
               throws RMException
Submit and start job.

Specified by:
loadAndGo in interface RM
Parameters:
jobRes - JobReservation
Throws:
RMException - if couldn't submit/start a job
See Also:
RM.loadAndGo(unm.maui.res.JobReservation)

cancelJob

public void cancelJob(java.lang.String jobID)
               throws RMException
Cancel job.

Specified by:
cancelJob in interface RM
Parameters:
jobID - String
Throws:
RMException - if couldn't cancel a job
See Also:
RM.cancelJob(java.lang.String)

getNodes

public Node[] getNodes()
Description copied from interface: RM
Gets the nodes.
This should return the nodes from the last call to poll().

Specified by:
getNodes in interface RM
Returns:
Node[]
See Also:
RM.getNodes()

getNodeIDHash

public java.util.Hashtable getNodeIDHash()
Get hashtable.

Specified by:
getNodeIDHash in interface RM
Returns:
Hashtable of NodeID -> Node
See Also:
RM.getNodeIDHash()

init

protected void init()
Initialize.


shutdown

protected void shutdown()
Shutdown.


run

public void run()
Runnable interface.

Service backend messages.

Specified by:
run in interface java.lang.Runnable

updateNode

protected void updateNode(WikiNodeUpdate update)
                   throws java.io.IOException,
                          RMException
Update node.

Parameters:
update - WikiNodeUpdate
Throws:
java.io.IOException
RMException

updateJob

protected void updateJob(WikiJobUpdate update)
Update job.

Parameters:
update - WikiJobUpdate

updateResponse

protected void updateResponse(WikiResponse update)
Update response.

Parameters:
update - WikiResponse

runPrologEpilog

protected void runPrologEpilog(Job job,
                               java.lang.String local)
                        throws RMException
Run prolog.

Parameters:
job - Job
Throws:
RMException

execTask

protected void execTask(java.lang.String exe,
                        java.util.Vector safeEnv)
                 throws RMException
Execute task.

Parameters:
exe - executable
safeEnv - environment Vector
Throws:
RMException

startJob

protected void startJob(JobReservation jobRes)
                 throws RMException
Send start signal to job.

Parameters:
jobRes - JobReservation
Throws:
RMException

doCancel

protected void doCancel(Job job)
                 throws RMException
Cancel the remote job.

Parameters:
job - Job
Throws:
RMException

sendAndRecvTCP

protected void sendAndRecvTCP(WikiComm comm,
                              java.lang.String host)
                       throws RMException,
                              java.net.SocketException,
                              java.io.IOException,
                              java.security.KeyException,
                              AuthSecException,
                              java.lang.ClassNotFoundException
Send message to a remote Wiki daemon and receive response (through TCP).

Parameters:
host - remote host
comm - WikiComm
Returns:
WikiResponse
Throws:
RMException
java.net.SocketException
java.io.IOException
java.security.KeyException
AuthSecException
java.lang.ClassNotFoundException

sendAndRecvUDP

protected void sendAndRecvUDP(WikiComm comm)
                       throws RMException,
                              java.io.IOException,
                              java.security.KeyException
Multicast a message to remote Wiki daemons and wait for UDP responses.

Parameters:
comm - WikiComm
Throws:
RMException
java.io.IOException
java.security.KeyException