Commit e33e931a authored by Duggan, John's avatar Duggan, John
Browse files

Explicitly provide the sshproxy key for now

parent 455422e7
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -6,5 +6,6 @@
        "tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true
    "python.testing.pytestEnabled": true,
    "python-envs.defaultEnvManager": "ms-python.python:system"
}
+1 −0
Original line number Diff line number Diff line
@@ -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):
+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

@@ -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()
+1 −1
Original line number Diff line number Diff line
@@ -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,
+4 −2
Original line number Diff line number Diff line
@@ -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")