Salome HOME
[EDF29576] : give information in case of invalid YACS scheme
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 1 Mar 2024 08:11:48 +0000 (09:11 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 1 Mar 2024 08:11:48 +0000 (09:11 +0100)
src/yacsloader/driver_internal.py

index 6c7d541522c80e957a69e8ce412587b1641f4441..6a30cec23b18abe8905cb3dd3228d12b38e80943 100644 (file)
@@ -138,6 +138,7 @@ def patchGraph( proc, squeezeMemory, initPorts, xmlSchema, loadStateXmlFile, res
   """
   import SALOMERuntime
   import loader
+  import pilot
   def parse_init_port(input):
     """
     Returns
@@ -167,6 +168,11 @@ def patchGraph( proc, squeezeMemory, initPorts, xmlSchema, loadStateXmlFile, res
     SALOMERuntime.VisitorSaveSalomeSchemaUnsafe(proc,xmlSchema)
     pass
   #
+  info = pilot.LinkInfo( pilot.LinkInfo.ALL_DONT_STOP )
+  proc.checkConsistency(info)
+  if info.areWarningsOrErrors():
+    raise RuntimeError( info.getGlobalRepr() )
+  #
   if loadStateXmlFile:
     loader.loadState( proc, loadStateXmlFile )
     if reset > 0:
@@ -303,7 +309,7 @@ def getArgumentParser():
   parser.add_argument("-x",SaveXMLSchemaEntryInCMD, dest=SaveXMLSchemaKeyInARGS, type=str, const="saveSchema.xml", nargs='?', default="", help = "dump xml schema")
   parser.add_argument("-t",ShutdownEntryInCMD, dest = ShutdownKeyInARGS, type=int , default=3, help="Shutdown the schema: 0=no shutdown to 3=full shutdown")
   parser.add_argument("-r",ResetEntryInCMD, dest = ResetKeyInARGS, 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 = InitPortKeyInARGS, type=str, default ="", help="Initialisation value of a port, specified as bloc.node.port=value. For multiple settings use comma.")
+  parser.add_argument("-i",InitPortEntryInCMD, dest = InitPortKeyInARGS, nargs='+', type=str, default =[], help="Initialisation value of a port, specified as bloc.node.port=value. For multiple settings use comma.")
   parser.add_argument("-z",DoNotSqueezeEntryInCMD, dest = DoNotSqueezeKeyInARGS, help = "Desactivate squeeze memory optimization.", action='store_true')
   parser.add_argument(CPUTimeResOfContainerEntryInCMD, dest = CPUTimeResOfContainerKeyInARGS, type=int, default = 10, help="Time in second between two measures of CPU/Mem in container processes")
   parser.add_argument(HTOPFileEntryInCMD, dest = HTOPFileKeyInARGS, type=str, default ="", help="File name (if not empty) containing the result of measure of current process")
@@ -337,7 +343,7 @@ def mainRun( args, iorNS, xmlFileName):
     logging.info( reprAfterArgParsing(args) )
   #
   proc = loadGraph( xmlFileName )
-  patchGraph( proc, not args[DoNotSqueezeKeyInARGS], [elt for elt in args[InitPortKeyInARGS].split(",") if elt !=""], args[SaveXMLSchemaKeyInARGS], args[LoadStateKeyInARGS], args[ResetKeyInARGS], args[DisplayKeyInARGS])
+  patchGraph( proc, not args[DoNotSqueezeKeyInARGS], args[InitPortKeyInARGS], args[SaveXMLSchemaKeyInARGS], args[LoadStateKeyInARGS], args[ResetKeyInARGS], args[DisplayKeyInARGS])
   executor = prepareExecution( proc, args[StopOnErrorKeyInARGS], args[DumpOnErrorKeyInARGS])
   #
   executeGraph( executor, xmlFileName, proc, args[DumpKeyInARGS], args[DumpStateKeyInARGS], args[DisplayKeyInARGS], args[CPUTimeResOfContainerKeyInARGS],