org.apache.uima.ducc.common.main

Class DuccRmAdmin

  • java.lang.Object
    • org.apache.uima.ducc.common.component.AbstractDuccComponent
      • org.apache.uima.ducc.common.main.DuccRmAdmin
  • All Implemented Interfaces:
    Thread.UncaughtExceptionHandler, org.apache.uima.ducc.common.component.AbstractDuccComponentMBean, org.apache.uima.ducc.common.component.DuccComponent, org.apache.uima.ducc.common.component.DuccLifecycle


    public class DuccRmAdmin
    extends org.apache.uima.ducc.common.component.AbstractDuccComponent
    This class provides the API and CLI to the Resource Manager administrative functions. The functions provided by this class are exposed both to Java programs, and scripting. When invoked through the main class, the specified functions emit a string which is easily parsable by scripting. Specifically, the qoccupancy and qload interfaces return a string that can be converted to List and Dictionary objects in Python via Python's eval function. When invoked via Java the response is returned in Java objects, as described below. The use of this class's Java API is intended for DUCC System programming, and requires the Camel, Spring, ActiveMQ, and Log4j classes in the classpath, as well as the DUCC Transport and Common jars. Requests that are destined for the RM are routed through the OR for recording in the system-events.log using ducc.rm.via.or.admin.endpoint specified in default.ducc.properties.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.uima.ducc.common.component.AbstractDuccComponent

        org.apache.uima.ducc.common.component.AbstractDuccComponent.AdminEventProcessor, org.apache.uima.ducc.common.component.AbstractDuccComponent.ErrorProcessor, org.apache.uima.ducc.common.component.AbstractDuccComponent.RMIServerSocketFactoryImpl
    • Constructor Summary

      Constructors 
      Constructor and Description
      DuccRmAdmin(org.apache.camel.CamelContext context, String epname)
      Creates a new instance of the RM administrative interface.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      RmAdminReply dispatchAndWaitForReply(DuccAdminEvent duccEvent)
      Marshall and transmit the request to RM, waiting for the response.
      org.apache.uima.ducc.common.utils.DuccLogger getLogger()
      This provides direct access to the logger for the class.
      static void main(String[] args) 
      RmAdminQLoadReply qload()
      This queries the current workload demand and resource supply in RM.
      RmAdminQOccupancyReply qoccupancy()
      This queries details on each host the RM is scheduling to.
      RmAdminReply reconfigure()
      Send a reconfigure event to RM.
      int run(String[] args)
      This is called from main in response to a CLI request.
      org.apache.uima.ducc.common.admin.event.RmAdminVaryReply varyoff(String[] args)
      This causes the RM to "vary off" a set of hosts.
      org.apache.uima.ducc.common.admin.event.RmAdminVaryReply varyon(String[] args)
      This causes the RM to "vary on" a set of hosts.
      • Methods inherited from class org.apache.uima.ducc.common.component.AbstractDuccComponent

        adjustTransportEndpoint, cleanup, getContext, getLogLevel, getProcessJmxUrl, handleAdminEvent, handleUncaughtException, handleUncaughtException, isStopping, loadProperties, onDuccAdminKillEvent, quiesceAndStop, reloadProperties, setContext, setLogLevel, setLogLevel, start, start, startJmxAgent, stop, uncaughtException, validateAdministrator
    • Field Detail

      • FileSeparator

        public static final String FileSeparator
      • cypheredMessage

        byte[] cypheredMessage
    • Constructor Detail

      • DuccRmAdmin

        public DuccRmAdmin(org.apache.camel.CamelContext context,
                           String epname)
        Creates a new instance of the RM administrative interface.
        Parameters:
        context - This is the Camel context to use. Usually it is sufficient to simply provide new DefaultCamelContext().
        epname - This is the RM JMS endpoint as configured in ducc.properties. Usually it is sufficient to provide ducc.rm.via.or.admin.endpoint.
    • Method Detail

      • getLogger

        public org.apache.uima.ducc.common.utils.DuccLogger getLogger()
        This provides direct access to the logger for the class.
      • dispatchAndWaitForReply

        public RmAdminReply dispatchAndWaitForReply(DuccAdminEvent duccEvent)
                                             throws Exception
        Marshall and transmit the request to RM, waiting for the response.
        Parameters:
        duccEvent - A DuccAdminEvent appropriate to the desired function.
        Returns:
        An RmAdminReply appropriate to the response. See the specific replies for details.
        Throws:
        Exception - if anything goes wrong in transmission or receipt of the request.
      • varyoff

        public org.apache.uima.ducc.common.admin.event.RmAdminVaryReply varyoff(String[] args)
                                                                         throws Exception
        This causes the RM to "vary off" a set of hosts. The hosts may continue to broadcast state, and RM tracks their online/offline status, but it stops scheduling to them. If there is evictable work on the hosts, RM will send eviction orders to the Orchestrator in order to clear them.
        Parameters:
        args - This is an array of hostnames indicating the hosts to be varied offline.
        Returns:
        A RmAdminVaryReply with success or failure status and if failure, the list of hosts that could not be varied off.
        Throws:
        Exception - if anything goes wrong in transmission or receipt of the request.
      • varyon

        public org.apache.uima.ducc.common.admin.event.RmAdminVaryReply varyon(String[] args)
                                                                        throws Exception
        This causes the RM to "vary on" a set of hosts. If the hosts are broadcasting state, they are immediately available for scheduling. This command does not start the DUCC agents, it only instructs RM that, if the hosts was previously offline, it should now be used for scheduling if and when the host is responding and sending heartbeats.
        Parameters:
        args - This is an array of hostnames indicating the hosts to be varied online.
        Returns:
        A RmAdminVaryReply with success or failure status and if failure, the list of hosts that could not be varied on.
        Throws:
        Exception - if anything goes wrong in transmission or receipt of the request.
      • qload

        public RmAdminQLoadReply qload()
                                throws Exception
        This queries the current workload demand and resource supply in RM.
        Returns:
        A RmAdminQLoadReply containing data regarding the current class and nodepool state.
        Throws:
        Exception - if anything goes wrong in transmission or receipt of the request.
      • reconfigure

        public RmAdminReply reconfigure()
                                 throws Exception
        Send a reconfigure event to RM. RM rereads all its configuration data an possibly reconfigures the schedule if needed.
        Returns:
        RmAdminReply. The message must be Reconfiguration complete.; any other response indicates failure. Failure occurs when the new configuration is invalid. If this occurs use check_ducc -cv to read and validate the current configuration.
        Throws:
        Exception - if anything goes wrong in transmission or receipt of the request.
      • run

        public int run(String[] args)
                throws Exception
        This is called from main in response to a CLI request.
        Parameters:
        args - the command line arguments. See the usage method below for details.
        Returns:
        0 if succeeds, 1 if fails
        Throws:
        Exception - if anything goes wrong in transmission or receipt of the request.
      • main

        public static void main(String[] args)

Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.