Skip to content

Commit 1524e3d

Browse files
authored
Merge pull request #1463 from CliMA/js/detect-restart
add option detect_restart_files
2 parents eeb4790 + 2f16b21 commit 1524e3d

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ ClimaCoupler.jl Release Notes
66

77
### ClimaCoupler features
88

9+
#### Add option `detect_restart_files` PR[#1463](https://github.com/CliMA/ClimaCoupler.jl/pull/1463)
10+
Add a CLI option to signal whether restart files should be automatically used
11+
to restart a simulation. This is true by default, but can be set to false if a
12+
user wishes to run a simulation from the beginning, ignoring present restart files.
13+
14+
915
#### Remove ED/EDMF aquaplanet longruns PR[#1461](https://github.com/CliMA/ClimaCoupler.jl/pull/1461)
1016
Removes the ED-only and diag. EDMF aquaplanet longruns.
1117
These can be run manually as needed for debugging, rather than running every week.

config/ci_configs/amip_coarse_ft64_hourly_checkpoints_restart.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply_limiter: false
22
checkpoint_dt: "400secs"
33
co2_model: "maunaloa"
4+
detect_restart_files: true
45
energy_check: false
56
h_elem: 6
67
mode_name: "amip"

experiments/ClimaEarth/cli_options.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ function argparse_settings()
8888
arg_type = Bool
8989
default = true
9090
# Restart information
91+
"--detect_restart_files"
92+
help = "Boolean flag indicating whether to automatically use restart files if available [`false` (default), `true`]"
93+
arg_type = Bool
94+
default = false
9195
"--restart_dir"
9296
help = "Directory containing restart files"
9397
arg_type = String

experiments/ClimaEarth/setup_run.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function CoupledSimulation(config_dict::AbstractDict)
115115
share_surface_space,
116116
saveat,
117117
checkpoint_dt,
118+
detect_restart_files,
118119
restart_dir,
119120
restart_t,
120121
use_land_diagnostics,
@@ -164,7 +165,7 @@ function CoupledSimulation(config_dict::AbstractDict)
164165

165166
isnothing(restart_t) && (restart_t = Checkpointer.t_start_from_checkpoint(dir_paths.checkpoints))
166167
isnothing(restart_dir) && (restart_dir = dir_paths.checkpoints)
167-
should_restart = !isnothing(restart_t) && !isnothing(restart_dir)
168+
should_restart = detect_restart_files && !isnothing(restart_t) && !isnothing(restart_dir)
168169
if should_restart
169170
if t_start isa ITime
170171
t_start, _ = promote(ITime(restart_t), t_start)

experiments/ClimaEarth/test/restart.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ println("Simulating four steps, options from command line")
5858
four_steps_reading = deepcopy(four_steps)
5959

6060
four_steps_reading["t_end"] = "900secs"
61+
four_steps_reading["detect_restart_files"] = true
6162
four_steps_reading["restart_dir"] = cs_four_steps.dirs.checkpoints
6263
four_steps_reading["restart_t"] = 720
6364
four_steps_reading["job_id"] = "four_steps_reading"
@@ -85,6 +86,7 @@ cs_two_steps1 = setup_and_run(two_steps)
8586
println("Reading and simulating last two steps")
8687
# Two additional steps
8788
two_steps["t_end"] = "720secs"
89+
two_steps["detect_restart_files"] = true
8890
cs_two_steps2 = setup_and_run(two_steps)
8991

9092
@testset "Restarts" begin

experiments/ClimaEarth/user_io/arg_parsing.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function get_coupler_args(config_dict::Dict)
9898
checkpoint_dt = config_dict["checkpoint_dt"]
9999

100100
# Restart information
101+
detect_restart_files = config_dict["detect_restart_files"]
101102
restart_dir = config_dict["restart_dir"]
102103
restart_t = config_dict["restart_t"]
103104

@@ -138,6 +139,7 @@ function get_coupler_args(config_dict::Dict)
138139
share_surface_space,
139140
saveat,
140141
checkpoint_dt,
142+
detect_restart_files,
141143
restart_dir,
142144
restart_t,
143145
use_coupler_diagnostics,

0 commit comments

Comments
 (0)