diff --git a/README.md b/README.md index 017eb02..e601bfa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ood-proteinfold (OnDemand App) -`ood-proteinfold` is an [Open OnDemand](https://openondemand.org/) interactive app for computational protein structure prediction using [Proteinfold](https://nf-co.re/proteinfold/) ([AlphaFold2](https://github.com/google-deepmind/alphafold/), [Boltz](https://github.com/jwohlwend/boltz/), [ColabFold](https://github.com/sokrypton/ColabFold), [ESMFold](https://github.com/facebookresearch/esm), and [RoseTTAFold-All-Atom](https://github.com/baker-laboratory/RoseTTAFold-All-Atom/)) originally built for [UNSW's Katana HPC](https://www.unsw.edu.au/research/facilities-and-infrastructure/find-an-instrument/restech-instruments/katana). +`ood-proteinfold` is an [Open OnDemand](https://openondemand.org/) interactive app for computational protein structure prediction using [Proteinfold](https://nf-co.re/proteinfold/) ([AlphaFold2](https://github.com/google-deepmind/alphafold/), [Boltz](https://github.com/jwohlwend/boltz/), [ColabFold](https://github.com/sokrypton/ColabFold) and [ESMFold](https://github.com/facebookresearch/esm) originally built for [UNSW's Katana HPC](https://www.unsw.edu.au/research/facilities-and-infrastructure/find-an-instrument/restech-instruments/katana). ## Features diff --git a/completed.html.erb b/completed.html.erb index 130adc1..164d1bb 100644 --- a/completed.html.erb +++ b/completed.html.erb @@ -69,8 +69,44 @@ def sanitize_live_log(text) compact.join("\n").strip end -base_out_dir = (connect.respond_to?(:base_out_dir) && !connect.base_out_dir.blank?) ? connect.base_out_dir : "/srv/scratch/#{connect.user}/proteinfold_output" -results_url_base = (connect.respond_to?(:results_url_base) && !connect.results_url_base.blank?) ? connect.results_url_base : "/pun/sys/dashboard/files/fs" +def sanitize_output_log(text) + return nil if text.nil? + + lines = text.split("\n") + cleaned = [] + index = 0 + + while index < lines.length + line = lines[index] + + if line.start_with?("WARN: [PBSPRO] queue status cannot be fetched") + index += 1 + index += 1 while index < lines.length && !lines[index].strip.empty? + index += 1 if index < lines.length && lines[index].strip.empty? + next + end + + if line.strip == "Cleaning up..." + break + end + + if line.match?(/^=+$/) && index + 1 < lines.length && lines[index + 1].include?("Resource Usage on ") + break + end + + cleaned << line + index += 1 + end + + while cleaned.any? && cleaned.last.strip.empty? + cleaned.pop + end + + cleaned.join("\n").strip +end + +base_out_dir = (connect.respond_to?(:base_out_dir) && !connect.base_out_dir.blank?) ? connect.base_out_dir : portal_default_base_out_dir +results_url_base = (connect.respond_to?(:results_url_base) && !connect.results_url_base.blank?) ? connect.results_url_base : portal_default_results_url_base session_output_dir = (connect.respond_to?(:session_output_dir) && !connect.session_output_dir.blank?) ? connect.session_output_dir : nil log_dir = session_output_dir || File.join(base_out_dir, connect.run_dir) live_log_path = File.join(log_dir, "live_log.log") @@ -79,7 +115,11 @@ output_log_path = File.join(log_dir, "output.log") output_log_url = file_url(results_url_base, output_log_path) summary_log_url = File.file?(output_log_path) ? output_log_url : live_log_url summary_log_label = File.file?(output_log_path) ? "output.log" : "live_log.log" -log_text = sanitize_live_log(tail_text(live_log_path)) +log_text = if File.file?(output_log_path) + sanitize_output_log(tail_text(output_log_path, 16384, 40)) +else + sanitize_live_log(tail_text(live_log_path)) +end %>