#!/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 DuccVaryOn(DuccUtil): def usage(self, msg): if ( msg != None ): print msg print 'vary_on list-of-nodes' print ' This marks the nodes named in the list online for scheduling purposes.' print ' The nodes must have been previously online and/or configured in a nodellist' print ' at boot time.' print '' print 'Example:' print ' vary_on node1 node2 node3' sys.exit(1) def main(self, nodes): if ( len(nodes) == 0 ): self.usage(None) print 'Varying on', nodes 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', '--varyon', ' '.join(nodes)) return if __name__ == "__main__": instance = DuccVaryOn() instance.main(sys.argv[1:])