mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 13:27:40 -02:30
label cleanup periodic job
This commit is contained in:
@@ -46,6 +46,7 @@ from django.contrib.auth.models import User
|
||||
from awx.lib.metrics import task_timer
|
||||
from awx.main.constants import CLOUD_PROVIDERS
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.models.label import Label
|
||||
from awx.main.queue import FifoQueue
|
||||
from awx.main.conf import tower_settings
|
||||
from awx.main.task_engine import TaskSerializer, TASK_TIMEOUT_INTERVAL
|
||||
@@ -109,6 +110,13 @@ def run_administrative_checks(self):
|
||||
tower_admin_emails,
|
||||
fail_silently=True)
|
||||
|
||||
@task(bind=True)
|
||||
def run_label_cleanup(self):
|
||||
qs = Label.get_orphaned_labels()
|
||||
labels_count = qs.count()
|
||||
qs.delete()
|
||||
return labels_count
|
||||
|
||||
@task(bind=True)
|
||||
def tower_periodic_scheduler(self):
|
||||
def get_last_run():
|
||||
|
||||
Reference in New Issue
Block a user