Loading .gitignore +2 −0 Original line number Diff line number Diff line Loading @@ -170,3 +170,5 @@ junit.xml *.nc f0* g0* .results src/ips_fastran_gui/app/models/tool_implementations/local.py +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ class LocalTool: self.state = JobStatus() self.process: Optional[subprocess.Popen] = None self.working_directory = "" self.output_directory = "" def cancel(self) -> None: if not self.process: Loading Loading @@ -72,6 +73,7 @@ class LocalTool: os.path.dirname(self.model.resource_params.executable), f"run-{dt.now().isoformat()}" ) os.makedirs(self.working_directory, exist_ok=True) self.output_directory = os.path.join(self.working_directory, "output") self.copy_input_files(self.model.config.input_files) Loading src/ips_fastran_gui/app/models/tool_implementations/superfacility.py +31 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import json import os from shutil import rmtree from time import sleep, time from typing import Any, Dict, List, Optional Loading Loading @@ -35,6 +36,7 @@ class SuperfacilityTool: self.task_id = "" self.working_directory: Optional[str] = None self.output_directory = ".results" def _get_user_directory(self) -> None: self._refresh_token() Loading Loading @@ -94,7 +96,7 @@ class SuperfacilityTool: self.model.execution.is_running = False self.model.execution.success = True # TODO: self.get_results() self.get_results() return Loading @@ -104,6 +106,33 @@ class SuperfacilityTool: self.model.execution.is_queued = False self.model.execution.is_running = True def get_results(self) -> None: if not self.working_directory: return self.model.config.result_files = [] self._refresh_token() path = os.path.join(self.working_directory, "SUMMARY") response = self.session.get(f"https://api.nersc.gov/api/v1.2/utilities/ls/perlmutter/{path}") result = response.json() for entry in result.get("entries", []): name = entry.get("name", ".") if name in [".", ".."]: continue file_path = os.path.join(path, name) response = self.session.get(f"https://api.nersc.gov/api/v1.2/utilities/download/perlmutter/{file_path}") result = response.json() rmtree(self.output_directory, ignore_errors=True) os.makedirs(self.output_directory, exist_ok=True) with open(f"{self.output_directory}/{name}", "wb") as file_obj: file_obj.write(result["file"]) self.model.config.result_files.append(name) def get_submission_status(self) -> None: self._refresh_token() response = self.session.get(f"https://api.nersc.gov/api/v1.2/tasks/{self.task_id}") Loading Loading @@ -158,7 +187,7 @@ class SuperfacilityTool: else: self.get_job_status() if self.model.execution.is_running: if not self.model.execution.is_queued: self.model.execution.stdout = self.read_file("ips.out") self.model.execution.stderr = self.read_file("ips.err") Loading src/ips_fastran_gui/app/view_models/main_view_model.py +1 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ class MainViewModel: def update_figure(self) -> None: plotter = PlotFastran(self.figure, self.model.plot_json.input_params) plotter.load_fastran(Path(self.ips_fastran.tool.working_directory) / self.model.config.result_file) plotter.load_fastran(Path(self.ips_fastran.tool.output_directory) / self.model.config.result_file) plotter.set_page() self.figure_bind.update_in_view(None) Loading Loading
.gitignore +2 −0 Original line number Diff line number Diff line Loading @@ -170,3 +170,5 @@ junit.xml *.nc f0* g0* .results
src/ips_fastran_gui/app/models/tool_implementations/local.py +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ class LocalTool: self.state = JobStatus() self.process: Optional[subprocess.Popen] = None self.working_directory = "" self.output_directory = "" def cancel(self) -> None: if not self.process: Loading Loading @@ -72,6 +73,7 @@ class LocalTool: os.path.dirname(self.model.resource_params.executable), f"run-{dt.now().isoformat()}" ) os.makedirs(self.working_directory, exist_ok=True) self.output_directory = os.path.join(self.working_directory, "output") self.copy_input_files(self.model.config.input_files) Loading
src/ips_fastran_gui/app/models/tool_implementations/superfacility.py +31 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import json import os from shutil import rmtree from time import sleep, time from typing import Any, Dict, List, Optional Loading Loading @@ -35,6 +36,7 @@ class SuperfacilityTool: self.task_id = "" self.working_directory: Optional[str] = None self.output_directory = ".results" def _get_user_directory(self) -> None: self._refresh_token() Loading Loading @@ -94,7 +96,7 @@ class SuperfacilityTool: self.model.execution.is_running = False self.model.execution.success = True # TODO: self.get_results() self.get_results() return Loading @@ -104,6 +106,33 @@ class SuperfacilityTool: self.model.execution.is_queued = False self.model.execution.is_running = True def get_results(self) -> None: if not self.working_directory: return self.model.config.result_files = [] self._refresh_token() path = os.path.join(self.working_directory, "SUMMARY") response = self.session.get(f"https://api.nersc.gov/api/v1.2/utilities/ls/perlmutter/{path}") result = response.json() for entry in result.get("entries", []): name = entry.get("name", ".") if name in [".", ".."]: continue file_path = os.path.join(path, name) response = self.session.get(f"https://api.nersc.gov/api/v1.2/utilities/download/perlmutter/{file_path}") result = response.json() rmtree(self.output_directory, ignore_errors=True) os.makedirs(self.output_directory, exist_ok=True) with open(f"{self.output_directory}/{name}", "wb") as file_obj: file_obj.write(result["file"]) self.model.config.result_files.append(name) def get_submission_status(self) -> None: self._refresh_token() response = self.session.get(f"https://api.nersc.gov/api/v1.2/tasks/{self.task_id}") Loading Loading @@ -158,7 +187,7 @@ class SuperfacilityTool: else: self.get_job_status() if self.model.execution.is_running: if not self.model.execution.is_queued: self.model.execution.stdout = self.read_file("ips.out") self.model.execution.stderr = self.read_file("ips.err") Loading
src/ips_fastran_gui/app/view_models/main_view_model.py +1 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ class MainViewModel: def update_figure(self) -> None: plotter = PlotFastran(self.figure, self.model.plot_json.input_params) plotter.load_fastran(Path(self.ips_fastran.tool.working_directory) / self.model.config.result_file) plotter.load_fastran(Path(self.ips_fastran.tool.output_directory) / self.model.config.result_file) plotter.set_page() self.figure_bind.update_in_view(None) Loading