Skip to content

Commit

Permalink
MRG: fix lint error, & processed sig reporting for rocksdb/fastmultig…
Browse files Browse the repository at this point in the history
…ather (#320)

Fixes #313
Fixes #285

Addresses #239 / #299 by bailing out when an output path is provided but will not be used:
```
RuntimeError: output path specified, but not running fastmultigather against a rocksdb. See 
issue #239
```
although we are leaning towards respecting `-o` in the future, see #299 discussion, so this will soon get revisited.
---------

Co-authored-by: Tessa Pierce Ward <bluegenes@users.noreply.github.com>
  • Loading branch information
ctb and bluegenes authored May 8, 2024
1 parent 0dcbae3 commit f07d3a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ fn do_fastmultigather(
}
}
} else {
if let Some(_) = output_path {
bail!("output path specified, but not running fastmultigather against a rocksdb. See issue #239");
}
match fastmultigather::fastmultigather(
query_filenames,
siglist_path,
Expand Down
1 change: 1 addition & 0 deletions src/mastiff_manygather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub fn mastiff_manygather(
Ok(query_sig) => {
let mut results = vec![];
if let Some(query_mh) = query_sig.minhash() {
let _ = processed_sigs.fetch_add(1, atomic::Ordering::SeqCst);
// Gather!
let (counter, query_colors, hash_to_color) =
db.prepare_gather_counters(query_mh);
Expand Down
14 changes: 6 additions & 8 deletions src/python/tests/test_multigather.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_simple_read_manifests(runtmp):

make_file_list(against_list, [sig2, sig47, sig63])

runtmp.sourmash("sig","manifest", query, "-o", query_mf)
runtmp.sourmash("sig", "manifest", query, "-o", query_mf)
runtmp.sourmash("sig", "manifest", against_list, "-o", against_mf)

cwd = os.getcwd()
Expand Down Expand Up @@ -316,12 +316,14 @@ def test_sig_query(runtmp, capfd, indexed):
if indexed:
against_list = index_siglist(runtmp, against_list, runtmp.output('db'))
g_output = runtmp.output('out.csv')
output_params = ['-o', g_output]
else:
g_output = runtmp.output('SRR606249.gather.csv')
p_output = runtmp.output('SRR606249.prefetch.csv')
output_params = []

runtmp.sourmash('scripts', 'fastmultigather', query, against_list,
'-s', '100000', '-o', g_output)
'-s', '100000', *output_params)

captured = capfd.readouterr()
print(captured.err)
Expand Down Expand Up @@ -361,14 +363,11 @@ def test_bad_query(runtmp, capfd, indexed):

make_file_list(against_list, [sig2, sig47, sig63])

output = runtmp.output('out.csv')

if indexed:
against_list = index_siglist(runtmp, against_list, runtmp.output('db'))

with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash('scripts', 'fastmultigather', query_zip, against_list,
'-o', output)
runtmp.sourmash('scripts', 'fastmultigather', query_zip, against_list)

captured = capfd.readouterr()
print(captured.err)
Expand Down Expand Up @@ -520,13 +519,12 @@ def test_bad_against_2(runtmp, capfd, zip_query):
with open(sig2, 'rb') as fp2:
fp.write(fp2.read())

output = runtmp.output('out.csv')
if zip_query:
query_list = zip_siglist(runtmp, query_list, runtmp.output('query.zip'))

with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash('scripts', 'fastmultigather', query_list, against_zip,
'-s', '100000', '-o', output)
'-s', '100000')

captured = capfd.readouterr()
print(captured.err)
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ fn process_prefix_csv(
pub fn load_sketches(
collection: Collection,
selection: &Selection,
report_type: ReportType,
_report_type: ReportType,
) -> Result<Vec<SmallSignature>> {
let sketchinfo: Vec<SmallSignature> = collection
.par_iter()
Expand Down

0 comments on commit f07d3a5

Please sign in to comment.