Loading .vscode/settings.json +2 −1 Original line number Diff line number Diff line Loading @@ -6,5 +6,6 @@ "tests" ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true "python.testing.pytestEnabled": true, "python-envs.defaultEnvManager": "ms-python.python:system" } src/ips_fastran_gui/app/models/main_model.py +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ class Config(BaseModel): # SSH Proxy filesystem parameters username: str = Field(default="", title="NERSC Username") sshproxy_key: str = Field(default="", title="NERSC sshproxy Key") class Execution(BaseModel): Loading src/ips_fastran_gui/app/models/tool_implementations/superfacility.py +14 −1 Original line number Diff line number Diff line """Tool class for running via the Superfacility API.""" import os import tempfile from shutil import rmtree from typing import Any, Dict Loading Loading @@ -87,12 +88,24 @@ class SuperfacilityTool: self.model.config.result_files.append(name) def read_files(self, local_directory: str) -> None: self.perlmutter_fs = filesystem("ssh", host="dtn.nersc.gov") tmp = tempfile.NamedTemporaryFile("w", delete=False) tmp.write(self.model.config.sshproxy_key) tmp.flush() tmp.close() self.perlmutter_fs = filesystem( "ssh", host="dtn.nersc.gov", username=self.model.config.username, client_keys=[tmp.name], ) self.perlmutter_fs.makedirs("ips-fastran-gui", exist_ok=True) for remote_file in self.perlmutter_fs.ls("ips-fastran-gui") + self.perlmutter_fs.ls("ips-fastran-gui/input"): local_path = remote_file.replace("ips-fastran-gui", local_directory) self.perlmutter_fs.get(remote_file, local_path) os.remove(tmp.name) def read_file(self, path: str) -> str: with self.perlmutter_fs.open(os.path.join(self.working_directory, path), "r") as file_obj: return file_obj.read() Loading src/ips_fastran_gui/app/view_models/main_view_model.py +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ class MainViewModel: self.view_state = ViewState() self.figure = Figure(figsize=(8.0, 4.0)) self.local_directory = f"/tmp/{uuid4()}" self.local_directory = f"/tmp/{uuid4()}/ips-fastran-configuration" os.makedirs(self.local_directory) # here we create a bind that connects ViewModel with View. It returns a communicator object, Loading src/ips_fastran_gui/app/views/tabs/config_tab.py +4 −2 Original line number Diff line number Diff line Loading @@ -23,5 +23,7 @@ class ConfigTab: InputField(v_model="config.run_location", type="select") InputField(v_model="config.input_file_method", type="select") with VBoxLayout(v_if="config.run_location.includes('Perlmutter')"): with VBoxLayout(v_if="config.run_location.includes('Perlmutter')", stretch=True): with VBoxLayout(): InputField(v_model="config.username") InputField(v_model="config.sshproxy_key", type="textarea") Loading
.vscode/settings.json +2 −1 Original line number Diff line number Diff line Loading @@ -6,5 +6,6 @@ "tests" ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true "python.testing.pytestEnabled": true, "python-envs.defaultEnvManager": "ms-python.python:system" }
src/ips_fastran_gui/app/models/main_model.py +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ class Config(BaseModel): # SSH Proxy filesystem parameters username: str = Field(default="", title="NERSC Username") sshproxy_key: str = Field(default="", title="NERSC sshproxy Key") class Execution(BaseModel): Loading
src/ips_fastran_gui/app/models/tool_implementations/superfacility.py +14 −1 Original line number Diff line number Diff line """Tool class for running via the Superfacility API.""" import os import tempfile from shutil import rmtree from typing import Any, Dict Loading Loading @@ -87,12 +88,24 @@ class SuperfacilityTool: self.model.config.result_files.append(name) def read_files(self, local_directory: str) -> None: self.perlmutter_fs = filesystem("ssh", host="dtn.nersc.gov") tmp = tempfile.NamedTemporaryFile("w", delete=False) tmp.write(self.model.config.sshproxy_key) tmp.flush() tmp.close() self.perlmutter_fs = filesystem( "ssh", host="dtn.nersc.gov", username=self.model.config.username, client_keys=[tmp.name], ) self.perlmutter_fs.makedirs("ips-fastran-gui", exist_ok=True) for remote_file in self.perlmutter_fs.ls("ips-fastran-gui") + self.perlmutter_fs.ls("ips-fastran-gui/input"): local_path = remote_file.replace("ips-fastran-gui", local_directory) self.perlmutter_fs.get(remote_file, local_path) os.remove(tmp.name) def read_file(self, path: str) -> str: with self.perlmutter_fs.open(os.path.join(self.working_directory, path), "r") as file_obj: return file_obj.read() Loading
src/ips_fastran_gui/app/view_models/main_view_model.py +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ class MainViewModel: self.view_state = ViewState() self.figure = Figure(figsize=(8.0, 4.0)) self.local_directory = f"/tmp/{uuid4()}" self.local_directory = f"/tmp/{uuid4()}/ips-fastran-configuration" os.makedirs(self.local_directory) # here we create a bind that connects ViewModel with View. It returns a communicator object, Loading
src/ips_fastran_gui/app/views/tabs/config_tab.py +4 −2 Original line number Diff line number Diff line Loading @@ -23,5 +23,7 @@ class ConfigTab: InputField(v_model="config.run_location", type="select") InputField(v_model="config.input_file_method", type="select") with VBoxLayout(v_if="config.run_location.includes('Perlmutter')"): with VBoxLayout(v_if="config.run_location.includes('Perlmutter')", stretch=True): with VBoxLayout(): InputField(v_model="config.username") InputField(v_model="config.sshproxy_key", type="textarea")