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

Add self check to hazard run check #471

Merged
merged 3 commits into from
Jun 19, 2024
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
4 changes: 4 additions & 0 deletions flood_adapt/dbs_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,10 @@ def has_run_hazard(self, scenario_name: str) -> None:
"""
scenario = self._scenarios.get(scenario_name)

# Dont do anything if the hazard model has already been run in itself
if scenario.direct_impacts.hazard.has_run_check():
return

simulations = list(
self.input_path.parent.joinpath("output", "Scenarios").glob("*")
)
Expand Down
8 changes: 3 additions & 5 deletions flood_adapt/object_model/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def initiate_root_logger(filename):
logging.getLogger("").setLevel(logging.INFO)

# Create a file handler and set the required logging level.
fh = logging.FileHandler(filename=filename, mode="w")
fh = logging.FileHandler(filename=filename, mode="a")
fh.setLevel(logging.DEBUG)

# Create a console handler and set the required logging level.
Expand Down Expand Up @@ -142,11 +142,9 @@ def close_root_logger_handlers():
# Get the root logger
root_logger = logging.getLogger("")

# Retrieve the handlers
handlers = root_logger.handlers

# Close and remove the handlers
for handler in handlers:
while len(root_logger.handlers) > 0:
handler = root_logger.handlers[0]
handler.close()
root_logger.removeHandler(handler)

Expand Down
Loading