Skip to content

Commit 8bfb62c

Browse files
committed
Delete simple uses of pretty_trace and some missed visual args.
Remove most all uses of pretty_trace. Remove more pretty_trace references and extern crate.
1 parent 98d3b06 commit 8bfb62c

File tree

87 files changed

+556
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+556
-717
lines changed

Cargo.lock

+314-250
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+32-31
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ split-debuginfo = "unpacked"
6363
# improved.
6464

6565
[workspace.dependencies]
66-
align_tools = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
67-
amino = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
66+
align_tools = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
67+
amino = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
6868
anyhow = "1"
69-
ansi_escape = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
69+
ansi_escape = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
7070
arboard = "2"
7171
assert_cmd = "2"
7272
async-trait = "0.1"
7373
attohttpc = { version = "0.18", default-features = false, features = ["compress", "tls-rustls"] }
74+
backtrace = "0.3"
7475
base64 = "0.13"
75-
binary_vec_io = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
76+
binary_vec_io = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
7677
bio = "0.39"
77-
bio_edit = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
78+
bio_edit = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
7879
byteorder = "1"
7980
bytes = "1"
8081
chrono = { version = "0.4", default-features = false, features = ["std", "clock"] }
@@ -85,41 +86,41 @@ core-graphics = "0.22"
8586
crc = "2"
8687
debruijn = "0.3"
8788
dirs = "4"
88-
dna = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
89+
dna = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
8990
edit-distance = "2"
90-
enclone_args = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
91-
enclone_core = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
91+
enclone_args = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
92+
enclone_core = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
9293
enclone_denovo = { path = "../enclone_denovo" }
9394
enclone_help = { path = "../enclone_help" }
94-
enclone = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
95-
enclone_print = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
96-
enclone_proto = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
97-
enclone_ranger = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
95+
enclone = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
96+
enclone_print = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
97+
enclone_proto = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
98+
enclone_ranger = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
9899
enclone_server_proto = { path = "../enclone_server_proto" }
99-
enclone_stuff = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
100+
enclone_stuff = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
100101
enclone_tail = { path = "../enclone_tail" }
101-
enclone_vars = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
102+
enclone_vars = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
102103
enclone_version = { path = "../enclone_version" }
103-
equiv = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
104+
equiv = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
104105
evalexpr = "7"
105-
expr_tools = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
106-
fasta_tools = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
106+
expr_tools = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
107+
fasta_tools = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
107108
file-lock = "2"
108109
flate2 = "1"
109110
float-ord = "0.3"
110111
fontdb = "0.7"
111112
fs_extra = "1"
112113
git = "https://github.com/10xGenomics/hdf5-rust.git"
113-
graph_simple = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
114+
graph_simple = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
114115
hdf5 = { git = "https://github.com/10XGenomics/hdf5-rust.git", branch = "conda_nov2021", features = ["conda"], default-features = false }
115116
home = "0.5"
116-
hyperbase = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
117+
hyperbase = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
117118
image = { version = "0.23", features = ["jpeg", "png", "jpeg_rayon"], default-features = false }
118119
include_dir = { version = "0.6", features = ["search"] }
119-
io_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
120+
io_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
120121
itertools = "0.10"
121122
jpeg-decoder = "0.2"
122-
kmer_lookup = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
123+
kmer_lookup = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
123124
lazy_static = "1"
124125
libc = "0.2"
125126
log = "0.4"
@@ -132,12 +133,12 @@ num-traits = "0.2"
132133
objc = "0.2"
133134
pager = "0.16"
134135
palette = "0.6"
135-
perf_stats = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
136+
perf_stats = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
136137
permutation = "0.4"
137138
petgraph = "0.6"
138139
plotters = { version = "0.3", default_features = false, features = ["svg_backend", "point_series"] }
139140
png-decoder = "0.1"
140-
pretty_trace = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main", features = ["pprof"]}
141+
pretty_trace = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace", features = ["pprof"]}
141142
procfs = { version = "0.12", default_features = false }
142143
# prost: enclone will compile without the std and prost-derive features, but other things
143144
# (such as enclone_proto) break.
@@ -153,12 +154,12 @@ serde = "1"
153154
serde_derive = "1"
154155
serde_json = "1"
155156
sha2 = "0.10"
156-
stats_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
157+
stats_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
157158
statrs = "0.15"
158-
stirling_numbers = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
159-
string_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
159+
stirling_numbers = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
160+
string_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
160161
superslice = "1"
161-
tables = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
162+
tables = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
162163
tar = "0.4"
163164
thiserror = "1"
164165
tilde-expand = "0.1"
@@ -170,9 +171,9 @@ tonic-build = { version = "0.6", default-features = false, features = ["transpor
170171
triple_accel = "0.4"
171172
users = "0.11"
172173
usvg = { version = "0.19", features = ["text"] }
173-
vdj_types = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
174-
vdj_ann = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
175-
vdj_ann_ref = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
176-
vector_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "main" }
174+
vdj_types = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
175+
vdj_ann = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
176+
vdj_ann_ref = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
177+
vector_utils = { git = "https://github.com/10XGenomics/enclone_ranger", branch = "macklin/delete_pretty_trace" }
177178
whoami = "1"
178179
yaml-rust = "0.4"

enclone_build/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9+
assert_cmd.workspace = true
10+
backtrace.workspace = true
911
chrono.workspace = true
1012
itertools.workspace = true
11-
pretty_trace.workspace = true
1213
string_utils.workspace = true
13-
enclone_core.workspace = true
14+
rayon.workspace = true
1415

1516
[build-dependencies]
1617
chrono.workspace = true

enclone_build/src/bin/traceback1.rs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
2+
3+
// Check that an out-of-range reference within a rayon parallel loop yields a correct traceback.
4+
5+
use enclone_build::set_panic_handler;
6+
use rayon::prelude::*;
7+
8+
fn main() {
9+
set_panic_handler(&[]);
10+
let z = vec![0; 100];
11+
let mut x = vec![0; 100];
12+
x.par_iter_mut().for_each(|r| {
13+
let _ = z[100 + *r];
14+
});
15+
}
16+
17+
#[test]
18+
fn test_traceback1() {
19+
use assert_cmd::prelude::*;
20+
use std::process::Command;
21+
let mut cmd = Command::cargo_bin("traceback1").expect(
22+
"\nAttempt to run traceback1 failed. The most likely explanation for this is that\n\
23+
somehow you did not run \"cargo b\". Please try that now, and be sure you are doing\n\
24+
it from the top-level enclone directory.\n",
25+
);
26+
let cmd = cmd
27+
.output()
28+
.unwrap_or_else(|_| panic!("{}", "very strange, failed to execute test_traceback1"));
29+
30+
let err = std::str::from_utf8(&cmd.stderr).unwrap();
31+
let source = "panicked at enclone_build/src/bin/traceback1.rs:13";
32+
let count = err.matches(source).count();
33+
assert_eq!(
34+
1, count,
35+
"expected to find exactly one instance of traceback source \"{source}\" but found {count}"
36+
);
37+
}

enclone_build/src/lib.rs

+86-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,89 @@
1-
pub mod prepare_for_apocalypse;
1+
use chrono::{TimeZone, Utc};
2+
use itertools::Itertools;
3+
4+
use std::env;
5+
use string_utils::TextUtils;
6+
7+
use backtrace::Backtrace;
8+
9+
use std::{panic, sync::atomic::AtomicBool, sync::atomic::Ordering::SeqCst, thread};
10+
11+
static PANICKING: AtomicBool = AtomicBool::new(false);
12+
13+
/// Set up panic handling.
14+
/// This function ensures that we always collect a stack trace, regardless of
15+
/// whether or not an env var was set. It also limits concurrent panics to a
16+
/// single thread, whichever panics first, to ensure that if more than one thread
17+
/// panics at once, we don't end up with interleaved stack trace messages.
18+
pub fn set_panic_handler(args: &[String]) {
19+
let now = Utc::now().naive_utc().timestamp();
20+
let build_date = version_string().after(":").between(": ", " :").to_string();
21+
let build_datetime = format!("{} 00:00:00", build_date);
22+
let then = Utc
23+
.datetime_from_str(&build_datetime, "%Y-%m-%d %H:%M:%S")
24+
.unwrap()
25+
.timestamp();
26+
let days_since_build = (now - then) / (60 * 60 * 24);
27+
let mut elapsed_message = String::new();
28+
if days_since_build > 30 {
29+
elapsed_message = format!(
30+
"Your build is {} days old. You might want to check \
31+
to see if there is a newer build now.\n\n",
32+
days_since_build
33+
);
34+
}
35+
36+
let trailer = format!(
37+
"You have probably encountered an internal \
38+
error in enclone.\n\n\
39+
Please email us at enclone@10xgenomics.com, including the traceback shown\n\
40+
above and also the following version information:\n\
41+
{} : {}.\n\n\
42+
Your command was:\n\n{}\n\n\
43+
{}\
44+
🌸 Thank you for reporting this bug and have a nice day! 🌸",
45+
env!("CARGO_PKG_VERSION"),
46+
version_string(),
47+
args.iter().format(" "),
48+
elapsed_message,
49+
);
50+
51+
assert_eq!(thread::current().name().unwrap_or("<none>"), "main");
52+
let _ = panic::take_hook();
53+
panic::set_hook(Box::new(move |info| {
54+
// Prevent multiple threads from issuing tracebacks.
55+
if PANICKING.load(SeqCst) {
56+
return;
57+
}
58+
PANICKING.store(true, SeqCst);
59+
60+
// Get backtrace.
61+
let backtrace = Backtrace::new();
62+
63+
let thread = thread::current();
64+
let thread = thread.name().unwrap_or("unnamed");
65+
match info.location() {
66+
Some(location) => eprintln!(
67+
"thread '{}' panicked at {}:{}",
68+
thread,
69+
location.file(),
70+
location.line()
71+
),
72+
None => eprintln!("thread '{thread}' panicked "),
73+
};
74+
75+
let msg = match info.payload().downcast_ref::<&'static str>() {
76+
Some(s) => *s,
77+
None => match info.payload().downcast_ref::<String>() {
78+
Some(s) => s.as_str(),
79+
None => "Box<Any>",
80+
},
81+
};
82+
eprintln!("{msg}\n{backtrace:?}\n{trailer}");
83+
84+
std::process::exit(101);
85+
}));
86+
}
287

388
const VERSION_STRING: &str = env!("VERSION_STRING");
489

enclone_build/src/prepare_for_apocalypse.rs

-117
This file was deleted.

enclone_denovo/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ fasta_tools.workspace = true
2323
io_utils.workspace = true
2424
itertools.workspace = true
2525
perf_stats.workspace = true
26-
pretty_trace.workspace = true
2726
rayon.workspace = true
2827
string_utils.workspace = true
2928
superslice.workspace = true

0 commit comments

Comments
 (0)