Skip to content

Commit

Permalink
fixes to run
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Sep 29, 2023
1 parent ecf9a0a commit ba4e377
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/simulation/hdf_simulation_store.jl
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ function write_result!(
output_cache = get_output_cache(store.cache, model_name, key)
cur_size = get_size(store.cache)

Check warning on line 596 in src/simulation/hdf_simulation_store.jl

View check run for this annotation

Codecov / codecov/patch

src/simulation/hdf_simulation_store.jl#L595-L596

Added lines #L595 - L596 were not covered by tests

add_result!(output_cache, index, data.data, is_full(store.cache, cur_size))
add_result!(output_cache, index, permutedims(data.data, (3, 1, 2)), is_full(store.cache, cur_size))

Check warning on line 598 in src/simulation/hdf_simulation_store.jl

View check run for this annotation

Codecov / codecov/patch

src/simulation/hdf_simulation_store.jl#L598

Added line #L598 was not covered by tests

if get_dirty_size(output_cache) >= get_min_flush_size(store.cache)
discard = !should_keep_in_cache(output_cache)

Check warning on line 601 in src/simulation/hdf_simulation_store.jl

View check run for this annotation

Codecov / codecov/patch

src/simulation/hdf_simulation_store.jl#L600-L601

Added lines #L600 - L601 were not covered by tests
Expand Down
11 changes: 9 additions & 2 deletions src/simulation/optimization_output_cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ end
"""
Add result to the cache.
"""
function add_result!(cache::OptimizationOutputCache, timestamp, array, system_cache_is_full)
function add_result!(cache::OptimizationOutputCache,
timestamp::Dates.DateTime,
array::Array{Float64},
system_cache_is_full::Bool)
if cache.size_per_entry == 0
cache.size_per_entry = length(array) * sizeof(first(array))
end
Expand All @@ -77,7 +80,11 @@ function add_result!(cache::OptimizationOutputCache, timestamp, array, system_ca
return cache.size_per_entry
end

function _add_result!(cache::OptimizationOutputCache, timestamp, data)
function _add_result!(
cache::OptimizationOutputCache,
timestamp::Dates.DateTime,
data::Array{Float64},
)
cache.data[timestamp] = data
push!(cache.dirty_timestamps, timestamp)
return
Expand Down

0 comments on commit ba4e377

Please sign in to comment.