Create an abstraction for the SSH connection to the data store#330
Create an abstraction for the SSH connection to the data store#330danielolsen merged 4 commits intodevelopfrom
Conversation
2cb6b63 to
75ebf14
Compare
|
I have tested this end-to-end. Scenarios can be created, prepared, launched, extracted, and deleted successfully. |
BainanXia
left a comment
There was a problem hiding this comment.
An integration test as @danielolsen did on my end has been passed. One minor thing to mention: with the current implementation, every time we check status of a scenario, a copy_from of the file 'ExecuteList.csv' is ran. The logic behind this is here as pointed out by @danielolsen . One concern is if the file grows big in the future, we may allow the user to choose whether download a fresh copy of the most up-to-date version of the table or simply check the status of a specific entry from the table on the server that the user is interested in at that time. This is definitely out of the scope of this PR.
|
Another dream feature: a simple interface to clear the |
We can have in your object a clean_data method that uses the os library to rm -rf in ScenarioData Then: s.data_access.clean_data() |
|
Outside of a docker container, I'd be concerned about the |
|
@danielolsen Is the clear cache feature mandate or optional? Sometimes, we would like to keep those files for fast access. It would be great to have keyword (scenario number)options in the file names that we would like to remove (I'm just sitting here and dreaming ;)). |
You need to invoke it. |
|
@BainanXia It is a method that is never called in our codebase. Just a convenient helper function. |
|
If it's optional, I suppose that's alright. It'd be sad to hear from people that our code unexpectedly removed files |
8182c30 to
90ab9f9
Compare
90ab9f9 to
679094c
Compare
Purpose
Create an abstraction for data transfer between userspace and a central 'data store'. Previously, we had one data store on a remote server, which we interact with via a SSH connection, but we want to abstract this to be able to easily handle either a remote data store or a local one. See https://github.com/Breakthrough-Energy/RenewableEnergyProject/issues/318
What the code is doing
powersimdata/utility/transfer_data.py: creating a new abstractDataAccessclass and aSSHDataAccessclass that implements the methods needed to interact with the server.powersimdata/scenario/scenario.py, refactoring the Scenario object to init with aSSHDataAccessobject, rather than a direct SSH connection. This sets us up for a logic branch in the init to use either theSSHDataAccessobject or the planned local equivalent, with the method of controlling which one gets created TBD (environment variable, configuration file, etc).DataAccessobject and use its methods rather than accepting an SSH connection object.powersimdata/input/input_data.pypowersimdata/input/transform_profile.pypowersimdata/output/output_data.pypowersimdata/scenario/analyze.pypowersimdata/scenario/create.pypowersimdata/scenario/delete.pypowersimdata/scenario/execute.pypowersimdata/scenario/move.pypowersimdata/scenario/state.pypowersimdata/input/tests/test_transform_profile.pypowersimdata/utility/tests/test_transfer_data.pyTesting
Existing unit tests pass when calling
python -m pytest -m "not db"(this includes "integration"-marked tests). End-to-end tests will be performed once we merge/rebase the changes to theScenarioListManagerandExecuteListManagerinto this branch.Time estimate
Half an hour. The changes are mostly small, but they are in a lot of different places. We may also want to re-organize things, since much of what's currently in
powersimdata/utilitycould maybe fit more logically inpowersimdata/data_access.