@@ -72,6 +72,42 @@ def sanitize_live_log(text)
7272 compact.join("\n").strip
7373end
7474
75+ def sanitize_output_log(text)
76+ return nil if text.nil?
77+
78+ lines = text.split("\n")
79+ cleaned = []
80+ index = 0
81+
82+ while index < lines.length
83+ line = lines[index]
84+
85+ if line.start_with?("WARN: [PBSPRO] queue status cannot be fetched")
86+ index += 1
87+ index += 1 while index < lines.length && !lines[index].strip.empty?
88+ index += 1 if index < lines.length && lines[index].strip.empty?
89+ next
90+ end
91+
92+ if line.strip == "Cleaning up..."
93+ break
94+ end
95+
96+ if line.match?(/^=+$/) && index + 1 < lines.length && lines[index + 1].include?("Resource Usage on ")
97+ break
98+ end
99+
100+ cleaned << line
101+ index += 1
102+ end
103+
104+ while cleaned.any? && cleaned.last.strip.empty?
105+ cleaned.pop
106+ end
107+
108+ cleaned.join("\n").strip
109+ end
110+
75111base_out_dir = (connect.respond_to?(:base_out_dir) && !connect.base_out_dir.blank?) ? connect.base_out_dir : portal_default_base_out_dir
76112results_url_base = (connect.respond_to?(:results_url_base) && !connect.results_url_base.blank?) ? connect.results_url_base : portal_default_results_url_base
77113session_output_dir = (connect.respond_to?(:session_output_dir) && !connect.session_output_dir.blank?) ? connect.session_output_dir : nil
@@ -82,7 +118,11 @@ output_log_path = File.join(log_dir, "output.log")
82118output_log_url = file_url(results_url_base, output_log_path)
83119summary_log_url = File.file?(output_log_path) ? output_log_url : live_log_url
84120summary_log_label = File.file?(output_log_path) ? "output.log" : "live_log.log"
85- log_text = sanitize_live_log(tail_text(live_log_path))
121+ log_text = if File.file?(output_log_path)
122+ sanitize_output_log(tail_text(output_log_path, 16384, 40))
123+ else
124+ sanitize_live_log(tail_text(live_log_path))
125+ end
86126%>
87127 <div class ="ood-completed-log-card ">
88128< div > < b > Log</ b > : < a target ="_blank " rel ="noopener " href ="<%= summary_log_url %> "> <%= summary_log_label %> </ a > </ div >
0 commit comments