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

REWET-PyReCoDes #310

Merged
merged 16 commits into from
Sep 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
56 changes: 16 additions & 40 deletions modules/Workflow/whale/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1507,27 +1507,33 @@ def augment_asset_files(self): # noqa: C901
return assetFilesList # noqa: DOC201, RUF100

def perform_system_performance_assessment(self, asset_type):
"""For an asset type run the system level performance assessment application
"""Run the system level performance assessment application.

Longer description
For an asset type run the system level performance assessment
application.

Parameters
----------
asset_type: string
Asset type to run perform system assessment of

""" # noqa: D400
if 'SystemPerformance' in self.workflow_apps.keys(): # noqa: SIM118
"""
# Make sure that we are in the run directory before we run REWET
# Every other path will be relative to the Run Directory (result dir)
os.chdir(self.run_dir)

# Check if system performance is requested
if 'SystemPerformance' in self.workflow_apps:
performance_app = self.workflow_apps['SystemPerformance'][asset_type]
else:
log_msg(
f'No Performance application to run for asset type: {asset_type}.',
prepend_timestamp=False,
)
log_div()
return False # noqa: DOC201, RUF100
return False

if performance_app.rel_path == None: # noqa: E711
if performance_app.rel_path is None:
log_msg(
f'No Performance application to run for asset type: {asset_type}.',
prepend_timestamp=False,
Expand All @@ -1536,8 +1542,7 @@ def perform_system_performance_assessment(self, asset_type):
return False

log_msg(
'Performing System Performance Application for asset type: '
+ asset_type,
f'Performing System Performance Application for asset type: {asset_type}',
prepend_timestamp=False,
)
log_div()
Expand All @@ -1550,18 +1555,13 @@ def perform_system_performance_assessment(self, asset_type):
# defaults added to a system performance app are asset_type, input_dir and running_parallel (default False)
#

# app_command_list.append('--asset_type')
# app_command_list.append(asset_type)
app_command_list.append('--input')
app_command_list.append(self.input_file)
# app_command_list.append('--working_dir')
# app_command_list.append(self.working_dir)

# Sina added this part for parallel run in REWET
if self.parType == 'parSETUP':
log_msg(
'\nParallel settings for System Performance for asset type:'
+ asset_type,
f'\nParallel settings for System Performance for asset type:{asset_type}',
prepend_timestamp=False,
)
app_command_list.append('--par')
Expand All @@ -1583,34 +1583,10 @@ def perform_system_performance_assessment(self, asset_type):
)

log_msg(
'System Performance Application Completed for asset type: ' + asset_type,
f'System Performance Application Completed for asset type: {asset_type}',
prepend_timestamp=False,
)

# end of Sina's odifications for parallel run

# if (self.parType == 'parSETUP'):

# log_msg('\nWriting System Performance application for asset type:' + asset_type, prepend_timestamp=False)
# self.parCommandFile.write("\n# Writing System Performance application for asset type:" + asset_type +"\n")

# if performance_app.runsParallel == False:
# self.parCommandFile.write(command + "\n")
# else:
# self.parCommandFile.write(self.mpiExec + " -n " + str(self.numProc) + " " + command + " --running_parallel True\n")

# else:

# log_msg('\n{}\n'.format(command), prepend_timestamp=False,
# prepend_blank_space=False)

# result, returncode = run_command(command)

# log_msg('Output: ', prepend_timestamp=False, prepend_blank_space=False)
# log_msg('\n{}\n'.format(result), prepend_timestamp=False, prepend_blank_space=False)

# log_msg('System Performance Application Completed for asset type: ' + asset_type, prepend_timestamp=False)

log_div()
return True

Expand Down Expand Up @@ -2870,7 +2846,7 @@ def aggregate_results( # noqa: C901, PLR0912, PLR0915
bldg_dir = Path(os.path.dirname(asst_data[a_i]['file'])).resolve() # noqa: PTH120
main_dir = bldg_dir
assetTypeHierarchy = [bldg_dir.name] # noqa: N806
while main_dir.parent.name != self.run_dir.name:
while main_dir.parent.name != 'Results':
main_dir = bldg_dir.parent
assetTypeHierarchy = [main_dir.name] + assetTypeHierarchy # noqa: N806, RUF005

Expand Down
Loading
Loading