Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions examples/exec_scripts/exec_mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
Command formed: ansys.exe -b -i <inp_file> -o <out_file> -np 4

"""

import json
import os
import subprocess

Expand All @@ -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)
Expand Down Expand Up @@ -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")
9 changes: 3 additions & 6 deletions examples/exec_scripts/exec_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

Command formed: python <script_file> <input_file>
"""

import json
import os
import subprocess

Expand All @@ -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)
Expand Down Expand Up @@ -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")