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

feat: support passing extract_data for container and local simulations #525

Merged
merged 3 commits into from
Jul 27, 2021

Conversation

jenhagg
Copy link
Collaborator

@jenhagg jenhagg commented Jul 15, 2021

Purpose

Changes corresponding to Breakthrough-Energy/REISE.jl#146. This exposes the extract-data parameter to a user who is interacting via the scenario object.

What the code is doing

The extract_data parameter is already part of the signature, but needed to be passed to REISE.jl. Also add implementations for extract_simulation_output so it can be called when using docker or local installation.

Testing

Launched a simulation using docker and natively, with and without extract_data set.

Time estimate

10 min

@jenhagg jenhagg self-assigned this Jul 15, 2021
@jenhagg jenhagg requested review from ahurli and rouille July 15, 2021 22:58
@@ -195,18 +218,28 @@ def _launch(self, threads=None, solver=None, extract_data=True):
:return: (*dict*) -- contains "output", "errors", "scenario_id", and "status"
keys which map to stdout, stderr, and the respective scenario attributes
"""
sys.path.append(server_setup.ENGINE_DIR)
from pyreisejl.utility import app
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We assume here that the engine is REISE.jl, which is fine for now. In the future, we might have other engines and we will have to access their own utility functions

Copy link
Collaborator

@rouille rouille Jul 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move the import statement in the constructor and and have a app attribute so we can do self.app.launch_simulation(...), self.app.extract_scenario(...) and self.app.check_progress(...) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use importlib.import_module to assign it? Not sure if there is another way. I tried just moving the import statement to the constructor as-is, but that resulted in an import error.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to avoid to have the same import statement in each function. If it is too complicated or what you propose generate more lines, let's move forward with the current implementation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Usually prefer the standard imports since they can be detected by refactoring tools, etc, but this use case is not too bad, and already a bit "non standard".

Copy link
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jenhagg jenhagg merged commit 0619697 into develop Jul 27, 2021
@jenhagg jenhagg deleted the jon/extract branch July 27, 2021 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants