from .launcher import run_study
from .genjobwindow import GenJobDialog
-from PyQt5.QtWidgets import QFileDialog
+from PyQt5.QtWidgets import QFileDialog, QMessageBox, QPlainTextEdit
def create_case_study():
EficasForRunStudyAppli()
def run_selected_case_study():
param_dict = get_params_from_selected_case()
- run_study(param_dict)
+
+ QMessageBox.Information(view, view.tr("Information"),
+ view.tr("The job is running."))
+ listing = run_study(param_dict)
+
+ # Display listing
+ dspl_listing = QPlainTextEdit(view)
+ dspl_listing.setReadOnly(True)
+
+ dspl_listing.setPlainText(tmp)
+
+ dspl_listing.show()
def generate_job_for_selected_case_study():
param_dict = get_params_from_selected_case()
orig_steering = f.read()
orig_steering_lines = orig_steering.split("\n")
- cmd = "set -x ; "
+ #TODO: replace by call to Telemac Python (import runcode.py) ? for windows compatibility
+
# Run the code itself
code = param_dict["CODE"]
- cmd += "cd %s && runcode.py -w %s %s %s" % \
- (steering_file_dir, wrkdir, code, steering_filepath)
- cmd += " ; rc=$?"
+ listing_name = "run.log"
+ listing = os.path.join(steering_file_dir, '..', listing_name)
+ cmd = "runcode.py {code} {steering_filepath}" \
+ .format(steering_file_dir=steering_file_dir,
+ code=code,
+ steering_filepath=os.path.basename(steering_filepath),
+ listing=listing_name)
- # Cleanup intermediate files if the computation was successful
- cmd += " ; if test $rc -eq 0; then rm -rf %s ; fi" % " ".join(interm_files)
+ # Launch the command
+ logger.debug("Running the following command in salome shell in %s: %s", wrkdir, cmd)
+ log = subprocess.check_output(cmd, cwd=wrkdir, shell=True)
- cmd += ' ; echo "return code is $rc"'
+ return log.decode('utf-8')
- # Launch the command
- logger.debug("Running the following command in xterm: %s" % cmd)
- args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "-hold", "-l", "-e", cmd]
- if 'batchExec' in param_dict:
- if param_dict['batchExec'] == True:
- args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "+hold", "-l", "-e", cmd]
- subprocess.Popen(args, cwd = wrkdir)
def check_file_or_create_link(filepath, dirpath, interm_file_list = None):
"""