예제 #1
0
파일: storm.py 프로젝트: screeley44/ambari
def storm():
    import params

    yaml_config("storm.yaml",
                conf_dir=params.conf_dir,
                configurations=params.config['configurations']['storm-site'],
                owner=params.storm_user)
예제 #2
0
def storm():
  import params

  Directory([params.log_dir, params.pid_dir, params.local_dir, params.conf_dir],
            owner=params.storm_user,
            group=params.user_group,
            recursive=True
  )

  File(format("{conf_dir}/config.yaml"),
       content=Template("config.yaml.j2"),
       owner=params.storm_user,
       group=params.user_group
  )

  yaml_config("storm.yaml",
              conf_dir=params.conf_dir,
              configurations=params.config['configurations']['storm-site'],
              owner=params.storm_user,
              group=params.user_group
  )

  TemplateConfig(format("{conf_dir}/storm-env.sh"),
                 owner=params.storm_user
  )

  if params.security_enabled:
    TemplateConfig(format("{conf_dir}/storm_jaas.conf"),
                   owner=params.storm_user
    )
예제 #3
0
def storm():
    import params

    Directory(
        [params.log_dir, params.pid_dir, params.local_dir, params.conf_dir],
        owner=params.storm_user,
        group=params.user_group,
        recursive=True)

    File(format("{conf_dir}/config.yaml"),
         content=Template("config.yaml.j2"),
         owner=params.storm_user,
         group=params.user_group)

    yaml_config("storm.yaml",
                conf_dir=params.conf_dir,
                configurations=params.config['configurations']['storm-site'],
                owner=params.storm_user,
                group=params.user_group)

    File(format("{conf_dir}/storm-env.sh"),
         owner=params.storm_user,
         content=InlineTemplate(params.storm_env_sh_template))

    if params.security_enabled:
        TemplateConfig(format("{conf_dir}/storm_jaas.conf"),
                       owner=params.storm_user)
예제 #4
0
def storm():
  import params

  yaml_config("storm.yaml",
              conf_dir=params.conf_dir,
              configurations=params.config['configurations']['storm-site'],
              owner=params.storm_user
  )
예제 #5
0
파일: storm.py 프로젝트: indoos/ambari
def storm():
    import params

    Directory(
        [params.log_dir, params.pid_dir, params.local_dir, params.conf_dir],
        owner=params.storm_user,
        group=params.user_group,
        recursive=True)

    File(format("{conf_dir}/config.yaml"),
         content=Template("config.yaml.j2"),
         owner=params.storm_user,
         group=params.user_group)

    yaml_config("storm.yaml",
                conf_dir=params.conf_dir,
                configurations=params.config['configurations']['storm-site'],
                owner=params.storm_user,
                group=params.user_group)
예제 #6
0
def storm():
  import params

  Directory([params.log_dir, params.pid_dir, params.local_dir, params.conf_dir],
            owner=params.storm_user,
            group=params.user_group,
            recursive=True
  )

  File(format("{conf_dir}/config.yaml"),
            content=Template("config.yaml.j2"),
            owner = params.storm_user,
            group = params.user_group
  )

  yaml_config( "storm.yaml",
               conf_dir = params.conf_dir,
               configurations = params.config['configurations']['storm-site'],
               owner = params.storm_user,
               group = params.user_group
  )

  File(format("{conf_dir}/storm-env.sh"),
    owner=params.storm_user,
    content=InlineTemplate(params.storm_env_sh_template)
  )

  if params.security_enabled:
    File(format("{conf_dir}/storm_jaas.conf"),
              content=Template("storm_jaas.conf.j2"),
              owner = params.storm_user,
              group = params.user_group
    )

  if params.has_metric_collector:
    Execute(format("ln -s {metric_collector_sink_jar} {storm_lib_dir}/ambari-metrics-storm-sink.jar"),
            not_if=format("ls {storm_lib_dir}/ambari-metrics-storm-sink.jar"),
            only_if=format("ls {metric_collector_sink_jar}")
    )
예제 #7
0
def start_process(
    http_port,
    tcp_port,
    node_master,
    node_data):

    import params

    Directory([params.conf_dir],
            owner=params.es_user,
            group=params.user_group,
            recursive=True
    )

    yaml_config( "elasticsearch.yml",
               conf_dir = params.conf_dir,
               configurations = params.config['configurations']['elasticsearch'],
               owner = params.es_user,
               group = params.user_group
    )
    
    start_es_cmd = """{java64_home}/bin/java
{es_child_opts}
-Des.http.port={http_port}
-Des.transport.tcp.port={tcp_port}
-Des.node.master={node_master}
-Des.node.data={node_data}
org.elasticsearch.bootstrap.Elasticsearch"""

    process_cmd = format(start_es_cmd.replace("\n", " "))
    print("Starting ElasticSearch using command: "+process_cmd)
    Execute(process_cmd,
        logoutput=True,
        wait_for_finish=False,
        pid_file=params.pid_file,
        poll_after = 10,
        cwd=format("{app_root}")
    )  
import logging
import traceback
from yaml_config import yaml_config

yaml_config('yaml.conf')


class ContextLogger(object):
    USELESS_STACK = -3

    def __init__(self, name, project_path=None):
        self.logger = logging.getLogger(name)
        self.path = project_path

    def _context(self, more=False):
        stack = traceback.extract_stack()
        (filename, line, procname, text) = stack[self.USELESS_STACK]
        filename = self._filename(filename)
        steps = [self._filename(filename) + ':' + str(line) + '#' + mod + ':' + ctx
                 for filename, line, mod, ctx in stack[:self.USELESS_STACK]]
        stack = '  '.join(steps)
        context = '  [loc] ' + filename + ':' + procname + ':' + str(line)
        return context + '  [stk] ' + stack if more else context

    def _filename(self, filename):
        if self.path is not None and filename.find(self.path) > -1:
            if self.path == '/':
                return filename[filename.rfind('/') + 1:]
            else:
                filename = filename[len(self.path):]
                return filename[1:] if filename.find('/') == 0 else filename