Batch Local Execution
The function local_model_loop can be used for batch execution of models on local machines. The example below shows a module called RunitLoop that allows the user to spawn multiple models as background processes. This involves a dictionary called `models
module RunitLoop
using EarthBox
function run_local_models()::Nothing
base_path = "/home/$(get_username())/apps/julia/EarthBox/models/extension_to_sfs"
models = Dict(
"$(base_path)/extension_strong_zones" => ["case1"],
"$(base_path)/extension_weak_fault" => ["case2"],
)
local_model_loop(
models = models,
run_model = true,
plot_markers = false,
plot_scalars = false,
istart = 1,
iend = 100
)
return nothing
end
function main()
run_local_models()
end
end # module
if abspath(PROGRAM_FILE) == @__FILE__
RunitLoop.main()
endLocal Model Loop
EarthBox.RunTools.local_model_loop — Function
local_model_loop(;
models::Dict{String, Vector{String}},
model_dir_path::String,
run_model::Union{Bool, Nothing} = nothing,
plot_markers::Union{Bool, Nothing} = nothing,
plot_scalars::Union{Bool, Nothing} = nothing,
istart::Union{Int64, Nothing} = nothing,
iend::Union{Int64, Nothing} = nothing
)Execute a script locally by looping over the function execute_remote_script_in_background for each model case.
!!! WARNING !!! This function is for Linux/Unix systems only.
Arguments
models::Dict{String, Vector{String}}- A dictionary of model directories containing
Model.jlandPlot.jlscripts and model case names like:- "/path/to/model_dir1" => ["case0", "case1", "case2"]
- "/path/to/model_dir2" => ["case3", "case4", "case5"]
- A dictionary of model directories containing
run_model::Union{Bool, Nothing}- Run the model (default: nothing)
plot_markers::Union{Bool, Nothing}- Plot markers (default: nothing)
plot_scalars::Union{Bool, Nothing}- Plot scalars (default: nothing)
istart::Union{Int64, Nothing}- Start index for plotting (default: nothing)
iend::Union{Int64, Nothing}- End index for plotting (default: nothing)