本文整理汇总了Python中service_configuration_lib.read_extra_service_information函数的典型用法代码示例。如果您正苦于以下问题:Python read_extra_service_information函数的具体用法?Python read_extra_service_information怎么用?Python read_extra_service_information使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_extra_service_information函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_adhoc_job_config
def load_adhoc_job_config(service, instance, cluster, load_deployments=True, soa_dir=DEFAULT_SOA_DIR):
general_config = service_configuration_lib.read_service_configuration(
service,
soa_dir=soa_dir
)
adhoc_conf_file = "adhoc-%s" % cluster
log.info("Reading adhoc configuration file: %s.yaml", adhoc_conf_file)
instance_configs = service_configuration_lib.read_extra_service_information(
service_name=service,
extra_info=adhoc_conf_file,
soa_dir=soa_dir
)
if instance not in instance_configs:
raise NoConfigurationForServiceError(
"%s not found in config file %s/%s/%s.yaml." % (instance, soa_dir, service, adhoc_conf_file)
)
general_config = deep_merge_dictionaries(overrides=instance_configs[instance], defaults=general_config)
branch_dict = {}
if load_deployments:
deployments_json = load_v2_deployments_json(service, soa_dir=soa_dir)
branch = general_config.get('branch', get_paasta_branch(cluster, instance))
deploy_group = general_config.get('deploy_group', branch)
branch_dict = deployments_json.get_branch_dict_v2(service, branch, deploy_group)
return AdhocJobConfig(
service=service,
cluster=cluster,
instance=instance,
config_dict=general_config,
branch_dict=branch_dict,
)
示例2: get_service_instance_list
def get_service_instance_list(name, cluster=None, instance_type=None, soa_dir=DEFAULT_SOA_DIR):
"""Enumerate the instances defined for a service as a list of tuples.
:param name: The service name
:param cluster: The cluster to read the configuration for
:param instance_type: The type of instances to examine: 'marathon', 'chronos', or None (default) for both
:param soa_dir: The SOA config directory to read from
:returns: A list of tuples of (name, instance) for each instance defined for the service name
"""
if not cluster:
cluster = load_system_paasta_config().get_cluster()
if instance_type == 'marathon' or instance_type == 'chronos':
instance_types = [instance_type]
else:
instance_types = ['marathon', 'chronos']
instance_list = []
for srv_instance_type in instance_types:
conf_file = "%s-%s" % (srv_instance_type, cluster)
log.info("Enumerating all instances for config file: %s/*/%s.yaml" % (soa_dir, conf_file))
instances = service_configuration_lib.read_extra_service_information(
name,
conf_file,
soa_dir=soa_dir
)
for instance in instances:
instance_list.append((name, instance))
log.debug("Enumerated the following instances: %s", instance_list)
return instance_list
示例3: read_chronos_jobs_for_service
def read_chronos_jobs_for_service(service, cluster, soa_dir=DEFAULT_SOA_DIR):
chronos_conf_file = 'chronos-%s' % cluster
log.info("Reading Chronos configuration file: %s/%s/chronos-%s.yaml" % (soa_dir, service, cluster))
return service_configuration_lib.read_extra_service_information(
service,
chronos_conf_file,
soa_dir=soa_dir
)
示例4: read_paasta_native_jobs_for_service
def read_paasta_native_jobs_for_service(service, cluster, soa_dir=DEFAULT_SOA_DIR):
paasta_native_conf_file = 'paasta_native-%s' % cluster
log.info("Reading paasta_native configuration file: %s/%s/paasta_native-%s.yaml" % (soa_dir, service, cluster))
return service_configuration_lib.read_extra_service_information(
service,
paasta_native_conf_file,
soa_dir=soa_dir
)
示例5: read_namespace_for_service_instance
def read_namespace_for_service_instance(name, instance, cluster=None, soa_dir=DEFAULT_SOA_DIR):
"""Retreive a service instance's nerve namespace from its configuration file.
If one is not defined in the config file, returns instance instead."""
if not cluster:
cluster = load_system_paasta_config().get_cluster()
srv_info = service_configuration_lib.read_extra_service_information(name, "marathon-%s" % cluster, soa_dir)[
instance
]
return srv_info["nerve_ns"] if "nerve_ns" in srv_info else instance
示例6: load_marathon_service_config
def load_marathon_service_config(service, instance, cluster, load_deployments=True, soa_dir=DEFAULT_SOA_DIR):
"""Read a service instance's configuration for marathon.
If a branch isn't specified for a config, the 'branch' key defaults to
paasta-${cluster}.${instance}.
:param name: The service name
:param instance: The instance of the service to retrieve
:param cluster: The cluster to read the configuration for
:param load_deployments: A boolean indicating if the corresponding deployments.json for this service
should also be loaded
:param soa_dir: The SOA configuration directory to read from
:returns: A dictionary of whatever was in the config for the service instance"""
log.info("Reading service configuration files from dir %s/ in %s" % (service, soa_dir))
log.info("Reading general configuration file: service.yaml")
general_config = service_configuration_lib.read_service_configuration(
service,
soa_dir=soa_dir
)
marathon_conf_file = "marathon-%s" % cluster
log.info("Reading marathon configuration file: %s.yaml", marathon_conf_file)
instance_configs = service_configuration_lib.read_extra_service_information(
service,
marathon_conf_file,
soa_dir=soa_dir
)
if instance not in instance_configs:
raise NoConfigurationForServiceError(
"%s not found in config file %s/%s/%s.yaml." % (instance, soa_dir, service, marathon_conf_file)
)
general_config = deep_merge_dictionaries(overrides=instance_configs[instance], defaults=general_config)
branch_dict = {}
if load_deployments:
deployments_json = load_deployments_json(service, soa_dir=soa_dir)
branch = general_config.get('branch', get_paasta_branch(cluster, instance))
branch_dict = deployments_json.get_branch_dict(service, branch)
return MarathonServiceConfig(
service=service,
cluster=cluster,
instance=instance,
config_dict=general_config,
branch_dict=branch_dict,
)
示例7: load_performance_check_config
def load_performance_check_config(service, soa_dir):
return read_extra_service_information(
service_name=service,
extra_info='performance-check',
soa_dir=soa_dir,
)