Salome HOME
[EDF29576] : WIP
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 27 Feb 2024 13:01:11 +0000 (14:01 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 27 Feb 2024 13:01:11 +0000 (14:01 +0100)
src/yacsloader/driver_internal.py

index 9f9d727fb78a6ddd48fd7371f75c236c7ab0238b..0bcc7928251eccc0cfbb7fab01950403ee1fc2dc 100644 (file)
 import salome
 import logging
 
+DisplayEntryInCMD = "--display"
+VerboseEntryInCMD = "--verbose"
+StopOnErrorEntryInCMD = "--stop-on-error"
+DumpOnErrorEntryInCMD = "--dump-on-error"
+DumpEntryInCMD = "--dump"
+KernelTraceEntryInCMD = "--kerneltrace"
+DumpStateEntryInCMD = "--dump-final"
+LoadStateEntryInCMD = "--load-state"
+SaveXMLSchemaEntryInCMD = "--save-xml-schema"
+ShutdownEntryInCMD = "--shutdown"
+ResetEntryInCMD = "--reset"
+InitPortEntryInCMD = "--init-port"
+DoNotSqueezeEntryInCMD = "--donotsqueeze"
 IOREntryInCMD = "--ior-ns"
 
+DisplayKeyInARGS = "display"
+VerboseKeyInARGS = "verbose"
+StopOnErrorKeyInARGS = "stop"
+DumpOnErrorKeyInARGS = "dumpErrorFile"
+DumpKeyInARGS = "dump"
+KernelTraceKeyInARGS = "kerneltrace"
+DumpStateKeyInARGS = "finalDump"
+LoadStateKeyInARGS = "loadState"
+SaveXMLSchemaKeyInARGS = "saveXMLSchema"
+ShutdownKeyInARGS = "shutdown"
+ResetKeyInARGS = "reset"
+InitPortKeyInARGS = "init_port"
+DoNotSqueezeKeyInARGS = "donotsqueeze"
+IOREKeyInARGS = "iorNS"
+
 my_runtime_yacs = None
 
 my_ior_ns = None
@@ -186,6 +214,13 @@ def destroyElementsGeneratedByExecutionOfGraph( proc, shutdown ):
   salome.dsm.shutdownScopes()
   my_runtime_yacs.fini( False )
 
+def toDict( args ):
+  """
+  Convert argparse.Namespace to dict
+  """
+  ATTR = ["display","verbose","stop","dumpErrorFile","dump","kerneltrace","finalDump","loadState","saveXMLSchema","shutdown","reset","init_port","donotsqueeze","iorNS"]
+  return {k:getattr(args,k) for k in ATTR}
+
 def reprAfterArgParsing( args ):
   """
   Args:
@@ -210,23 +245,24 @@ donotsqueeze : {args.donotsqueeze}
 iorNS : {args.iorNS}
 """
 
+
 def getArgumentParser():
   import argparse
   parser = argparse.ArgumentParser()
   parser.add_argument('xmlfilename',help = "XML file containing YACS schema to be executed")
-  parser.add_argument("-d", "--display", dest = "display", type=int, default=[0], nargs=1, help="Display dot files: 0=never to 3=very often")
-  parser.add_argument("-v", "--verbose", dest = "verbose",help="Produce verbose output", action='store_true')
-  parser.add_argument("-s","--stop-on-error",dest="stop",help="Stop on first error", action='store_true')
-  parser.add_argument("-e","--dump-on-error",dest="dumpErrorFile", type=str, const='dumpErrorState.xml', default="", nargs='?', help="Stop on first error and dump state")
-  parser.add_argument("-g","--dump",dest="dump", type=int, const=60, default=0, nargs='?', help="dump state")
-  parser.add_argument("-kt", "--kerneltrace", dest = "kerneltrace",help="Produce verbose of SALOME/KERNEL", action='store_true')
-  parser.add_argument("-f","--dump-final", dest ="finalDump", type=str, const='finalDumpState.xml', default="", nargs='?', help="dump final state")
-  parser.add_argument("-l","--load-state", dest="loadState", type=str, default="", help="Load State from a previous partial execution")
-  parser.add_argument("-x","--save-xml-schema", dest="saveXMLSchema", type=str, const="saveSchema.xml", nargs='?', default="", help = "dump xml schema")
-  parser.add_argument("-t","--shutdown", dest = 'shutdown', type=int , default=1, help="Shutdown the schema: 0=no shutdown to 3=full shutdown")
-  parser.add_argument("-r","--reset", dest = "reset", type=int , default = 0, help="Reset the schema before execution: 0=nothing, 1=reset error nodes to ready state")
-  parser.add_argument("-i","--init-port", dest = 'init_port', type=str, default ="", help="Initialisation value of a port, specified as bloc.node.port=value.")
-  parser.add_argument("-z","--donotsqueeze", dest = "donotsqueeze", help = "Desactivate squeeze memory optimization.", action='store_true')
+  parser.add_argument("-d", DisplayEntryInCMD, dest = "display", type=int, default=[0], nargs=1, help="Display dot files: 0=never to 3=very often")
+  parser.add_argument("-v", VerboseEntryInCMD, dest = "verbose",help="Produce verbose output", action='store_true')
+  parser.add_argument("-s",StopOnErrorEntryInCMD,dest="stop",help="Stop on first error", action='store_true')
+  parser.add_argument("-e",DumpOnErrorEntryInCMD,dest="dumpErrorFile", type=str, const='dumpErrorState.xml', default="", nargs='?', help="Stop on first error and dump state")
+  parser.add_argument("-g",DumpEntryInCMD,dest="dump", type=int, const=60, default=0, nargs='?', help="dump state")
+  parser.add_argument("-kt", KernelTraceEntryInCMD, dest = "kerneltrace",help="Produce verbose of SALOME/KERNEL", action='store_true')
+  parser.add_argument("-f",DumpStateEntryInCMD, dest ="finalDump", type=str, const='finalDumpState.xml', default="", nargs='?', help="dump final state")
+  parser.add_argument("-l",LoadStateEntryInCMD, dest="loadState", type=str, default="", help="Load State from a previous partial execution")
+  parser.add_argument("-x",SaveXMLSchemaEntryInCMD, dest="saveXMLSchema", type=str, const="saveSchema.xml", nargs='?', default="", help = "dump xml schema")
+  parser.add_argument("-t",ShutdownEntryInCMD, dest = 'shutdown', type=int , default=1, help="Shutdown the schema: 0=no shutdown to 3=full shutdown")
+  parser.add_argument("-r",ResetEntryInCMD, dest = "reset", type=int , default = 0, help="Reset the schema before execution: 0=nothing, 1=reset error nodes to ready state")
+  parser.add_argument("-i",InitPortEntryInCMD, dest = 'init_port', type=str, default ="", help="Initialisation value of a port, specified as bloc.node.port=value.")
+  parser.add_argument("-z",DoNotSqueezeEntryInCMD = "--donotsqueeze", dest = "donotsqueeze", help = "Desactivate squeeze memory optimization.", action='store_true')
   parser.add_argument(IOREntryInCMD, dest = "iorNS", type=str, default ="", help="file inside which the ior of NS will be stored")
   return parser
 
@@ -237,6 +273,8 @@ def mainRun( args ):
   #
   if args.iorNS:
     my_ior_ns = args.iorNS
+  import pdb
+  pdb.set_trace()
   #
   if args.verbose:
     setVerbose( args.kerneltrace )