Mercurial > repos > richard-burhans > batched_lastz
comparison run_lastz_tarball.py @ 8:3a67d287d19f draft
planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/batched_lastz commit a5a11ffe6ec0c36c5997499a50d58c38c36d54ec
author | richard-burhans |
---|---|
date | Fri, 09 Aug 2024 21:10:40 +0000 |
parents | 4cd7884635c2 |
children | d10e7502aba8 |
comparison
equal
deleted
inserted
replaced
7:4cd7884635c2 | 8:3a67d287d19f |
---|---|
38 command_dict = input_queue.get() | 38 command_dict = input_queue.get() |
39 | 39 |
40 if not command_dict: | 40 if not command_dict: |
41 return | 41 return |
42 | 42 |
43 args = ["lastz"] | 43 args = ["lastz", "--allocate:traceback=1.99G"] |
44 args.extend(command_dict["args"]) | 44 args.extend(command_dict["args"]) |
45 | 45 |
46 stdin = command_dict["stdin"] | 46 stdin = command_dict["stdin"] |
47 if stdin is not None: | 47 if stdin is not None: |
48 stdin = open(stdin, "r") | 48 stdin = open(stdin, "r") |
60 | 60 |
61 for var in [stdin, stdout, stderr]: | 61 for var in [stdin, stdout, stderr]: |
62 if var is not None: | 62 if var is not None: |
63 var.close() | 63 var.close() |
64 | 64 |
65 if p.returncode != 0: | 65 if p.returncode == 0: |
66 sys.exit(f"command failed: {' '.join(args)}") | |
67 else: | |
68 stderr = command_dict["stderr"] | 66 stderr = command_dict["stderr"] |
69 if stderr is not None: | 67 if stderr is not None: |
70 try: | 68 try: |
71 statinfo = os.stat(stderr, follow_symlinks=False) | 69 statinfo = os.stat(stderr, follow_symlinks=False) |
72 except Exception: | 70 except Exception: |
78 if statinfo.st_size != 0: | 76 if statinfo.st_size != 0: |
79 sys.exit(f"stderr file is not empty: {' '.join(args)}") | 77 sys.exit(f"stderr file is not empty: {' '.join(args)}") |
80 | 78 |
81 elapsed = time.perf_counter() - begin | 79 elapsed = time.perf_counter() - begin |
82 output_queue.put(elapsed) | 80 output_queue.put(elapsed) |
81 | |
82 elif p.returncode == 1: | |
83 # should be more robust | |
84 traceback_warning = True | |
85 | |
86 stderr_file = command_dict["stderr"] | |
87 if stderr_file is None: | |
88 traceback_warning = False | |
89 else: | |
90 with open(stderr_file) as f: | |
91 for stderr_line in f: | |
92 for prefix in ["truncating alignment", "truncation can be reduced"]: | |
93 if stderr_line.startswith(prefix): | |
94 continue | |
95 | |
96 stderr_line = stderr_line.strip() | |
97 if stderr_line: | |
98 traceback_warning = False | |
99 | |
100 if traceback_warning: | |
101 elapsed = time.perf_counter() - begin | |
102 output_queue.put(elapsed) | |
103 else: | |
104 sys.exit(f"command failed: {' '.join(args)}") | |
105 | |
106 else: | |
107 sys.exit(f"command failed: {' '.join(args)}") | |
83 | 108 |
84 if debug: | 109 if debug: |
85 print(f"runtime {elapsed}", file=sys.stderr, flush=True) | 110 print(f"runtime {elapsed}", file=sys.stderr, flush=True) |
86 | 111 |
87 | 112 |