Commit 67e24cc2 authored by Duggan, John's avatar Duggan, John
Browse files

Fix results processing

parent 9e99fc63
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ class PlotFastran:
    def load_fastran(self, fn_ncfile: Path) -> None:
        self.figure.clear()

        self.filename = Path("IPS Fastran output") / fn_ncfile
        self.filename = fn_ncfile
        self.fastran = netCDF4.Dataset(self.filename, "r", format="NETCDF4")
        self.basename = os.path.basename(self.filename)

+13 −5
Original line number Diff line number Diff line
@@ -58,22 +58,23 @@ class SuperfacilityTool:
            return

        self.job.update()
        print(f"Job state refreshed: {self.job.state}")

        match self.job.state:
            case JobState.RUNNING:
                self.model.execution.is_queued = False
                self.model.execution.is_running = True
            case JobState.COMPLETED:
                self.get_results()

                self.model.execution.is_queued = False
                self.model.execution.is_running = False
                self.model.execution.success = True

                self.get_results()

    def get_results(self) -> None:
        self.model.config.result_files = []

        remote_paths = self.perlmutter.ls(os.path.join(self.working_directory, "SUMMARY"), directory=True)
        remote_paths = self.perlmutter.ls(os.path.join(self.working_directory, "SUMMARY"))

        rmtree(self.output_directory, ignore_errors=True)
        os.makedirs(self.output_directory, exist_ok=True)
@@ -82,7 +83,10 @@ class SuperfacilityTool:
            contents = path.download(binary=True)

            with open(os.path.join(self.output_directory, name), "wb") as file_obj:
                file_obj.write(contents.read())
                data = contents.read()
                if isinstance(data, str):
                    data = data.encode("utf-8")
                file_obj.write(data)

            self.model.config.result_files.append(name)

@@ -101,7 +105,11 @@ class SuperfacilityTool:
        [remote_path] = self.perlmutter.ls(os.path.join(self.working_directory, path))
        file = remote_path.download()

        return file.read().decode("utf-8")
        data = file.read()
        if isinstance(data, bytes):
            return data.decode("utf-8")

        return data

    def refresh_output(self) -> None:
        if not self.job: