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

Helics on AWS: running an arbitrary script to start helics in different ways #3723

Merged
merged 19 commits into from
Feb 16, 2023
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
2 changes: 1 addition & 1 deletion aws/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ task deploy(type: AWSLambdaInvokeTask) {
"profiler_type": "${ext.getParameterValue('profiler_type')}",
"command": "deploy",
"run_grafana" : ${ext.getParameterValue('runGrafana') ?: false},
"cosimulation_shell_script" : ${ext.getParameterValue('cosimulationShellScript') ?: ""},
"cosimulation_shell_script": "${ext.getParameterValue('cosimulationShellScript')}",
"run_jupyter" : ${ext.getParameterValue('runJupyter') ?: false},
"jupyter_token" : "${ext.getParameterValue('jupyterToken') ?: UUID.randomUUID().toString()}",
"is_spot" : ${ext.getParameterValue('isSpot') ?: false},
Expand Down
21 changes: 13 additions & 8 deletions aws/src/main/python/beam_lambda/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,13 +828,21 @@ def get_mandatory_param(param_name):
if run_grafana:
selected_script = GRAFANA_RUN + selected_script

def fix_script_path(original_script_path):
fixed_path = original_script_path
for start_path in ['src/main/bash/','main/bash/', 'bash/']:
if original_script_path.startswith(start_path):
fixed_path = original_script_path[len(start_path):]

return f"/home/ubuntu/git/beam/src/main/bash/{fixed_path}"

if cosimulation_shell_script:
for start_path in ['src/main/bash','main/bash', 'bash']:
if cosimulation_shell_script.startswith(start_path):
cosimulation_shell_script = cosimulation_shell_script[len(start_path):]
fixed_script_path = fix_script_path(cosimulation_shell_script)
selected_script = f'sudo chmod +x {fixed_script_path}; sudo {fixed_script_path}; {selected_script}'

full_path_to_cosimulation_script = f"/home/ubuntu/git/beam/src/main/bash/{cosimulation_shell_script}"
selected_script = f'sudo chmod +x {full_path_to_cosimulation_script}; sudo {full_path_to_cosimulation_script}; {selected_script}'
if end_script != END_SCRIPT_DEFAULT:
fixed_script_path = fix_script_path(end_script)
end_script = f'sudo chmod +x {fixed_script_path}; sudo {fixed_script_path}'

params = configs
if s3_publish:
Expand All @@ -851,9 +859,6 @@ def get_mandatory_param(param_name):
selected_script = EXECUTE_SCRIPT
params = ['"{args}"'.format(args=execute_args)]

if end_script != END_SCRIPT_DEFAULT:
end_script = '/home/ubuntu/git/beam/sec/main/bash/' + end_script

txt = ''

init_ec2(region)
Expand Down
2 changes: 1 addition & 1 deletion gradle.deploy.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ s3Backup=true

# path to a shell script to start cosimulation, expected to be related to src/main/bash/
# for example: helics/run_pydss_federate.sh or helics/run_site_power_controller.sh
cosimulationShellScript=""
cosimulationShellScript=

# Run Jupyter Notebook together with BEAM
runJupyter=false
Expand Down
Loading