Class JDFQueue

java.lang.Object
org.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.ChildNode
org.apache.xerces.dom.ParentNode
org.apache.xerces.dom.ElementImpl
org.apache.xerces.dom.ElementNSImpl
All Implemented Interfaces:
Serializable, Cloneable, IStreamWriter, Element, ElementTraversal, EventTarget, Node, NodeList, TypeInfo

public class JDFQueue extends JDFAutoQueue
The JDF Queue
See Also:
  • Constructor Details

    • JDFQueue

      public JDFQueue(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String qualifiedName)
      Constructor for JDFQueue
      Parameters:
      myOwnerDocument -
      qualifiedName -
    • JDFQueue

      public JDFQueue(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String myNamespaceURI, String qualifiedName)
      Constructor for JDFQueue
      Parameters:
      myOwnerDocument -
      myNamespaceURI -
      qualifiedName -
    • JDFQueue

      public JDFQueue(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String myNamespaceURI, String qualifiedName, String myLocalName)
      Constructor for JDFQueue
      Parameters:
      myOwnerDocument -
      myNamespaceURI -
      qualifiedName -
      myLocalName -
  • Method Details

    • openQueue

      public JDFAutoQueue.EnumQueueStatus openQueue()
      set the status as if an OpenQueue command has been sent
      Returns:
    • closeQueue

      public JDFAutoQueue.EnumQueueStatus closeQueue()
      set the status as if a CloseQueue command has been sent
      Returns:
    • holdQueue

      public JDFAutoQueue.EnumQueueStatus holdQueue()
      set the status as if a HoldQueue command has been sent
      Returns:
    • resumeQueue

      public JDFAutoQueue.EnumQueueStatus resumeQueue()
      set the status as if a HoldQueue command has been sent
      Returns:
    • toString

      public String toString()
      toString()
      Overrides:
      toString in class KElement
      Returns:
      String
      See Also:
    • getEntryCount

      public int getEntryCount()
      Method getEntryCount.
      Returns:
      int quantity of QueueEntry children
    • getQueueEntryVector

      public VElement getQueueEntryVector()
      Get a vector of all queueentry elements
      Returns:
      VElement: the vector of queue entries
    • getQueueEntryVector

      public VElement getQueueEntryVector(JDFAttributeMap attMap, VJDFAttributeMap parts)
      Get a vector of queueentry elements with a given set of attributes and part maps
      Parameters:
      attMap -
      parts -
      Returns:
      VElement: the vector of queue entries
    • getQueueEntryIDMap

      public Map<String,JDFQueueEntry> getQueueEntryIDMap()
      get a map of queueentries that uses QueueEntryID as key
      Returns:
      the map, null if this is empty
    • getQueueEntryVector

      public VElement getQueueEntryVector(NodeIdentifier nid)
      Get a vector of queueentry elements that matches a given nodeidentifier
      Parameters:
      nid -
      Returns:
      VElement: the vector of queue entries
    • getEntry

      @Deprecated public JDFQueueEntry getEntry(int i)
      Deprecated.
      use getQueueEntry(int)
      Method getEntry: find a queuentry by position
      Parameters:
      i - the index of the queueentry
      Returns:
      JDFQueueEntry
    • createQueueEntry

      public JDFQueueEntry createQueueEntry(boolean bHeld)
      create a queueEntry if this queue is accepting
      Parameters:
      bHeld - , if true, set the qe Status to Held
      Returns:
      the newly created queueEntry, null if failed
    • flushQueue

      public VElement flushQueue(JDFQueueFilter qf)
      flush this queue according to the rules defined in qf
      Parameters:
      qf -
      Returns:
      null if none were removed, else vector of removed queuentries
    • findQueueEntries

      @Deprecated public VString findQueueEntries(String strJobID, String strJobPartID, VJDFAttributeMap vamParts, JDFAutoQueueEntry.EnumQueueEntryStatus status)
      Deprecated.
      use getQueueEntryVector(map, partmapvector)
      Method findQueueEntries

      default: findQueueEntries(jobID, jobPartID, new VJDFAttributeMap(), null)

      Parameters:
      strJobID - Job ID.
      strJobPartID - Job part ID.
      vamParts - Partition to execute, may not be null
      status - Queue Entry Status, null means any status.
      Returns:
      VString: vector of QueueEntry IDs
    • getEntry

      @Deprecated public JDFQueueEntry getEntry(String strQEntryID)
      Deprecated.
      use getQueueEntry(id)
      Find a queueEntry by QueueEntryID
      note that you may want to use the generic getChildByTagName with the appropriate attribute map, if you have more information available
      Parameters:
      strQEntryID - the QueueEntryID of the requeste QueueEntry
      Returns:
      the QueueEntry with QueueEntryID=strQEntryID, null if strQEntryID is null or empty string or the queueentry does not exist
    • getQueueEntry

      public JDFQueueEntry getQueueEntry(String strQEntryID)
      Find a queueEntry by QueueEntryID
      note that you may want to use the generic getChildByTagName with the appropriate attribute map, if you have more information available
      Parameters:
      strQEntryID - the QueueEntryID of the requeste QueueEntry
      Returns:
      the QueueEntry with QueueEntryID=strQEntryID, null if strQEntryID is null or empty string or the queueentry does not exist
    • getQueueEntry

      public JDFQueueEntry getQueueEntry(NodeIdentifier nodeID, int nSkip)
      Find a queueEntry by NodeIdentifier (jobid, jobpartid, part)
      note that you may want to use the generic getChildByTagName with the appropriate attribute map, if you have more information available
      Parameters:
      nodeID - the identifier - jobID, jobPartID, parts - of the qe
      nSkip - the number of nodes to skip, cout backwards if<0
      Returns:
      the QueueEntry with matching jobID, jobPartID, parts, null if nodeID is null or empty string or the queueentry does not exist
    • getQueueEntryPos

      public int getQueueEntryPos(String strQEntryID)
      Find the position of a queueEntry by QueueEntryID
      Parameters:
      strQEntryID - the QueueEntryID of the requeste QueueEntry
      Returns:
      the position in the queue, -1 if not there
    • getNextExecutableQueueEntry

      public JDFQueueEntry getNextExecutableQueueEntry()
      Returns:
    • getNextExecutableQueueEntry

      public JDFQueueEntry getNextExecutableQueueEntry(JDFQueue.ExecuteCallback cb)
      Get the next QueueEntry to be processed the first entry with highest priority gets selected if deviceID is specified, the entries with an explicit non matching deviceID are ignored the status of the QueueEntry MUST be waiting proxy and represents previously submitted jobs as waiting
      Parameters:
      cb -
      Returns:
      the executable queueEntry, null if none is available
    • canExecute

      public boolean canExecute()
      if the outgoing device processor is accepting new entries
      Returns:
      true, if new entries are accepted
    • canAccept

      public boolean canAccept()
      if the incoming queue processor is accepting new entries
      Returns:
      true, if new entries are accepted
    • cleanup

      public void cleanup()
      remove all entries with Status=Removed and any entries over maxCompleted that are either aborted or completed @see JDFQueueEntry .isCompleted()
      Overrides:
      cleanup in class KElement
    • copyToResponse

      @Deprecated public JDFQueue copyToResponse(JDFResponse resp, JDFQueueFilter filter)
      Deprecated.
      use 3 parameter method
      copies this to the JDF Response resp, applying the filters defined in filter
      Parameters:
      resp - the JDFResponse to copy this to
      filter - the QueueFilter that sets the queue size
      Returns:
      the copied queue
    • copyToResponse

      public JDFQueue copyToResponse(JDFResponse resp, JDFQueueFilter filter, JDFQueue priorQueue)
      copies this to the JDF Response resp, applying the filters defined in filter
      Parameters:
      resp - the JDFResponse to copy this to
      filter - the QueueFilter that sets the queue size
      priorQueue - the prior que to apply thr filter to incase updategranularity is incremental
      Returns:
      the copied queue
    • numEntries

      public int numEntries(JDFAutoQueueEntry.EnumQueueEntryStatus qeStatus)
      return the number of entries
      Parameters:
      qeStatus - the queueentry status of the enries to count, if null, do not filter
      Returns:
      the number of active processors
    • hasFewerEntries

      public boolean hasFewerEntries(JDFAutoQueueEntry.EnumQueueEntryStatus qeStatus, int entries)
      return true if the queue has less than entries elements
      Parameters:
      qeStatus - the status of the JDFQueueEntry to count
      entries - the number of entries after which we stop counting
      Returns:
      true if the queue has < entries entries with a given QE Status
    • setAutomated

      public void setAutomated(boolean _automated)
      make this a smart queue when modifying queueentries
      Parameters:
      _automated - automate if true
    • setAutomated

      public void setAutomated(boolean _automated, boolean recalc)
      make this a smart queue when modifying queueentries
      Parameters:
      _automated - automate if true
    • isAutomated

      public boolean isAutomated()
      is this a smart queue when modifying queueentries
      Returns:
      true if this is automated
    • getQueueSize

      public int getQueueSize()
      get the queuesize attribute or if it does not exist, count queuentry elements
      Overrides:
      getQueueSize in class JDFAutoQueue
      Returns:
      the size of the queue
    • setStatusFromEntries

      public JDFAutoQueue.EnumQueueStatus setStatusFromEntries()
      set the status of this queue based on the status values of the queueentries
      Returns:
      the newly set Status, null if not modified
    • sortChildren

      public void sortChildren()
      sorts all child elements by alphabet
      Overrides:
      sortChildren in class KElement
    • getMaxCompletedEntries

      public int getMaxCompletedEntries()
      Returns:
      the maxCompletedEntries
    • setMaxCompletedEntries

      public void setMaxCompletedEntries(int _maxCompletedEntries)
      set the maximum number of completed entries to keep also call cleanup if we are automated
      Parameters:
      _maxCompletedEntries - the maxCompletedEntries to set
    • getMaxRunningEntries

      public int getMaxRunningEntries()
      Returns:
      the maxRunningEntries
    • setMaxRunningEntries

      public void setMaxRunningEntries(int _maxRunningEntries)
      Parameters:
      _maxRunningEntries - the maxRunningEntries to set
    • setMaxWaitingEntries

      public void setMaxWaitingEntries(int _maxWaitingEntries)
      Parameters:
      _maxWaitingEntries - the setMaxWaitingEntries to set, excluding held entries
    • setCleanupCallback

      public void setCleanupCallback(JDFQueue.CleanupCallback _cleanupCallback)
      Parameters:
      _cleanupCallback - the cleanupCallback to set
    • setExecuteCallback

      public void setExecuteCallback(JDFQueue.ExecuteCallback _callback)
      Parameters:
      _callback - the ExecuteCallback to set
    • setQueueSorter

      public void setQueueSorter(Comparator<KElement> _queueSorter)
      Parameters:
      _queueSorter - the queueSorter to set sets the Comparator to sort this queuewith
    • sortChild

      public void sortChild(JDFQueueEntry qe)
      Parameters:
      qe -