From: PASCALE NOYRET Date: Mon, 10 Oct 2022 14:07:33 +0000 (+0200) Subject: modif pour lancement dans un viewTexte X-Git-Tag: merge_uncertainty_odysee_1210~2^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=16463adb938ba9d04dc19b6fefff4650ffa4b0b7;p=tools%2Feficas.git modif pour lancement dans un viewTexte --- diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index 354ddc61..ff585f47 100755 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -31,7 +31,7 @@ import traceback from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog, QApplication, QSplitter, QLabel from PyQt5.QtGui import QPalette -from PyQt5.QtCore import QProcess, QFileInfo, QTimer, Qt, QDir, QSize +from PyQt5.QtCore import QProcess, QFileInfo, QTimer, Qt, QDir, QSize, QProcessEnvironment import traceback @@ -206,21 +206,27 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): noeudAvantCommentaire.addComment(True) - #----------------------------------------------------------------------------# - def _viewTextExecute(self, txt, prefix, suffix, fichierExe=None, shell='sh'): - #---------------------------------------------------------------------------# + #-----------------------------------------------------------------------------------------------# + def _viewTextExecute(self, txt, prefix, suffix, fichierExe=None, shell='sh', texteCommande=None): + #----------------------------------------------------------------------------------------------# self.w = ViewText( self.QWParent ) self.w.setWindowTitle( "execution" ) self.monExe=QProcess(self.w) pid=self.monExe.pid() - if not fichierExe : + if not fichierExe and txt : fichierExe = self.generateTempFilename(prefix, suffix = ".sh") f=open(fichierExe,'w') f.write(txt) f.close() self.monExe.readyReadStandardOutput.connect( self.readFromStdOut) self.monExe.readyReadStandardError.connect( self.readFromStdErr) - exe=shell + ' ' + fichierExe + if texteCommande != None : exe=texteCommande + else : exe=shell + ' ' + fichierExe + print (exe) + monEnv=QProcessEnvironment.systemEnvironment() + monEnv.insert('COLUMNS','500') + self.monExe.setProcessEnvironment(monEnv) + self.monExe.start(exe) self.monExe.closeWriteChannel() self.w.exec_() @@ -940,9 +946,12 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): #if self.modified or not self.fichier : sauvegarde, fichier= self.saveUQFile() if not sauvegarde : return 0 + #texteCommande=' export COLUMNS=200;' + texteCommande =' /home/A96028/salome/appli_V9_7_0_sysVersion/salome start -k -t python3 ' + self.generator.fichierUQExe #self._viewTextExecute(None,None,None, fichierExe=self.generator.fichierUQExe, shell='python3') #self._viewTextExecute('ls -l /tmp','essaiLs','.sh',) - self._viewTextExecute(None,None,None, fichierExe='/home/A96028/QT5Dev/eficasRN/ReacteurNumerique/a.py',shell='python3',) + #self._viewTextExecute(None,None,None, fichierExe='/home/A96028/QT5Dev/eficasRN/ReacteurNumerique/a.py',shell='python3',) + self._viewTextExecute(None,None,None, texteCommande=texteCommande) return True #----------------------------------------------# diff --git a/ReacteurNumerique/cata_UQ.py b/ReacteurNumerique/cata_UQ.py index 844c59fc..3deb0267 100644 --- a/ReacteurNumerique/cata_UQ.py +++ b/ReacteurNumerique/cata_UQ.py @@ -1519,8 +1519,8 @@ def creeOperExpressionIncertitude(monDicoVarDeter, monDicoVarSortie,scriptPosttr JobName = SIMP ( statut = 'o', typ ="TXM", defaut='idefix_rn_job'), ResourceName = SIMP ( statut = 'o', typ ="TXM", defaut ='localhost'), Login = SIMP ( statut = 'o', typ ="TXM", defaut = os.getlogin() ), -# WorkDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/C65845_workingdir_uncertainty'), #TODO: Login + NonExistent - WorkDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/C65845_workingdir_uncertainty'), #TODO: Login + NonExistent +# WorkDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/'+os.getlogin()+'_workingdir_uncertainty'), #TODO: Login + NonExistent + WorkDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/'+os.getlogin()+'_workingdir_uncertainty'), #TODO: NonExistent # ResultDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/idefix_rn_job'), #TODO: JobName ResultDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/idefix_rn_job'), #TODO: JobName UncertaintyScript=SIMP( statut="o", typ=("FichierNoAbs", "All Files ()"), defaut=scriptDeLancement, @@ -1531,14 +1531,14 @@ def creeOperExpressionIncertitude(monDicoVarDeter, monDicoVarSortie,scriptPosttr NbOfProcs = SIMP ( statut = 'o', typ ="I" , defaut = 1, val_min = 1, fr='Equivaut au nombre de tasks SLURM affectées à chaque job'), JobName = SIMP ( statut = 'o', typ ="TXM", defaut='idefix_rn_job'), ResourceName = SIMP ( statut = 'o', typ ="TXM", defaut ='gaia'), - Login = SIMP( statut = 'o', typ ="TXM", defaut ='C65845'), - WorkDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/scratch/C65845/workingdir/persalys_light'), #TODO: Login -# WorkDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/scratch/C65845/workingdir/persalys_light'), #TODO: Login + Login = SIMP( statut = 'o', typ ="TXM", defaut = os.getlogin()), + WorkDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/scratch/'+os.getlogin()+'/workingdir/persalys_light'), #TODO: Login +# WorkDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/scratch/'+os.getlogin()+'/workingdir/persalys_light'), #TODO: Login ResultDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/idefix_rn_job'), #TODO: JobName # ResultDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/idefix_rn_job'), #TODO: JobName Consigne = SIMP(statut="o", homo="information", typ="TXM", defaut="Le chemin d'accès au script de lancement est celui utilisé par les machines du cluster."), - ScriptDeLancement=SIMP( statut="o", typ=("FichierNoAbs", "All Files ()"), defaut=scriptDeLancement, + UncertaintyScript = SIMP( statut="o", typ=("FichierNoAbs", "All Files ()"), defaut=scriptDeLancement, fr="Nom du fichier script de lancement", ang="script File to launch",), ), ), diff --git a/generator/generator_UQ.py b/generator/generator_UQ.py index 03a7b6c3..ec984e76 100644 --- a/generator/generator_UQ.py +++ b/generator/generator_UQ.py @@ -411,7 +411,13 @@ class UQGenerator(PythonGenerator): # print('txtResultCT:',txtResultCT) optionalResultList=getStrVarList(optionalResultNames) optionalResultStrList=getStrVarStrList(optionalResultNames) + post_csv_rnScript=os.path.basename(self.ScriptPosttraitement).split('.')[0] + post_csv_rnPath=os.path.dirname(self.ScriptPosttraitement) + print (post_csv_rnScript) + print (post_csv_rnPath) txtPrintResult=printResult.format( + post_csv_rnScript = post_csv_rnScript, + post_csv_rnPath = post_csv_rnPath, optionalResultList = optionalResultList, optionalResultStrList = optionalResultStrList, resultSkList = getStrVarList(self.resultSkList)) diff --git a/generator/textePersalys.py b/generator/textePersalys.py index d047c782..44317a2e 100644 --- a/generator/textePersalys.py +++ b/generator/textePersalys.py @@ -218,7 +218,10 @@ if __name__ == '__main__': # outputs = [d] printResult=""" import numpy as np - from post_csv_rn import write_result_from_persalys + sys.path.append(os.path.abspath('{post_csv_rnPath}')) + from {post_csv_rnScript} import write_result_from_persalys + + #from post_csv_rn import write_result_from_persalys # import pandas as pnd # from functools import reduce