#!/usr/bin/env python # ----------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ----------------------------------------------------------------------- import os import sys from ducc_util import DuccUtil class DuccRmReconfigure(DuccUtil): def __init__(self): DuccUtil.__init__(self, True) def usage(self, msg): if ( msg != None ): print msg print 'Usage:' print ' rm_reconfigure' print '' print 'Notes:' print ' This forces the RM to stop scheduling, reread its configuration, and restart the scheduler.' print 'This is the equivalent of stopping RM, waiting for it to quiesce, and restarting RM.' sys.exit(1) def main(self, args): print 'Reconfiguring RM' DUCC_JVM_OPTS = ' -Dducc.deploy.configuration=' + self.DUCC_HOME + "/resources/ducc.properties " DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -DDUCC_HOME=' + self.DUCC_HOME DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -Dducc.head=' + self.ducc_properties.get('ducc.head') self.spawn(self.java(), DUCC_JVM_OPTS, 'org.apache.uima.ducc.common.main.DuccRmAdmin', '--reconfigure') # Web server updates Machines page when the classes file changes class_file = self.ducc_properties.get('ducc.rm.class.definitions') CMD = 'touch ' + self.DUCC_HOME + '/resources/' + class_file os.system(CMD) return if __name__ == "__main__": np = DuccRmReconfigure() np.main(sys.argv[1:])