Skip to content

Commit 82d6dcb

Browse files
authored
implement launching dmesg with tail (#438)
* implement launching dmesg with tail * more asan timeout * add linux core directory detection; make next job launch delay depend on job parallelity; combine info prints to one * ignore python caches * fix merge issues, loop counting * add flag to disable report tarball generation * implement writing dmesg to report file * increase timeout * allow dmesg access * python - no $
1 parent d11d9ce commit 82d6dcb

File tree

7 files changed

+168
-36
lines changed

7 files changed

+168
-36
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ release
1111
.config
1212
.local
1313
.idea
14+
__pycache__
15+

helper.linux.fish

+2-2
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ function runInContainer
16931693
# from a regular user. Therefore we have to do some Eiertanz to stop it
16941694
# if we receive a TERM outside the container. Note that this does not
16951695
# cover SIGINT, since this will directly abort the whole function.
1696-
set c (docker run -d --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
1696+
set c (docker run -d --cap-add=SYS_PTRACE --privileged --security-opt seccomp=unconfined \
16971697
-v $WORKDIR/work/:$INNERWORKDIR \
16981698
-v $SSH_AUTH_SOCK:/ssh-agent \
16991699
-v "$WORKDIR/jenkins/helper":"$WORKSPACE/jenkins/helper" \
@@ -1806,7 +1806,7 @@ function interactiveContainer
18061806
set -l agentstarted ""
18071807
end
18081808

1809-
docker run -it --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
1809+
docker run -it --rm --cap-add=SYS_PTRACE --privileged --security-opt seccomp=unconfined \
18101810
-v $WORKDIR/work:$INNERWORKDIR \
18111811
-v $SSH_AUTH_SOCK:/ssh-agent \
18121812
-v "$WORKDIR/jenkins/helper":"$WORKSPACE/jenkins/helper" \

jenkins/helper/async_client.py

+41
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,42 @@ def make_default_params(verbose):
5252
"identifier": ""
5353
}
5454

55+
def tail_line_result(wait, line, params):
56+
"""
57+
Keep the line, filter it for leading #,
58+
if verbose print the line. else print progress.
59+
"""
60+
# pylint: disable=pointless-statement
61+
if params['skip_done']:
62+
if isinstance(line, tuple):
63+
print(params['prefix'] + str(line[0], 'utf-8').rstrip())
64+
params['output'].write(line[0])
65+
return True
66+
now = datetime.now()
67+
if now - params['last_read'] > timedelta(seconds=1):
68+
params['skip_done'] = True
69+
print(params['prefix'] + 'initial tail done, starting to output')
70+
return True
71+
def make_tail_params(verbose, prefix, logfile):
72+
""" create the structure to work with arrays to output the strings to """
73+
return {
74+
"trace_io": False,
75+
"error": "",
76+
"verbose": verbose,
77+
"output": logfile.open("wb"),
78+
"lfn": str(logfile),
79+
"identifier": "",
80+
"skip_done": False,
81+
"prefix": prefix,
82+
"last_read": datetime.now()
83+
}
84+
def delete_tail_params(params):
85+
""" teardown the structure to work with logfiles """
86+
print(f"{params['identifier']} closing {params['lfn']}")
87+
params['output'].flush()
88+
params['output'].close()
89+
print(f"{params['identifier']} {params['lfn']} closed")
90+
5591
def make_logfile_params(verbose, logfile, trace):
5692
""" create the structure to work with logfiles """
5793
return {
@@ -214,6 +250,7 @@ def __init__(self, config, connect_instance, deadline_signal=-1):
214250
self.connect_instance = connect_instance
215251
self.cfg = config
216252
self.deadline_signal = deadline_signal
253+
self.pid = None
217254
if self.deadline_signal == -1:
218255
# pylint: disable=no-member
219256
# yes, one is only there on the wintendo, the other one elsewhere.
@@ -315,6 +352,8 @@ def run_monitored(self,
315352
close_fds=ON_POSIX,
316353
cwd=self.cfg.test_data_dir.resolve(),
317354
) as process:
355+
# pylint: disable=consider-using-f-string
356+
self.pid = process.pid
318357
queue = Queue()
319358
thread1 = Thread(
320359
name=f"readIO {identifier}",
@@ -381,6 +420,7 @@ def run_monitored(self,
381420
if datetime.now() > deadline:
382421
have_deadline += 1
383422
if have_deadline == 1:
423+
# pylint: disable=line-too-long
384424
add_message_to_report(
385425
params,
386426
f"{identifier} Execution Deadline reached - will trigger signal {self.deadline_signal}!")
@@ -406,6 +446,7 @@ def run_monitored(self,
406446
process.stdout.close()
407447
break
408448
except psutil.TimeoutExpired:
449+
# pylint: disable=line-too-long
409450
deadline_grace_count += 1
410451
print_log(f"{identifier} timeout waiting for exit {str(deadline_grace_count)}", params)
411452
# if its not willing, use force:

0 commit comments

Comments
 (0)