Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve_network: add customisable logging frequency #1521

Merged
merged 4 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ solving:
rtol: 0.01

mem_mb: 30000 #memory in MB; 20 GB enough for 50+B+I+H2; 100 GB for 181+B+I+H2
memory_logging_frequency: 30 # in seconds
runtime: 6h #runtime in humanfriendly style https://humanfriendly.readthedocs.io/en/latest/


Expand Down
1 change: 1 addition & 0 deletions doc/configtables/solving.csv
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ solver,,,
-- options,--,Key listed under ``solver_options``.,Link to specific parameter settings.
solver_options,,dict,Dictionaries with solver-specific parameter settings.
mem,MB,int,Estimated maximum memory requirement for solving networks.
mem_logging_frequency,s,int,Interval in seconds at which memory usage is logged.
5 changes: 4 additions & 1 deletion scripts/solve_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,11 @@ def solve_network(n, config, params, solving, **kwargs):
co2_sequestration_potential=snakemake.params["co2_sequestration_potential"],
)

logging_frequency = snakemake.config.get("solving", {}).get(
"mem_logging_frequency", 30
)
with memory_logger(
filename=getattr(snakemake.log, "memory", None), interval=30.0
filename=getattr(snakemake.log, "memory", None), interval=logging_frequency
) as mem:
n = solve_network(
n,
Expand Down
Loading