Skip to content

Commit

Permalink
Merge pull request #74 from LCSB-BioCore/sew-truncate-memote-test-output
Browse files Browse the repository at this point in the history
Truncate memote test output
  • Loading branch information
exaexa authored May 18, 2023
2 parents 0ec9418 + dec23ff commit 62635eb
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 106 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,27 @@ FBCModelTests.Memote.run_tests("e_coli_core.json", GLPK.Optimizer; workers=worke
Any optimizer supported by [JuMP](https://jump.dev/) can be used. The output of
`run_tests` is the standard Julia unit testing scheme. However, in the repl the
full output is usually truncated, and only a summary is shown. If you want more
details about where/why your model failed certain tests, it is best to capture the
output, and save it to a file. A convenient way to do this is with
[ansi2html](https://github.com/agnoster/ansi2html).
details about where/why your model failed certain tests, it is best to capture
the output, and save it to a file. A convenient way to do this is with
[ansi2html](https://github.com/agnoster/ansi2html). Additionally, to make the
output more display friendly, we recommend `run_tests_toplevel` is used instead
of `run_tests`.

An example workflow entails using the scripts located in `bin/`:
```
fbcmt-memote-run --color=yes -s GLPK -w 6 e_coli_core.xml > e_coli_core.test.out
julia --color=yes fbcmt-memote-run -s GLPK -w 6 e_coli_core.xml > e_coli_core.test.out
ansi2html < e_coli_core.test.out > e_coli_core.test.html
```
The resultant `html` can be inspected in any browser.

See the function documentation for additional test configuration information.
Note, the tests implemented here are significantly more conservative than in the
original Memote. In particular, no heuristics are used to guess reactions types,
e.g. biomass, atp maintenance, transporters, exchanges, etc. Only [SBO
original Memote. In particular, no heuristics are used to guess reaction types,
e.g. biomass, atp maintenance, transporter, exchange, etc. Only [SBO
annotations](https://github.com/EBI-BioModels/SBO/blob/master/SBO_OBO.obo) are
used for this purpose, because only these are actually standardized.
Consequently, all tests that rely on properly annotated reactions will fail if
this is not incorporated in a model.
this is not incorporated into the model being tested.

The implementation in FBCModelTests.jl is mostly authored by
St. Elmo Wilken ([@stelmo](https://github.com/stelmo))
Expand Down
15 changes: 9 additions & 6 deletions bin/fbcmt-memote-run
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ while optind <= length(ARGS)
global nworkers = ARGS[optind]
elseif ARGS[optind] == "-h"
global help = true
break
else
push!(freeargs, ARGS[optind])
end
Expand All @@ -26,14 +27,14 @@ if help
println(
"""Usage: fbcmt-memote-run [-s|--solver <GLPK>] [-h|--help] [-w|--nworkers <1>] <model>""",
)
exit(1)
exit(0)
end

if length(freeargs) == 1
global model_file = first(freeargs)
global model_file = last(freeargs)
else
@error "Expected precisely 1 non-keyword argument: the model location."
exit(1)
@error "Expected only one argument, the model location, got $(length(freeargs)) instead."
exit(1)
end

if !isfile(model_file)
Expand All @@ -49,7 +50,7 @@ using FBCModelTests, FBCModelTests.Memote
import Distributed

if nw > 1
Distributed.addprocs(nw)
Distributed.addprocs(nw, exeflags=`--project=$(Base.active_project())`) # necessary due to issue #48217 in julialang
Distributed.@everywhere using FBCModelTests, FBCModelTests.Memote
Distributed.@everywhere @eval using $solver
end
Expand All @@ -59,4 +60,6 @@ optimizer = @eval $solver.Optimizer
@info "Initialization done, starting MEMOTE..." model_file optimizer nworkers

# run the Memote
Memote.run_tests(model_file, optimizer; workers=Distributed.workers())
Memote.run_tests_toplevel(model_file, optimizer; workers=Distributed.workers())
exit(0)

1 change: 1 addition & 0 deletions src/memote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using Test
using JuMP
using Distributed

include(joinpath("common.jl")) # quiet tests
include(joinpath("memote", "utils.jl")) # memote utils
include(joinpath("memote", "config.jl")) # memote test parameters
include.(
Expand Down
Loading

2 comments on commit 62635eb

@exaexa
Copy link
Collaborator Author

@exaexa exaexa commented on 62635eb May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/83835

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.5 -m "<description of version>" 62635eb1a38488caf6b5b2d2442b88bcb9318d5e
git push origin v0.2.5

Please sign in to comment.