From 211632e13bf31877cee6158a80d54ad9be9ca47a Mon Sep 17 00:00:00 2001 From: ojkoenig Date: Thu, 18 Aug 2022 22:37:44 +0200 Subject: [PATCH] Add log messages in execution scripts --- examples/exec_scripts/exec_mapdl.py | 9 +++------ examples/exec_scripts/exec_python.py | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/examples/exec_scripts/exec_mapdl.py b/examples/exec_scripts/exec_mapdl.py index a4ce048c5..a1e3507b3 100644 --- a/examples/exec_scripts/exec_mapdl.py +++ b/examples/exec_scripts/exec_mapdl.py @@ -4,8 +4,6 @@ Command formed: ansys.exe -b -i -o -np 4 """ - -import json import os import subprocess @@ -16,10 +14,7 @@ class MAPDLExecution(ApplicationExecution): def execute(self): - # Dump whole context to file for debugging - context_d = json.dumps(vars(self.context), indent=4, default=str) - with open("context.txt", "w") as f: - f.write(context_d) + log.info("Start MAPDL execution script") # Identify files inp_file = next((f for f in self.context.input_files if f["name"] == "inp"), None) @@ -50,3 +45,5 @@ def execute(self): # Execute command log.info(f"Executing: {cmd}") subprocess.run(cmd, shell=True, check=True, env=env) + + log.info("End MAPDL execution script") diff --git a/examples/exec_scripts/exec_python.py b/examples/exec_scripts/exec_python.py index 93afcc7bd..182ef6f3f 100644 --- a/examples/exec_scripts/exec_python.py +++ b/examples/exec_scripts/exec_python.py @@ -3,8 +3,6 @@ Command formed: python """ - -import json import os import subprocess @@ -15,10 +13,7 @@ class PythonExecution(ApplicationExecution): def execute(self): - # Dump whole context to file for debugging - context_d = json.dumps(vars(self.context), indent=4, default=str) - with open("context.txt", "w") as f: - f.write(context_d) + log.info("Start Python execution script") # Identify files script_file = next((f for f in self.context.input_files if f["name"] == "script"), None) @@ -49,3 +44,5 @@ def execute(self): # Execute log.info(f"Executing: {cmd}") subprocess.run(cmd, shell=True, check=True, env=env) + + log.info("End Python execution script")