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

[BUGFIX] Create outputs folder in examples to avoid error when output file does not exist #93

Merged
merged 2 commits into from
Mar 26, 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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ hercules/local_amr_wind_demo/sample_copy.nc
# Some output files to ignore
t_00*
logdummy
loghercules
logstandin
logfloris
loghercules*
logstandin*
logfloris*
*echo
*out-example.json

Expand Down
1 change: 1 addition & 0 deletions example_case_folders/02_amr_wind_standin_only/bash_script.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ conda activate hercules
export HELICS_PORT=32000

#make sure you use the same port number in the amr_input.inp and hercules_input_000.yaml files.
rm loghercules logstandin

# Set up the helics broker
helics_broker -t zmq -f 2 --loglevel="debug" --local_port=$HELICS_PORT &
Expand Down
3 changes: 1 addition & 2 deletions hercules/amr_wind_standin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

# Set up the logger
# Useful for when running on eagle
Path("outputs").mkdir(parents=True, exist_ok=True)
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s",
Expand Down Expand Up @@ -114,8 +115,6 @@ def read_amr_wind_input(amr_wind_input):

class AMRWindStandin(FederateAgent):
def __init__(self, config_dict, amr_wind_input, amr_standin_data_file=None):
# Ensure outputs folder exists
Path("outputs").mkdir(parents=True, exist_ok=True)

super(AMRWindStandin, self).__init__(
name=config_dict["name"],
Expand Down
1 change: 1 addition & 0 deletions hercules/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

LOGFILE = str(dt.datetime.now()).replace(":", "_").replace(" ", "_").replace(".", "_")

Path("outputs").mkdir(parents=True, exist_ok=True)

class Emulator(FederateAgent):
def __init__(self, controller, py_sims, input_dict):
Expand Down
Loading