-
Notifications
You must be signed in to change notification settings - Fork 1
/
log_to_vim.py
executable file
·31 lines (26 loc) · 1.06 KB
/
log_to_vim.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#############################################################################################################################
#
# opens all failed(tba dead) jobs in teuthology server using vim
# usage: python3 log_to_vim.py $job_name
# example: python3 log_to_vim.py yuriw-2021-01-06_21:20:32-rados-wip-yuri3-testing-2021-01-06-0820-octopus-distro-basic-smithi
#
##############################################################################################################################
#!/usr/bin/env python3
import re
import os
import sys
if (len(sys.argv) == 2):
run_name = str(sys.argv[1])
archive = "/ceph/teuthology-archive/" + run_name + "/"
print(" opening failed/dead jobs for " + archive)
print(".......")
scrape = archive + "scrape.log"
with open(scrape,'r') as f:
job_id = re.findall(r"\'\b[0-9]{7}\b\'", f.read())
print("jobs that failed...")
for idx, item in enumerate(job_id):
job_id[idx] = archive + item.strip("'")+ "/teuthology.log"
print("job id" + job_id[idx])
os.system("vim -p " +" ".join(job_id))
else:
print("please enter run name")