#NEWLINE# def check_service_replication( client , service , instance , cluster , soa_dir , system_paasta_config ) : #NEWLINE# #INDENT# 'Checks a service\'s replication levels based on how the service\'s replication\n    should be monitored. (smartstack or mesos)\n\n    :param service: Service name, like "example_service"\n    :param instance: Instance name, like "main" or "canary"\n    :param cluster: name of the cluster\n    :param soa_dir: The SOA configuration directory to read from\n    :param system_paasta_config: A SystemPaastaConfig object representing the system configuration.\n    ' #NEWLINE# job_id = compose_job_id ( service , instance ) #NEWLINE# try : #NEWLINE# #INDENT# expected_count = marathon_tools . get_expected_instance_count_for_namespace ( service , instance , soa_dir = soa_dir ) #NEWLINE# #UNINDENT# except NoDeploymentsAvailable : #NEWLINE# #INDENT# log . debug ( ( 'deployments.json missing for %s. Skipping replication monitoring.' % job_id ) ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( expected_count is None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# log . info ( ( 'Expecting %d total tasks for %s' % ( expected_count , job_id ) ) ) #NEWLINE# proxy_port = marathon_tools . get_proxy_port_for_instance ( service , instance , soa_dir = soa_dir ) #NEWLINE# if ( proxy_port is not None ) : #NEWLINE# #INDENT# check_smartstack_replication_for_instance ( service = service , instance = instance , cluster = cluster , soa_dir = soa_dir , expected_count = expected_count , system_paasta_config = system_paasta_config ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# check_healthy_marathon_tasks_for_service_instance ( client = client , service = service , instance = instance , cluster = soa_dir , soa_dir = soa_dir , expected_count = expected_count )