cputil.py 1.92 KB
Newer Older
Jon Maron committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/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

21
import atlas_config as mc
Jon Maron committed
22 23 24 25 26

DEFAULT_JVM_OPTS="-Xmx1024m"

def main():

27 28 29
    atlas_home = mc.atlasDir()
    confdir = mc.dirMustExist(mc.confDir(atlas_home))
    logdir = mc.dirMustExist(mc.logDir(atlas_home))
Jon Maron committed
30 31 32 33 34
    mc.executeEnvSh(confdir)

    jvm_opts_list = []

    default_jvm_opts = DEFAULT_JVM_OPTS
35 36
    atlas_jvm_opts = os.environ.get(mc.ATLAS_OPTS, default_jvm_opts)
    jvm_opts_list.extend(atlas_jvm_opts.split())
Jon Maron committed
37 38

    #expand web app dir
39 40
    web_app_dir = mc.webAppDir(atlas_home)
    mc.expandWebApp(atlas_home)
Jon Maron committed
41 42

    p = os.pathsep
43
    atlas_classpath = confdir + p \
44 45
                       + os.path.join(web_app_dir, "atlas", "WEB-INF", "classes" ) + p \
                       + os.path.join(web_app_dir, "atlas", "WEB-INF", "lib", "*" )  + p \
46
                       + os.path.join(atlas_home, "libext", "*")
Jon Maron committed
47

48
    process = mc.java("org.apache.atlas.util.CredentialProviderUtility", sys.argv[1:], atlas_classpath, jvm_opts_list)
Jon Maron committed
49 50 51 52 53 54 55 56 57 58
    process.wait()

if __name__ == '__main__':
    try:
        returncode = main()
    except Exception as e:
        print "Exception: %s " % str(e)
        returncode = -1

    sys.exit(returncode)