From 8f14cdd6cacf3652de77f527eea3d5efca5cca62 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 13 May 2025 14:20:20 +0200 Subject: Invocation server: show actions with console output separately Normally, actions are supposed to work silently, i.e., without writing to stdout/stderr. So, if an action produces console output, it is definitely worth looking at, even for cached actions. Therefore, add a section after the failed actions showing those actions (if not in the previous action). Also, always show duration (if known) and if an action is cached (which can happen for the ones producing console output). --- doc/invocations-http-server/server.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'doc/invocations-http-server/server.py') diff --git a/doc/invocations-http-server/server.py b/doc/invocations-http-server/server.py index 6ff6b668..d1791c16 100755 --- a/doc/invocations-http-server/server.py +++ b/doc/invocations-http-server/server.py @@ -391,7 +391,10 @@ class InvocationServer: def action_data(name, profile_value): data = { "name_prefix": "", "name": name, + "cached": profile_value.get('cached'), "exit_code": profile_value.get('exit code', 0)} + duration = profile_value.get('duration', 0.0) + data["duration"] = '%0.3fs' % (duration,) if duration > 0 else None desc = graph.get('actions', {}).get(name, {}) data["may_fail"] = desc.get("may_fail") data["stdout"] = profile_value.get('stdout') @@ -414,24 +417,35 @@ class InvocationServer: data["origins"] = origins return data + actions_considered = set() failed_build_actions = [] failed_test_actions = [] for k, v in profile.get('actions', {}).items(): if v.get('exit code', 0) != 0: + actions_considered.add(k) if graph.get('actions', {}).get(k, {}).get('may_fail') != None: failed_test_actions.append(action_data(k, v)) else: failed_build_actions.append(action_data(k, v)) params["failed_actions"] = failed_build_actions + failed_test_actions - # longest running non-cached non-failed actions + # non-failed actions with output + output_actions = [] + for k, v in profile.get('actions', {}).items(): + if k not in actions_considered: + if v.get('stdout') or v.get('stderr'): + actions_considered.add(k) + output_actions.append(action_data(k,v)) + params["output_actions"] = output_actions + + # longest running non-cached non-failed actions without output candidates = [] action_count = 0 action_count_cached = 0 for k, v in profile.get('actions', {}).items(): action_count += 1 if not v.get('cached'): - if v.get('exit code', 0) == 0: + if k not in actions_considered: candidates.append((v.get('duration', 0.0), k, v)) else: action_count_cached += 1 -- cgit v1.2.3