Skip to content

Commit

Permalink
Merge branch 'main' into test_same_node_id
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Mar 27, 2024
2 parents 0229364 + 1b784c3 commit 571aff2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mypy-ribasim-qgis = "mypy ribasim_qgis"
ribasim-core = { cmd = "julia --project=core -e 'using Ribasim; Ribasim.main(ARGS)'", depends_on = [
"initialize-julia",
] }
ribasim-core-testmodels = { cmd = "julia --project utils/testmodelrun.jl", depends_on = [
ribasim-core-testmodels = { cmd = "julia --project --threads=4 utils/testmodelrun.jl", depends_on = [
"generate-testmodels",
"initialize-julia",
] }
Expand Down
22 changes: 12 additions & 10 deletions utils/testmodelrun.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Ribasim
import Ribasim

include("utils.jl")

Expand All @@ -7,21 +7,23 @@ function main(ARGS)
n_model = length(toml_paths)
n_pass = 0
n_fail = 0
lk = ReentrantLock()
failed = String[]

for toml_path in toml_paths
Threads.@threads for toml_path in toml_paths
modelname = basename(dirname(toml_path))
@info "Running model $modelname"
if Ribasim.main(toml_path) != 0
@error "Simulation failed" modelname
push!(failed, modelname)
n_fail += 1
else
n_pass += 1
ret_code = Ribasim.main(toml_path)
lock(lk) do
if ret_code != 0
push!(failed, modelname)
n_fail += 1
else
n_pass += 1
end
end
end

@info "Ran $n_model models, $n_pass passed, $n_fail failed."
println("Ran $n_model models, $n_pass passed, $n_fail failed.\n")
if n_fail > 0
println("Failed models:")
foreach(println, failed)
Expand Down

0 comments on commit 571aff2

Please sign in to comment.