當前位置: 首頁>>代碼示例>>Python>>正文


Python params.config方法代碼示例

本文整理匯總了Python中params.config方法的典型用法代碼示例。如果您正苦於以下問題:Python params.config方法的具體用法?Python params.config怎麽用?Python params.config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在params的用法示例。


在下文中一共展示了params.config方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: configure

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def configure(self, env):
        # Import properties defined in -config.xml file from the params class
        import params

        # This allows us to access the params.elastic_pid_file property as
        # format('{elastic_pid_file}')
        env.set_params(params)

        configurations = params.config['configurations']['elastic-config']

        File(format("{elastic_conf_dir}/elasticsearch.yml"),
             content=Template("elasticsearch.yml.j2",
                              configurations=configurations),
             owner=params.elastic_user,
             group=params.elastic_group
            )

        # Install HEAD and HQ puglins - these plugins are not currently supported by ES 5.x
        #cmd = format("{elastic_base_dir}/bin/elasticsearch-plugin install mobz/elasticserach-head")
        #Execute(cmd)

        # Attempt to remove X-Pack plugin
        cmd = format("{elastic_base_dir}/bin/elasticsearch-plugin remove x-pack")
        Execute(cmd)

        # Install X-Pack plugin
        cmd = format("{elastic_base_dir}/bin/elasticsearch-plugin install x-pack")
        Execute(cmd)

        # Ensure all files owned by elasticsearch user
        cmd = format("chown -R {elastic_user}:{elastic_group} {elastic_base_dir}")
        Execute(cmd)

        Execute('echo "Configuration complete"') 
開發者ID:Jaraxal,項目名稱:ambari-elasticsearch-service,代碼行數:36,代碼來源:master.py

示例2: slave

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def slave():
    import params

    params.path_data = params.path_data.replace('"', '')
    data_path = params.path_data.replace(' ', '').split(',')
    data_path[:] = [x.replace('"', '') for x in data_path]

    directories = [params.log_dir, params.pid_dir, params.conf_dir]
    directories = directories + data_path

    Directory(directories,
              create_parents=True,
              mode=0755,
              owner=params.elastic_user,
              group=params.elastic_user,
              cd_access="a"
              )

    File("{0}/elastic-env.sh".format(params.conf_dir),
         owner=params.elastic_user,
         content=InlineTemplate(params.elastic_env_sh_template)
         )

    configurations = params.config['configurations']['elastic-site']

    File("{0}/elasticsearch.yml".format(params.conf_dir),
         content=Template(
             "elasticsearch.slave.yaml.j2",
             configurations=configurations),
         owner=params.elastic_user,
         group=params.elastic_user
         )

    print "Master sysconfig: /etc/sysconfig/elasticsearch"
    File(format("/etc/sysconfig/elasticsearch"),
         owner="root",
         group="root",
         content=InlineTemplate(params.sysconfig_template)
         ) 
開發者ID:teamsoo,項目名稱:elasticsearch-ambari,代碼行數:41,代碼來源:slave.py

示例3: airflow_configure

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def airflow_configure(env):
	import params
	env.set_params(params)

	airflow_config_file = ""

	airflow_config = airflow_generate_config_for_section({
		"core" : params.config['configurations']['airflow-core-site'],
		"cli" : params.config['configurations']['airflow-cli-site'],
		"api" : params.config['configurations']['airflow-api-site'],
		"operators" : params.config['configurations']['airflow-operators-site'],
		"webserver" : params.config['configurations']['airflow-webserver-site'],
		"email" : params.config['configurations']['airflow-email-site'],
		"smtp" : params.config['configurations']['airflow-smtp-site'],
		"celery" : params.config['configurations']['airflow-celery-site'],
		"dask" : params.config['configurations']['airflow-dask-site'],
		"scheduler" : params.config['configurations']['airflow-scheduler-site'],
		"ldap" : params.config['configurations']['airflow-ldap-site'],
		"mesos" : params.config['configurations']['airflow-mesos-site'],
		"kerberos" : params.config['configurations']['airflow-kerberos-site'],
		"github_enterprise" : params.config['configurations']['airflow-githubenterprise-site'],
		"admin" : params.config['configurations']['airflow-admin-site'],
		"lineage" : params.config['configurations']['airflow-lineage-site'],
		"atlas" : params.config['configurations']['airflow-atlas-site'],
		"hive" : params.config['configurations']['airflow-hive-site'],
		"celery_broker_transport_options" : params.config['configurations']['airflow-celerybrokertransportoptions-site'],
		"elasticsearch" : params.config['configurations']['airflow-elasticsearch-site'],
		"kubernetes" : params.config['configurations']['airflow-kubernetes-site'],
		"kubernetes_secrets" : params.config['configurations']['airflow-kubernetessecrets-site']
	})

	for section, value in airflow_config.items():
		airflow_config_file += format("[{section}]\n{value}\n")

	with open(params.airflow_home + "/airflow.cfg", 'w') as configFile:
		configFile.write(airflow_config_file)
	configFile.close() 
開發者ID:miho120,項目名稱:ambari-airflow-mpack,代碼行數:39,代碼來源:airflow_setup.py

示例4: configure

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def configure(self, env, isInstall=False):
    import params
    env.set_params(params)

    drill_override_content=InlineTemplate(params.drill_override_content)
    drill_env_content=InlineTemplate(params.drill_env_content)

    if isInstall:
      Execute('chown -R ' + params.drill_user + ':' + params.drill_group + ' ' + params.drill_install_dir)

    File(params.drill_install_dir + '/apache-drill-1.6.0/conf/drill-override.conf', content=drill_override_content, owner=params.drill_user, group=params.drill_group)
    File(params.drill_install_dir + '/apache-drill-1.6.0/conf/drill-env.sh', content=drill_env_content, owner=params.drill_user, group=params.drill_group)
    XmlConfig("hdfs-site.xml", 
              conf_dir=params.drill_install_dir + '/apache-drill-1.6.0/conf',
              configurations=params.config['configurations']['hdfs-site'],
              configuration_attributes=params.config['configuration_attributes']['hdfs-site'],
              owner=params.drill_user,
              group=params.drill_group,
              mode=0644)
    XmlConfig("core-site.xml", 
              conf_dir=params.drill_install_dir + '/apache-drill-1.6.0/conf',
              configurations=params.config['configurations']['core-site'],
              configuration_attributes=params.config['configuration_attributes']['core-site'],
              owner=params.drill_user,
              group=params.drill_group,
              mode=0644)
    Execute('hdfs dfs -mkdir -p ' + params.sys_store_provider_zk_blobroot, user='hdfs')
    Execute('hdfs dfs -chown -R ' + params.drill_user + ':' + params.drill_group + ' ' + params.sys_store_provider_zk_blobroot, user='hdfs') 
開發者ID:dvergari,項目名稱:ambari-drill-service,代碼行數:30,代碼來源:drill.py

示例5: stop

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def stop(self, env):
        # Import properties defined in -config.xml file from the params class
        import params

        # Import properties defined in -env.xml file from the status_params class
        import status_params

        # This allows us to access the params.elastic_pid_file property as
        #  format('{elastic_pid_file}')
        env.set_params(params)

        # Stop Elasticsearch
        kill_process(params.elastic_pid_file, params.elastic_user, params.elastic_log_dir)
        #cmd = format("kill `cat {elastic_pid_file}`")
        #Execute(cmd, user=params.elastic_user, only_if=format("test -f {elastic_pid_file}")) 
開發者ID:Jaraxal,項目名稱:ambari-elasticsearch-service,代碼行數:17,代碼來源:master.py

示例6: start

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def start(self, env):
        # Import properties defined in -config.xml file from the params class
        import params

        # This allows us to access the params.elastic_pid_file property as
        #  format('{elastic_pid_file}')
        env.set_params(params)

        # Configure Elasticsearch
        self.configure(env)

        # Start Elasticsearch
        cmd = format("{elastic_base_dir}/bin/elasticsearch -d -p {elastic_pid_file}")
        Execute(cmd, user=params.elastic_user) 
開發者ID:Jaraxal,項目名稱:ambari-elasticsearch-service,代碼行數:16,代碼來源:master.py

示例7: elastic

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def elastic():
    import params

    params.path_data = params.path_data.replace('"','')
    data_path = params.path_data.replace(' ','').split(',')
    data_path[:]=[x.replace('"','') for x in data_path]
    
    directories = [params.log_dir, params.pid_dir, params.conf_dir]
    directories = directories+data_path;
    
    Directory(directories,
              owner=params.elastic_user,
              group=params.elastic_user,
              recursive=True
          )
    
    File(format("{conf_dir}/elastic-env.sh"),
          owner=params.elastic_user,
          content=InlineTemplate(params.elastic_env_sh_template)
     )

    configurations = params.config['configurations']['elastic-site']

    File(format("{conf_dir}/elasticsearch.yml"),
       content=Template(
                        "elasticsearch.master.yaml.j2",
                        configurations = configurations),
       owner=params.elastic_user,
       group=params.elastic_user
    )
    
    File(format("/etc/sysconfig/elasticsearch"),
       content=Template(
                        "elasticsearch.sysconfig.j2",
                        configurations = configurations),
       owner="root",
       group="root"
    ) 
開發者ID:Symantec,項目名稱:ambari-elasticsearch-service,代碼行數:40,代碼來源:elastic.py

示例8: slave

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def slave():
    import params

    params.path_data = params.path_data.replace('"','')
    data_path = params.path_data.replace(' ','').split(',')
    data_path[:]=[x.replace('"','') for x in data_path]
    
    directories = [params.log_dir, params.pid_dir, params.conf_dir]
    directories = directories+data_path;
    
    Directory(directories,
              owner=params.elastic_user,
              group=params.elastic_user,
              recursive=True
          )
    
    File(format("{conf_dir}/elastic-env.sh"),
          owner=params.elastic_user,
          content=InlineTemplate(params.elastic_env_sh_template)
     )

    configurations = params.config['configurations']['elastic-site']

    File(format("{conf_dir}/elasticsearch.yml"),
       content=Template(
                        "elasticsearch.slave.yaml.j2",
                        configurations = configurations),
       owner=params.elastic_user,
       group=params.elastic_user
    )
    
    File(format("/etc/sysconfig/elasticsearch"),
       content=Template(
                        "elasticsearch.sysconfig.j2",
                        configurations = configurations),
       owner="root",
       group="root"
    ) 
開發者ID:Symantec,項目名稱:ambari-elasticsearch-service,代碼行數:40,代碼來源:slave.py

示例9: elastic

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def elastic():
    print "INSIDE THE %s" % __file__
    import params

    params.path_data = params.path_data.replace('"', '')
    data_path = params.path_data.replace(' ', '').split(',')
    data_path[:] = [x.replace('"', '') for x in data_path]

    directories = [params.log_dir, params.pid_dir, params.conf_dir]
    directories = directories + data_path

    Directory(directories,
              create_parents=True,
              # recursive=True,
              mode=0755,
              owner=params.elastic_user,
              group=params.elastic_user
              )

    print "Master env: ""{0}/elastic-env.sh".format(params.conf_dir)
    File("{0}/elastic-env.sh".format(params.conf_dir),
         owner=params.elastic_user,
         content=InlineTemplate(params.elastic_env_sh_template)
         )

    configurations = params.config['configurations']['elastic-site']

    print "Master yml: ""{0}/elasticsearch.yml".format(params.conf_dir)
    File("{0}/elasticsearch.yml".format(params.conf_dir),
         content=Template(
             "elasticsearch.master.yaml.j2",
             configurations=configurations),
         owner=params.elastic_user,
         group=params.elastic_user
         )

    print "Master sysconfig: /etc/sysconfig/elasticsearch"
    File(format("/etc/sysconfig/elasticsearch"),
         owner="root",
         group="root",
         content=InlineTemplate(params.sysconfig_template)
         ) 
開發者ID:teamsoo,項目名稱:elasticsearch-ambari,代碼行數:44,代碼來源:elastic.py

示例10: install

# 需要導入模塊: import params [as 別名]
# 或者: from params import config [as 別名]
def install(self, env):
        # Import properties defined in -config.xml file from the params class
        import params

        # This allows us to access the params.elastic_pid_file property as
        # format('{elastic_pid_file}')
        env.set_params(params)

        # Install dependent packages
        self.install_packages(env)

        # Create user and group for Elasticsearch if they don't exist
        try: grp.getgrnam(params.elastic_group)
        except KeyError: Group(group_name=params.elastic_group)

        try: pwd.getpwnam(params.elastic_user)
        except KeyError: User(username=params.elastic_user,
                              gid=params.elastic_group,
                              groups=[params.elastic_group],
                              ignore_failures=True
                             )

        # Create Elasticsearch directories
        Directory([params.elastic_base_dir, params.elastic_log_dir, params.elastic_pid_dir],
                  mode=0755,
                  cd_access='a',
                  owner=params.elastic_user,
                  group=params.elastic_group,
                  create_parents=True
                 )

        # Create empty Elasticsearch install log
        File(params.elastic_install_log,
             mode=0644,
             owner=params.elastic_user,
             group=params.elastic_group,
             content=''
            )

        # Download Elasticsearch
        cmd = format("cd {elastic_base_dir}; wget {elastic_download} -O elasticsearch.tar.gz -a {elastic_install_log}")
        Execute(cmd, user=params.elastic_user)

        # Install Elasticsearch
        cmd = format("cd {elastic_base_dir}; tar -xf elasticsearch.tar.gz --strip-components=1")
        Execute(cmd, user=params.elastic_user)

        # Ensure all files owned by elasticsearch user
        cmd = format("chown -R {elastic_user}:{elastic_group} {elastic_base_dir}")
        Execute(cmd)

        # Remove Elasticsearch installation file
        cmd = format("cd {elastic_base_dir}; rm elasticsearch.tar.gz")
        Execute(cmd, user=params.elastic_user)

        Execute('echo "Install complete"') 
開發者ID:Jaraxal,項目名稱:ambari-elasticsearch-service,代碼行數:58,代碼來源:master.py


注:本文中的params.config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。