Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ascender/main/dispatch/worker/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def toggle_profiling(self, *args):
logger.error(f'profiling is disabled, wrote {filepath}')

def work_loop(self, *args, **kw):
if settings.AWX_CALLBACK_PROFILE:
if settings.ASCENDER_CALLBACK_PROFILE:
signal.signal(signal.SIGUSR1, self.toggle_profiling)
return super(CallbackBrokerWorker, self).work_loop(*args, **kw)

Expand Down
2 changes: 1 addition & 1 deletion ascender/main/management/commands/provision_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def add_arguments(self, parser):

def _register_hostname(self, hostname, node_type, uuid):
if not hostname:
if not settings.AWX_AUTO_DEPROVISION_INSTANCES:
if not settings.ASCENDER_AUTO_DEPROVISION_INSTANCES:
raise CommandError('Registering with values from settings only intended for use in K8s installs')

from ascender.main.management.commands.register_queue import RegisterQueue
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def register(
ip_address = ""

with advisory_lock('instance_registration_%s' % hostname):
if settings.AWX_AUTO_DEPROVISION_INSTANCES:
if settings.ASCENDER_AUTO_DEPROVISION_INSTANCES:
# detect any instances with the same IP address.
# if one exists, set it to ""
if ip_address:
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/models/ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def consumed_capacity(self):
)
if self.node_type in ('hybrid', 'control'):
capacity_consumed += (
settings.AWX_CONTROL_NODE_TASK_IMPACT * UnifiedJob.objects.filter(controller_node=self.hostname, status__in=('running', 'waiting')).count()
settings.ASCENDER_CONTROL_NODE_TASK_IMPACT * UnifiedJob.objects.filter(controller_node=self.hostname, status__in=('running', 'waiting')).count()
)
return capacity_consumed

Expand Down
4 changes: 2 additions & 2 deletions ascender/main/models/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def schedule_deletion(self, user_id=None):
delete_inventory.delay(self.pk, user_id)

def _update_host_smart_inventory_memeberships(self):
if self.kind == 'smart' and settings.AWX_REBUILD_SMART_MEMBERSHIP:
if self.kind == 'smart' and settings.ASCENDER_REBUILD_SMART_MEMBERSHIP:

def on_commit():
from ascender.main.tasks.system import update_host_smart_inventory_memberships
Expand Down Expand Up @@ -649,7 +649,7 @@ def get_effective_host_name(self):
return host_name

def _update_host_smart_inventory_memeberships(self):
if settings.AWX_REBUILD_SMART_MEMBERSHIP:
if settings.ASCENDER_REBUILD_SMART_MEMBERSHIP:

def on_commit():
from ascender.main.tasks.system import update_host_smart_inventory_memberships
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/notifications/grafana_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def send_messages(self, messages):
json=grafana_data,
headers=grafana_headers,
verify=(not self.grafana_no_verify_ssl),
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
if r.status_code >= 400:
logger.error(smart_str(_("Error sending notification grafana: {}").format(r.status_code)))
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/notifications/mattermost_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def send_messages(self, messages):
"{}".format(m.recipients()[0]),
json=payload,
verify=(not self.mattermost_no_verify_ssl),
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
if r.status_code >= 400:
logger.error(smart_str(_("Error sending notification mattermost: {}").format(r.status_code)))
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/notifications/pagerduty_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def send_messages(self, messages):
"client": m.from_email,
},
headers=get_ascender_http_client_headers(),
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
r.raise_for_status()
sent_messages += 1
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/notifications/rocketchat_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def send_messages(self, messages):
data=json.dumps(payload),
headers=get_ascender_http_client_headers(),
verify=(not self.rocketchat_no_verify_ssl),
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)

if r.status_code >= 400:
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/notifications/twilio_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def send_messages(self, messages):
auth=(self.account_sid, self.account_token),
data={"To": dest, "From": m.from_email, "Body": m.subject},
headers=get_ascender_http_client_headers(),
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
r.raise_for_status()
sent_messages += 1
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/notifications/webhook_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def send_messages(self, messages):
headers=headers,
verify=(not self.disable_ssl_verification),
allow_redirects=False, # override default behaviour for redirects
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)

# either success or error reached if this conditional fires
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/scheduler/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def kube_api(self):
# in Configuration.__init__. Container group API traffic was never proxied
# before that, and on OpenShift the injected cluster-wide proxy makes TLS
# verification against the cluster CA fail, so this stays opt-in.
if not settings.AWX_CONTAINER_GROUP_K8S_API_USE_PROXY:
if not settings.ASCENDER_CONTAINER_GROUP_K8S_API_USE_PROXY:
cfg.proxy = None
cfg.proxy_headers = None

Expand Down
2 changes: 1 addition & 1 deletion ascender/main/scheduler/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, prefix=""):
# We want to avoid calling settings in loops, so cache these settings at init time
self.start_task_limit = settings.START_TASK_LIMIT
self.task_manager_timeout = settings.TASK_MANAGER_TIMEOUT
self.control_task_impact = settings.AWX_CONTROL_NODE_TASK_IMPACT
self.control_task_impact = settings.ASCENDER_CONTROL_NODE_TASK_IMPACT

for m in self.subsystem_metrics.METRICS:
if m.startswith(self.prefix):
Expand Down
8 changes: 4 additions & 4 deletions ascender/main/scheduler/task_manager_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, obj, task_manager_instances=None, **kwargs):
self.instance_hostnames = tuple([instance.hostname for instance in _instances if instance.hostname in task_manager_instances])
self.max_concurrent_jobs = obj.max_concurrent_jobs
self.max_forks = obj.max_forks
self.control_task_impact = kwargs.get('control_task_impact', settings.AWX_CONTROL_NODE_TASK_IMPACT)
self.control_task_impact = kwargs.get('control_task_impact', settings.ASCENDER_CONTROL_NODE_TASK_IMPACT)

def consume_capacity(self, task):
"""We only consume capacity on an instance group level if it is a container group. Otherwise we consume capacity on an instance level."""
Expand Down Expand Up @@ -134,7 +134,7 @@ def __init__(self, instances=None, instance_fields=('node_type', 'capacity', 'ho
self.instances_by_hostname = dict()
self.instance_groups_container_group_jobs = dict()
self.instance_groups_container_group_consumed_forks = dict()
self.control_task_impact = kwargs.get('control_task_impact', settings.AWX_CONTROL_NODE_TASK_IMPACT)
self.control_task_impact = kwargs.get('control_task_impact', settings.ASCENDER_CONTROL_NODE_TASK_IMPACT)

if instances is None:
instances = (
Expand Down Expand Up @@ -170,7 +170,7 @@ def __init__(self, task_manager_instances=None, instance_groups=None, instance_g
self.task_manager_instances = task_manager_instances if task_manager_instances is not None else TaskManagerInstances()
self.controlplane_ig = None
self.pk_ig_map = dict()
self.control_task_impact = kwargs.get('control_task_impact', settings.AWX_CONTROL_NODE_TASK_IMPACT)
self.control_task_impact = kwargs.get('control_task_impact', settings.ASCENDER_CONTROL_NODE_TASK_IMPACT)
self.controlplane_ig_name = kwargs.get('controlplane_ig_name', settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME)

if instance_groups is not None: # for testing
Expand Down Expand Up @@ -265,7 +265,7 @@ def get_instance_groups_from_task_cache(self, task):
class TaskManagerModels:
def __init__(self, **kwargs):
# We want to avoid calls to settings over and over in loops, so cache this information here
kwargs['control_task_impact'] = kwargs.get('control_task_impact', settings.AWX_CONTROL_NODE_TASK_IMPACT)
kwargs['control_task_impact'] = kwargs.get('control_task_impact', settings.ASCENDER_CONTROL_NODE_TASK_IMPACT)
kwargs['controlplane_ig_name'] = kwargs.get('controlplane_ig_name', settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME)
self.instances = TaskManagerInstances(**kwargs)
self.instance_groups = TaskManagerInstanceGroups(task_manager_instances=self.instances, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions ascender/main/tasks/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def run(self, pk, **kwargs):
'playbook': self.build_playbook_path_relative_to_cwd(self.instance, private_data_dir),
'inventory': self.build_inventory(self.instance, private_data_dir),
'passwords': expect_passwords,
'suppress_env_files': getattr(settings, 'AWX_RUNNER_OMIT_ENV_FILES', True),
'suppress_env_files': getattr(settings, 'ASCENDER_RUNNER_OMIT_ENV_FILES', True),
'envvars': env,
}

Expand Down Expand Up @@ -604,7 +604,7 @@ def run(self, pk, **kwargs):
runner_settings = {
'job_timeout': self.get_instance_timeout(self.instance),
'suppress_ansible_output': True,
'suppress_output_file': getattr(settings, 'AWX_RUNNER_SUPPRESS_OUTPUT_FILE', True),
'suppress_output_file': getattr(settings, 'ASCENDER_RUNNER_SUPPRESS_OUTPUT_FILE', True),
}

idle_timeout = getattr(settings, 'DEFAULT_JOB_IDLE_TIMEOUT', 0)
Expand Down
2 changes: 1 addition & 1 deletion ascender/main/tasks/receptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def receptor_params(self):

receptor_params = {
"secret_kube_pod": spec_yaml,
"pod_pending_timeout": getattr(settings, 'AWX_CONTAINER_GROUP_POD_PENDING_TIMEOUT', "5m"),
"pod_pending_timeout": getattr(settings, 'ASCENDER_CONTAINER_GROUP_POD_PENDING_TIMEOUT', "5m"),
}

if self.credential:
Expand Down
6 changes: 3 additions & 3 deletions ascender/main/tasks/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def cluster_node_heartbeat(dispatch_time=None, worker_tasks=None):
elif (nowtime - last_last_seen) > timedelta(seconds=settings.CLUSTER_NODE_HEARTBEAT_PERIOD + 2):
logger.warning(f'Heartbeat skew - interval={(nowtime - last_last_seen).total_seconds():.4f}, expected={settings.CLUSTER_NODE_HEARTBEAT_PERIOD}')
else:
if settings.AWX_AUTO_DEPROVISION_INSTANCES:
if settings.ASCENDER_AUTO_DEPROVISION_INSTANCES:
changed, this_inst = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', node_uuid=settings.SYSTEM_UUID)
if changed:
logger.warning(f'Recreated instance record {this_inst.hostname} after unexpected removal')
Expand Down Expand Up @@ -638,7 +638,7 @@ def cluster_node_heartbeat(dispatch_time=None, worker_tasks=None):
except Exception:
logger.exception('failed to reap jobs for {}'.format(other_inst.hostname))
try:
if settings.AWX_AUTO_DEPROVISION_INSTANCES and other_inst.node_type == "control":
if settings.ASCENDER_AUTO_DEPROVISION_INSTANCES and other_inst.node_type == "control":
deprovision_hostname = other_inst.hostname
other_inst.delete() # FIXME: what about associated inbound links?
logger.info("Host {} Automatically Deprovisioned.".format(deprovision_hostname))
Expand Down Expand Up @@ -721,7 +721,7 @@ def awx_k8s_reaper():
logger.debug('{} is no longer active, reaping orphaned k8s pod'.format(job.log_format))
try:
pm = PodManager(job)
pm.kube_api.delete_namespaced_pod(name=pods[job.id], namespace=pm.namespace, _request_timeout=settings.AWX_CONTAINER_GROUP_K8S_API_TIMEOUT)
pm.kube_api.delete_namespaced_pod(name=pods[job.id], namespace=pm.namespace, _request_timeout=settings.ASCENDER_CONTAINER_GROUP_K8S_API_TIMEOUT)
except Exception:
logger.exception("Failed to delete orphaned pod {} from {}".format(job.log_format, group))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_register_self_openshift():
assert not Instance.objects.exists()
assert not InstanceGroup.objects.exists()

with override_settings(AWX_AUTO_DEPROVISION_INSTANCES=True, CLUSTER_HOST_ID='foo_node', SYSTEM_UUID='12345'):
with override_settings(ASCENDER_AUTO_DEPROVISION_INSTANCES=True, CLUSTER_HOST_ID='foo_node', SYSTEM_UUID='12345'):
Command().handle()
inst = Instance.objects.first()
assert inst.hostname == 'foo_node'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,5 @@ def test_kube_api_ignores_proxy_environment(containerized_job, default_job_execu
assert pm.kube_api.api_client.configuration.proxy is None

del pm.__dict__['kube_api'] # drop the cached_property
with override_settings(AWX_CONTAINER_GROUP_K8S_API_USE_PROXY=True):
with override_settings(ASCENDER_CONTAINER_GROUP_K8S_API_USE_PROXY=True):
assert pm.kube_api.api_client.configuration.proxy == 'http://proxy.example.com:3128'
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def test_job_fails_to_launch_when_no_control_capacity(self, job_template, contro
def test_hybrid_capacity(self, job_template, hybrid_instance):
enough_capacity = job_template.create_unified_job()
insufficient_capacity = job_template.create_unified_job()
expected_task_impact = enough_capacity.task_impact + settings.AWX_CONTROL_NODE_TASK_IMPACT
expected_task_impact = enough_capacity.task_impact + settings.ASCENDER_CONTROL_NODE_TASK_IMPACT
all_ujs = [enough_capacity, insufficient_capacity]
for uj in all_ujs:
uj.signal_start()
Expand All @@ -261,7 +261,7 @@ def test_hybrid_capacity(self, job_template, hybrid_instance):
def test_project_update_capacity(self, project, hybrid_instance, instance_group_factory, controlplane_instance_group):
pu = project.create_unified_job()
instance_group_factory(name='second_ig', instances=[hybrid_instance])
expected_task_impact = pu.task_impact + settings.AWX_CONTROL_NODE_TASK_IMPACT
expected_task_impact = pu.task_impact + settings.ASCENDER_CONTROL_NODE_TASK_IMPACT
pu.signal_start()

tm = TaskManager()
Expand Down
14 changes: 7 additions & 7 deletions ascender/main/tests/unit/notifications/test_grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_send_messages():
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'time': 60000},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -64,7 +64,7 @@ def test_send_messages_with_no_verify_ssl():
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'time': 60000},
verify=False,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -96,7 +96,7 @@ def test_send_messages_with_dashboardid(dashboardId):
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'time': 60000, 'dashboardId': dashboardId},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -128,7 +128,7 @@ def test_send_messages_with_panelid(panelId):
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'panelId': int(panelId), 'time': 60000},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -159,7 +159,7 @@ def test_send_messages_with_bothids():
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'panelId': 42, 'time': 60000, 'dashboardId': 42},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -190,7 +190,7 @@ def test_send_messages_with_emptyids():
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'time': 60000},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -221,6 +221,6 @@ def test_send_messages_with_tags():
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer testapikey'},
json={'tags': ['ansible'], 'text': 'test subject', 'isRegion': True, 'timeEnd': 120000, 'time': 60000},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1
2 changes: 1 addition & 1 deletion ascender/main/tests/unit/notifications/test_mattermost.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def test_send_messages():
'http://example.com',
json={'text': 'test subject'},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1
4 changes: 2 additions & 2 deletions ascender/main/tests/unit/notifications/test_rocketchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_send_messages():
data='{"text": "test subject"}',
headers={'Content-Type': 'application/json', 'User-Agent': 'Ascender 0.0.1.dev (open)'},
verify=True,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1

Expand Down Expand Up @@ -120,6 +120,6 @@ def test_send_messages_with_no_verify_ssl():
data='{"text": "test subject"}',
headers={'Content-Type': 'application/json', 'User-Agent': 'Ascender 0.0.1.dev (open)'},
verify=False,
timeout=settings.AWX_NOTIFICATION_REQUEST_TIMEOUT,
timeout=settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT,
)
assert sent_messages == 1
Loading
Loading