mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
add support to the bottleneck script for configuring history size
This commit is contained in:
parent
180ed4cd3d
commit
b01ac1bfa6
@ -12,14 +12,17 @@ class Command(BaseCommand):
|
|||||||
help='ID of the Job Template to profile')
|
help='ID of the Job Template to profile')
|
||||||
parser.add_argument('--threshold', dest='threshold', type=float, default=5,
|
parser.add_argument('--threshold', dest='threshold', type=float, default=5,
|
||||||
help='Only show tasks that took at least this many seconds (defaults to 5)')
|
help='Only show tasks that took at least this many seconds (defaults to 5)')
|
||||||
|
parser.add_argument('--history', dest='history', type=float, default=25,
|
||||||
|
help='The number of historic jobs to look at')
|
||||||
parser.add_argument('--ignore', action='append', help='ignore a specific action (e.g., --ignore git)')
|
parser.add_argument('--ignore', action='append', help='ignore a specific action (e.g., --ignore git)')
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
jt = options['jt']
|
jt = options['jt']
|
||||||
threshold = options['threshold']
|
threshold = options['threshold']
|
||||||
|
history = options['history']
|
||||||
ignore = options['ignore']
|
ignore = options['ignore']
|
||||||
|
|
||||||
print('## ' + JobTemplate.objects.get(pk=jt).name + ' (last 25 runs)\n')
|
print('## ' + JobTemplate.objects.get(pk=jt).name + f' (last {history} runs)\n')
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
f'''
|
f'''
|
||||||
@ -38,7 +41,7 @@ class Command(BaseCommand):
|
|||||||
SELECT unifiedjob_ptr_id FROM main_job
|
SELECT unifiedjob_ptr_id FROM main_job
|
||||||
WHERE job_template_id={jt}
|
WHERE job_template_id={jt}
|
||||||
ORDER BY unifiedjob_ptr_id DESC
|
ORDER BY unifiedjob_ptr_id DESC
|
||||||
LIMIT 25
|
LIMIT {history}
|
||||||
)
|
)
|
||||||
ORDER BY delta DESC;
|
ORDER BY delta DESC;
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user