COMBINE-lab / simpleaf

A rust framework to make using alevin-fry even simpler
BSD 3-Clause "New" or "Revised" License
44 stars 3 forks source link

Printing the command being run when encountering an error. #32

Closed DongzeHE closed 1 year ago

DongzeHE commented 1 year ago

One suggestion: when running simpleaf, if we encounter an error, can we print the command being run? I had some path issues when running simpleaf quant. It just told me that mapping failed. To debug it, I had to go to quant_info.json and find the mapping command and remove all quotes between arguments and run the salmon alevin command.

rob-p commented 1 year ago

The log /should does print the command being run. For example, I recently had one terminate with:

[2022-12-23T02:27:02Z INFO  simpleaf] cmd : "alevin-fry" "quant" "-i" "data/af_quant" "-o" "data/af_quant" "-t" "24" "-m" "t2g_3col.tsv" "-r" "cr-like"
Error: quant failed with exit status ExitStatus(unix_wait_status(512))

The problem is --- WTH is unix_wait_status(512)? It turns out the path to the t2g_3col.tsv was wrong. I think some of that can be avoided by better input and output validation between steps (e.g. check all provided input files exist, and when step i executes, ensure that all expected files for step i+1 exist when it finishes (and print an informative message otherwise).

DongzeHE commented 1 year ago

Right, I also got weird error messages like this. Is there a way to copy and paste the error message returned by salmon and alevin-fry when quitting with errors?

rob-p commented 1 year ago

It depends how they report the error, they may not report a message. The standard way to do this would be to capture the standard error buffer and dump that as well. However, these errors (e.g. wait status 512) are usually due to missing files. From that perspective, I think defensive checks for files being where the user expected they were would cover like 80% of the problems.

rob-p commented 1 year ago

Basic input file checking has been implemented as of 034d5314467092349407deff7e79a48c15bf3f59. It can still be improved (e.g. to make sure that things expected to be files are files and things expected to be directories are directories). Also, we can (if we choose) explicitly check for the expected files inside of directory arguments. However, I'll consider what we currently have to be a decent solution, or at least the start of one.