diff --git a/VERSIONLOG.md b/VERSIONLOG.md index fa18dabd..4da93cc1 100644 --- a/VERSIONLOG.md +++ b/VERSIONLOG.md @@ -1,5 +1,9 @@ # Scilifelab_epps Version Log +## 20240409.1 + +Fix issue that sys stderr blocks a step to be completed + ## 20240407.1 Add lane yield threshold for NovaSeqXPlus 25B FC diff --git a/scripts/index_distance_checker.py b/scripts/index_distance_checker.py index c3021bc1..4288ec42 100644 --- a/scripts/index_distance_checker.py +++ b/scripts/index_distance_checker.py @@ -354,7 +354,7 @@ def find_barcode(sample_idxs, sample, process): find_barcode(sample_idxs, sample, art.parent_process) -def main(lims, pid): +def main(lims, pid, auto): process = Process(lims, id=pid) tech_username = process.technician.username data, message = prepare_index_table(process) @@ -367,7 +367,10 @@ def main(lims, pid): warning_start = "**Warnings from Verify Indexes and Placement EPP: **\n" warning_end = "== End of Verify Indexes and Placement EPP warnings ==" if message: - sys.stderr.write("; ".join(message)) + if auto: + print("; ".join(message), file=sys.stderr) + else: + sys.stderr.write("; ".join(message)) if process.type.name == "Library Pooling (Finished Libraries) 4.0": if not process.udf.get("Comments"): process.udf["Comments"] = ( @@ -405,7 +408,8 @@ def main(lims, pid): process.udf["Comments"] += f"\n@{tech_username}\n" process.udf["Comments"] += warning_end process.put() - sys.exit(2) + if not auto: + sys.exit(2) else: print("No issue detected with indexes or placement", file=sys.stderr) message.append("No issue detected with indexes or placement") @@ -439,8 +443,13 @@ def main(lims, pid): "File name for standard log file, " "for runtime information and problems." ), ) + parser.add_argument( + "--auto", + action="store_true", + help=("Used when the script is running automatically in LIMS."), + ) args = parser.parse_args() lims = Lims(BASEURI, USERNAME, PASSWORD) lims.check_version() - main(lims, args.pid) + main(lims, args.pid, args.auto) diff --git a/scripts/index_placement_checker.py b/scripts/index_placement_checker.py index 229fff6f..2955bee1 100644 --- a/scripts/index_placement_checker.py +++ b/scripts/index_placement_checker.py @@ -106,7 +106,7 @@ def verify_index_placement(lims, process, data): return message -def main(lims, pid): +def main(lims, pid, auto): process = Process(lims, id=pid) tech_username = process.technician.username data = get_index_layout(process) @@ -115,7 +115,10 @@ def main(lims, pid): warning_end = "== End of Indexes Placement checker EPP warnings ==" if message: - sys.stderr.write("; ".join(message)) + if auto: + print("; ".join(message), file=sys.stderr) + else: + sys.stderr.write("; ".join(message)) if not process.udf.get("Comments"): process.udf["Comments"] = ( warning_start @@ -152,7 +155,8 @@ def main(lims, pid): process.udf["Comments"] += f"\n@{tech_username}\n" process.udf["Comments"] += warning_end process.put() - sys.exit(2) + if not auto: + sys.exit(2) else: print("No issue detected with indexes or placement", file=sys.stderr) # Clear previous warning messages if the error has been corrected @@ -169,8 +173,13 @@ def main(lims, pid): if __name__ == "__main__": parser = ArgumentParser(description=DESC) parser.add_argument("--pid", help="Lims id for current Process") + parser.add_argument( + "--auto", + action="store_true", + help=("Used when the script is running automatically in LIMS."), + ) args = parser.parse_args() lims = Lims(BASEURI, USERNAME, PASSWORD) lims.check_version() - main(lims, args.pid) + main(lims, args.pid, args.auto)