Interface ResourceAllocator


public interface ResourceAllocator
Trait used to help executor/worker allocate resources. Please note that this is intended to be used in a single thread.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    acquire(scala.collection.Seq<String> addrs)
    Acquire a sequence of resource addresses (to a launched task), these addresses must be available.
    scala.collection.Seq<String>
    Sequence of currently assigned resource addresses.
    scala.collection.Seq<String>
    Sequence of currently available resource addresses.
    void
    release(scala.collection.Seq<String> addrs)
    Release a sequence of resource addresses, these addresses must have been assigned.
    scala.collection.Seq<String>
     
     
    int
     
  • Method Details

    • acquire

      void acquire(scala.collection.Seq<String> addrs)
      Acquire a sequence of resource addresses (to a launched task), these addresses must be available. When the task finishes, it will return the acquired resource addresses. Throw an Exception if an address is not available or doesn't exist.
      Parameters:
      addrs - (undocumented)
    • assignedAddrs

      scala.collection.Seq<String> assignedAddrs()
      Sequence of currently assigned resource addresses.

      With slotsPerAddress() greater than 1, assignedAddrs() can contain duplicate addresses e.g. with slotsPerAddress() == 2, assignedAddrs for addresses 0 and 1 can look like Seq("0", "1", "1"), where address 0 was assigned once, and 1 was assigned twice.

      Returns:
      (undocumented)
    • availableAddrs

      scala.collection.Seq<String> availableAddrs()
      Sequence of currently available resource addresses.

      With slotsPerAddress() greater than 1, availableAddrs() can contain duplicate addresses e.g. with slotsPerAddress() == 2, availableAddrs for addresses 0 and 1 can look like Seq("0", "0", "1"), where address 0 has two assignments available, and 1 has one.

      Returns:
      (undocumented)
    • release

      void release(scala.collection.Seq<String> addrs)
      Release a sequence of resource addresses, these addresses must have been assigned. Resource addresses are released when a task has finished. Throw an Exception if an address is not assigned or doesn't exist.
      Parameters:
      addrs - (undocumented)
    • resourceAddresses

      scala.collection.Seq<String> resourceAddresses()
    • resourceName

      String resourceName()
    • slotsPerAddress

      int slotsPerAddress()