Skip to content

Commit

Permalink
Merge pull request #106 from gaelforget/v0p2p19b
Browse files Browse the repository at this point in the history
V0p2p19b
  • Loading branch information
gaelforget committed Aug 15, 2023
2 parents 2ee1931 + c5006be commit 37842da
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClimateModels"
uuid = "f6adb021-9183-4f40-84dc-8cea6f651bb0"
authors = ["gaelforget <gforget@mit.edu>"]
version = "0.2.18"
version = "0.2.19"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
3 changes: 2 additions & 1 deletion docs/src/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ launch
log
```

Also provided : [`pathof`](@ref), [`readdir`](@ref), [`show`](@ref), [`clean`](@ref), and [`@ModelRun`](@ref)
Also provided : [`pathof`](@ref), [`joinpath`](@ref), [`readdir`](@ref), [`show`](@ref), [`clean`](@ref), and [`@ModelRun`](@ref)

## [Notebook Methods](@id notebook_methods)

Expand All @@ -52,6 +52,7 @@ ModelRun

```@docs
pathof
joinpath
readdir
show
clean
Expand Down
14 changes: 8 additions & 6 deletions src/ClimateModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ module ClimateModels
using UUIDs, Suppressor, OrderedCollections
using Pkg, Git, TOML, NetCDF

include("interface.jl")
include("notebooks.jl")
include("toy_models.jl")

import .notebooks: update

export AbstractModelConfig, ModelConfig, PlutoConfig
export ModelRun, @ModelRun, PkgDevConfig
export clean, build, compile, setup, launch, notebooks
export clean, build, compile, setup, launch, update, notebooks
export put!, take!, pathof, readdir, log
#export git_log_init, git_log_msg, git_log_fil
#export git_log_prm, git_log_show
#export monitor, help, pause
#export train, compare, analyze
export RandomWalker

export OrderedDict, UUID, uuid4, @suppress #should be commented out?

include("interface.jl")
include("notebooks.jl")
include("toy_models.jl")
#export OrderedDict, UUID, uuid4, @suppress

end
16 changes: 12 additions & 4 deletions src/interface.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import Base: put!, take!, pathof, readdir, log, run
import Base: put!, take!, pathof, joinpath, readdir, log, run

abstract type AbstractModelConfig end

Expand Down Expand Up @@ -96,17 +96,25 @@ PkgDevConfig(url::String,func::Function,inputs::NamedTuple) =
"""
pathof(x::AbstractModelConfig)
Returns the run directory path for x ; i.e. joinpath(x.folder,string(x.ID))
Returns the run directory path for x ; i.e. `joinpath(x.folder,string(x.ID))`
"""
pathof(x::AbstractModelConfig) = joinpath(x.folder,string(x.ID))


"""
pathof(x::AbstractModelConfig,subfolder::String)
Same as pathof(joinpath(x,subfolder)).
Same as `pathof(joinpath(x,subfolder))` or `joinpath(pathof(x),subfolder)`
"""
pathof(x::AbstractModelConfig,subfolder::String) = joinpath(pathof(x),subfolder)
pathof(x::AbstractModelConfig,subfolder...) = joinpath(x,subfolder...)


"""
joinpath(x::AbstractModelConfig,y...)
Same as `joinpath(pathof(x),y...)`
"""
joinpath(x::AbstractModelConfig,y...) = joinpath(pathof(x),y...)

"""
readdir(x::AbstractModelConfig)
Expand Down
4 changes: 3 additions & 1 deletion src/notebooks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ function notebook_launch(MC::PlutoConfig)
Pkg.instantiate()

try
include("main.jl")
run(`julia --project=. main.jl`)
write("aok.txt","main.jl seems to have run aok")
catch e
write("fail.txt","main.jl seems to have FAILED")
tmp[1]="model run may have failed"
end

Expand Down

0 comments on commit 37842da

Please sign in to comment.