salome.kernel 9.14.0__cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of salome.kernel might be problematic. Click here for more details.
- salome/bin/salome/IDLparser.py +882 -0
- salome/bin/salome/KernelHelpersUseCases +0 -0
- salome/bin/salome/NSparam.py +51 -0
- salome/bin/salome/ORBConfigFile.py +55 -0
- salome/bin/salome/SALOMEDS_Client +0 -0
- salome/bin/salome/SALOMEDS_Server +0 -0
- salome/bin/salome/SALOME_ConnectionManagerServer +0 -0
- salome/bin/salome/SALOME_Container +0 -0
- salome/bin/salome/SALOME_ContainerPy.py +397 -0
- salome/bin/salome/SALOME_Container_No_NS_Serv +0 -0
- salome/bin/salome/SALOME_Container_No_NS_Serv_OutProcess +0 -0
- salome/bin/salome/SALOME_Container_No_NS_Serv_OutProcess_FT +0 -0
- salome/bin/salome/SALOME_Container_No_NS_Serv_OutProcess_Replay +0 -0
- salome/bin/salome/SALOME_Container_No_NS_Serv_OutProcess_Replay_FT +0 -0
- salome/bin/salome/SALOME_DataScopeServer +0 -0
- salome/bin/salome/SALOME_DataScopeServer_SSL +0 -0
- salome/bin/salome/SALOME_LauncherServer +0 -0
- salome/bin/salome/SALOME_Logger_Server +0 -0
- salome/bin/salome/SALOME_ModuleCatalog_Client +0 -0
- salome/bin/salome/SALOME_ModuleCatalog_Server +0 -0
- salome/bin/salome/SALOME_Registry_Server +0 -0
- salome/bin/salome/TestComponentPy.py +71 -0
- salome/bin/salome/TestContainer +0 -0
- salome/bin/salome/TestContainerManager +0 -0
- salome/bin/salome/TestLauncher +0 -0
- salome/bin/salome/TestLifeCycleCORBA.py +89 -0
- salome/bin/salome/TestLogger +0 -0
- salome/bin/salome/TestLogger.py +27 -0
- salome/bin/salome/TestModuleCatalog.py +87 -0
- salome/bin/salome/Test_LifeCycleCORBA +0 -0
- salome/bin/salome/VERSION +3 -0
- salome/bin/salome/addToKillList.py +35 -0
- salome/bin/salome/app-quickstart.py +288 -0
- salome/bin/salome/appli/.bashrc +50 -0
- salome/bin/salome/appli/extra.env.d/001.py +39 -0
- salome/bin/salome/appli/python_test_driver.py +148 -0
- salome/bin/salome/appli/salome +193 -0
- salome/bin/salome/appli/salome_instance.py +31 -0
- salome/bin/salome/appli/salome_test_driver.py +150 -0
- salome/bin/salome/appli/salome_test_driver_gui.py +82 -0
- salome/bin/salome/appli_clean.sh +53 -0
- salome/bin/salome/appli_gen.py +606 -0
- salome/bin/salome/dummyexe_loggerTraceCollector +0 -0
- salome/bin/salome/envSalome.py +59 -0
- salome/bin/salome/killSalome.py +48 -0
- salome/bin/salome/killSalomeWithPort.py +56 -0
- salome/bin/salome/prepare_generating_doc.py +104 -0
- salome/bin/salome/pythonpath_reduction.py +184 -0
- salome/bin/salome/runConsole.py +39 -0
- salome/bin/salome/runIDLparser +58 -0
- salome/bin/salome/runRemote.py +101 -0
- salome/bin/salome/runSalome.py +30 -0
- salome/bin/salome/runSalomeNoServer.py +24 -0
- salome/bin/salome/runSalomeOld.py +36 -0
- salome/bin/salome/runSalomeOnDemand.py +41 -0
- salome/bin/salome/salomeContext.py +36 -0
- salome/bin/salome/salome_process_attach +44 -0
- salome/bin/salome/salome_process_launcher +58 -0
- salome/bin/salome/setenv.py +32 -0
- salome/bin/salome/showNS.py +33 -0
- salome/bin/salome/test/kernel/ArgvKeeper/CTestTestfile.cmake +31 -0
- salome/bin/salome/test/kernel/ArgvKeeper/TestArgvKeeper +0 -0
- salome/bin/salome/test/kernel/ArgvKeeper/test_ArgvKeeper.py +34 -0
- salome/bin/salome/test/kernel/CTestTestfile.cmake +49 -0
- salome/bin/salome/test/kernel/Container/CTestTestfile.cmake +29 -0
- salome/bin/salome/test/kernel/Container/testProxy.py +291 -0
- salome/bin/salome/test/kernel/Container/testcontainer.py +106 -0
- salome/bin/salome/test/kernel/KernelHelpers/CTestTestfile.cmake +31 -0
- salome/bin/salome/test/kernel/KernelHelpers/KernelHelpersUnitTests.hxx +58 -0
- salome/bin/salome/test/kernel/KernelHelpers/TestKernelHelpers +0 -0
- salome/bin/salome/test/kernel/KernelHelpers/TestKernelHelpers.py +55 -0
- salome/bin/salome/test/kernel/Launcher/CTestTestfile.cmake +43 -0
- salome/bin/salome/test/kernel/Launcher/TestSSLAttached.py +110 -0
- salome/bin/salome/test/kernel/Launcher/launcher_use_case.py +65 -0
- salome/bin/salome/test/kernel/Launcher/testCrashProofContainer.py +423 -0
- salome/bin/salome/test/kernel/Launcher/testPerfLogManager1.py +382 -0
- salome/bin/salome/test/kernel/Launcher/test_launcher.py +674 -0
- salome/bin/salome/test/kernel/Launcher/test_stress.sh +45 -0
- salome/bin/salome/test/kernel/Launcher_SWIG/CTestTestfile.cmake +30 -0
- salome/bin/salome/test/kernel/Launcher_SWIG/test_swig_launcher.py +706 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA/CTestTestfile.cmake +27 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA/LifeCycleCORBATest.hxx +105 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA/TestLifeCycleCORBA +0 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA/TestLifeCycleCORBA.py +93 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/CTestTestfile.cmake +40 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/CatalogResources_resource.xml +15 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/LifeCycleCORBA_SWIGTest.py +217 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/SALOME_TestComponentPy.py +49 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/TestLifeCycleCORBA_SWIG.py +100 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/testcontainermanager.py +88 -0
- salome/bin/salome/test/kernel/LifeCycleCORBA_SWIG/testresourcemanager.py +155 -0
- salome/bin/salome/test/kernel/NamingService/CTestTestfile.cmake +28 -0
- salome/bin/salome/test/kernel/NamingService/NamingServiceTest.hxx +169 -0
- salome/bin/salome/test/kernel/NamingService/TestNamingService +0 -0
- salome/bin/salome/test/kernel/NamingService/TestNamingService.py +64 -0
- salome/bin/salome/test/kernel/SALOMEDS/CTestTestfile.cmake +27 -0
- salome/bin/salome/test/kernel/SALOMEDS/SALOMEDSTest.hxx +192 -0
- salome/bin/salome/test/kernel/SALOMEDS/TestSALOMEDS +0 -0
- salome/bin/salome/test/kernel/SALOMEDS/TestSALOMEDS.py +55 -0
- salome/bin/salome/test/kernel/SALOMEDSImpl/CTestTestfile.cmake +27 -0
- salome/bin/salome/test/kernel/SALOMEDSImpl/SALOMEDSImplTest.hxx +51 -0
- salome/bin/salome/test/kernel/SALOMEDSImpl/TestSALOMEDSImpl +0 -0
- salome/bin/salome/test/kernel/SALOMEDSImpl/TestSALOMEDSImpl.py +55 -0
- salome/bin/salome/test/kernel/SALOMELocalTrace/CTestTestfile.cmake +27 -0
- salome/bin/salome/test/kernel/SALOMELocalTrace/SALOMELocalTraceTest.hxx +59 -0
- salome/bin/salome/test/kernel/SALOMELocalTrace/TestSALOMELocalTrace +0 -0
- salome/bin/salome/test/kernel/SALOMELocalTrace/TestSALOMELocalTrace.py +40 -0
- salome/bin/salome/test/kernel/SALOMETraceCollector/CTestTestfile.cmake +27 -0
- salome/bin/salome/test/kernel/SALOMETraceCollector/SALOMETraceCollectorTest.hxx +51 -0
- salome/bin/salome/test/kernel/SALOMETraceCollector/TestSALOMETraceCollector +0 -0
- salome/bin/salome/test/kernel/SALOMETraceCollector/TestSALOMETraceCollector.py +57 -0
- salome/bin/salome/test/kernel/UnitTests/CTestTestfile.cmake +28 -0
- salome/bin/salome/test/kernel/UnitTests/UnitTests +0 -0
- salome/bin/salome/test/kernel/UnitTests/UnitTests.py +89 -0
- salome/bin/salome/test/kernel/Utils/CTestTestfile.cmake +27 -0
- salome/bin/salome/test/kernel/Utils/TestUtils +0 -0
- salome/bin/salome/test/kernel/Utils/TestUtils.py +55 -0
- salome/bin/salome/test/kernel/Utils/UtilsTest.hxx +58 -0
- salome/bin/salome/test/kernel/lib/libLifeCycleCORBATest.so +0 -0
- salome/bin/salome/test/kernel/lib/libNamingServiceTest.so +0 -0
- salome/bin/salome/test/kernel/lib/libSALOMEDSImplTest.so +0 -0
- salome/bin/salome/test/kernel/lib/libSALOMEDSTest.so +0 -0
- salome/bin/salome/test/kernel/lib/libSALOMELocalTraceTest.so +0 -0
- salome/bin/salome/test/kernel/lib/libSALOMETraceCollectorTest.so +0 -0
- salome/bin/salome/test/kernel/lib/libSalomeKernelHelpersTest.so +0 -0
- salome/bin/salome/test/kernel/lib/libUtilsTest.so +0 -0
- salome/bin/salome/testDF +0 -0
- salome/bin/salome/testDS +0 -0
- salome/bin/salome/virtual_salome.py +38 -0
- salome/bin/salome/waitContainers.py +82 -0
- salome/bin/salome/waitNS.py +31 -0
- salome/kernel/ArgvKeeper.py +132 -0
- salome/kernel/Calcium_Ports_idl.py +645 -0
- salome/kernel/DSC_Engines_idl.py +443 -0
- salome/kernel/Engines/__init__.py +24 -0
- salome/kernel/Engines__POA/__init__.py +24 -0
- salome/kernel/Help.py +141 -0
- salome/kernel/KernelBasis.py +463 -0
- salome/kernel/KernelContainer.py +81 -0
- salome/kernel/KernelDS.py +87 -0
- salome/kernel/KernelLauncher.py +117 -0
- salome/kernel/KernelLogger.py +75 -0
- salome/kernel/KernelModuleCatalog.py +76 -0
- salome/kernel/KernelSDS.py +92 -0
- salome/kernel/KernelServices.py +105 -0
- salome/kernel/LifeCycleCORBA.py +92 -0
- salome/kernel/Logger_idl.py +89 -0
- salome/kernel/NSTEST/__init__.py +13 -0
- salome/kernel/NSTEST__POA/__init__.py +13 -0
- salome/kernel/NSparam_impl.py +50 -0
- salome/kernel/NamingService.py +365 -0
- salome/kernel/ORBConfigFile_impl.py +102 -0
- salome/kernel/Palm_Ports_idl.py +162 -0
- salome/kernel/PortManager.py +259 -0
- salome/kernel/Ports/Calcium_Ports/__init__.py +13 -0
- salome/kernel/Ports/Palm_Ports/__init__.py +13 -0
- salome/kernel/Ports/__init__.py +18 -0
- salome/kernel/Ports__POA/Calcium_Ports/__init__.py +13 -0
- salome/kernel/Ports__POA/Palm_Ports/__init__.py +13 -0
- salome/kernel/Ports__POA/__init__.py +18 -0
- salome/kernel/PyInterp.py +99 -0
- salome/kernel/Registry/__init__.py +13 -0
- salome/kernel/Registry__POA/__init__.py +13 -0
- salome/kernel/SALOME/__init__.py +19 -0
- salome/kernel/SALOMEDS/__init__.py +14 -0
- salome/kernel/SALOMEDS_Attributes_idl.py +2288 -0
- salome/kernel/SALOMEDS__POA/__init__.py +14 -0
- salome/kernel/SALOMEDS_idl.py +1590 -0
- salome/kernel/SALOMEWrappedStdType.py +383 -0
- salome/kernel/SALOME_Comm_idl.py +1045 -0
- salome/kernel/SALOME_CommonTypes_idl.py +69 -0
- salome/kernel/SALOME_ComponentPy.py +338 -0
- salome/kernel/SALOME_Component_idl.py +962 -0
- salome/kernel/SALOME_Container.py +242 -0
- salome/kernel/SALOME_ContainerHelper.py +840 -0
- salome/kernel/SALOME_ContainerManager_idl.py +236 -0
- salome/kernel/SALOME_DriverPy.py +86 -0
- salome/kernel/SALOME_Embedded_NamingService.py +41 -0
- salome/kernel/SALOME_Embedded_NamingService_ClientPy.py +59 -0
- salome/kernel/SALOME_Embedded_NamingService_idl.py +125 -0
- salome/kernel/SALOME_Exception_idl.py +75 -0
- salome/kernel/SALOME_ExternalServerLauncher_idl.py +199 -0
- salome/kernel/SALOME_GenericObj_idl.py +154 -0
- salome/kernel/SALOME_GlobalsImpl.py +38 -0
- salome/kernel/SALOME_Launcher_idl.py +327 -0
- salome/kernel/SALOME_Locker_idl.py +185 -0
- salome/kernel/SALOME_LogManager.py +103 -0
- salome/kernel/SALOME_LogManager_idl.py +348 -0
- salome/kernel/SALOME_Logger/__init__.py +13 -0
- salome/kernel/SALOME_Logger__POA/__init__.py +13 -0
- salome/kernel/SALOME_MPIObject_idl.py +100 -0
- salome/kernel/SALOME_ModuleCatalog/__init__.py +13 -0
- salome/kernel/SALOME_ModuleCatalog__POA/__init__.py +13 -0
- salome/kernel/SALOME_ModuleCatalog_idl.py +624 -0
- salome/kernel/SALOME_NamingServicePy.py +313 -0
- salome/kernel/SALOME_PACOExtension_idl.py +292 -0
- salome/kernel/SALOME_ParamPorts_idl.py +102 -0
- salome/kernel/SALOME_Parametric_idl.py +154 -0
- salome/kernel/SALOME_Ports_idl.py +347 -0
- salome/kernel/SALOME_PyNode.py +1557 -0
- salome/kernel/SALOME_PyNode_idl.py +387 -0
- salome/kernel/SALOME_Registry_idl.py +155 -0
- salome/kernel/SALOME_ResourcesManager_idl.py +215 -0
- salome/kernel/SALOME_SDS_idl.py +1181 -0
- salome/kernel/SALOME_Session_idl.py +214 -0
- salome/kernel/SALOME_TYPES/__init__.py +14 -0
- salome/kernel/SALOME_TYPES__POA/__init__.py +14 -0
- salome/kernel/SALOME_TestComponent_idl.py +121 -0
- salome/kernel/SALOME_TestModuleCatalog/__init__.py +13 -0
- salome/kernel/SALOME_TestModuleCatalog__POA/__init__.py +13 -0
- salome/kernel/SALOME_TestModuleCatalog_idl.py +194 -0
- salome/kernel/SALOME_Trace.py +96 -0
- salome/kernel/SALOME_Types_idl.py +81 -0
- salome/kernel/SALOME__POA/__init__.py +19 -0
- salome/kernel/SALOME_utilities.py +63 -0
- salome/kernel/SalomeSDSClt.py +552 -0
- salome/kernel/TestKiller.py +76 -0
- salome/kernel/Utils_Identity.py +93 -0
- salome/kernel/_ArgvKeeper.so +0 -0
- salome/kernel/_KernelBasis.so +0 -0
- salome/kernel/_KernelContainer.so +0 -0
- salome/kernel/_KernelDS.so +0 -0
- salome/kernel/_KernelLauncher.so +0 -0
- salome/kernel/_KernelLogger.so +0 -0
- salome/kernel/_KernelModuleCatalog.so +0 -0
- salome/kernel/_KernelSDS.so +0 -0
- salome/kernel/_KernelServices.so +0 -0
- salome/kernel/_NamingService.so +0 -0
- salome/kernel/_calcium.so +0 -0
- salome/kernel/_libNOTIFICATION.so +0 -0
- salome/kernel/_libSALOME_Comm.so +0 -0
- salome/kernel/_libSALOME_LifeCycleCORBA.so +0 -0
- salome/kernel/_pylauncher.so +0 -0
- salome/kernel/addToKillList_impl.py +127 -0
- salome/kernel/batchmode_salome.py +295 -0
- salome/kernel/calcium.py +866 -0
- salome/kernel/dsccalcium.py +98 -0
- salome/kernel/iparameters.py +255 -0
- salome/kernel/kernel_test.py +114 -0
- salome/kernel/killSalomeWithPort_impl.py +518 -0
- salome/kernel/killSalome_impl.py +94 -0
- salome/kernel/launchConfigureParser.py +1234 -0
- salome/kernel/launcher_proxy.py +122 -0
- salome/kernel/libNOTIFICATION.py +119 -0
- salome/kernel/libSALOME_Comm.py +85 -0
- salome/kernel/libSALOME_LifeCycleCORBA.py +232 -0
- salome/kernel/main.py +8 -0
- salome/kernel/nameserver.py +134 -0
- salome/kernel/nstest_idl.py +129 -0
- salome/kernel/omnipatch.py +136 -0
- salome/kernel/orbmodule.py +246 -0
- salome/kernel/parseConfigFile.py +261 -0
- salome/kernel/pylauncher.py +883 -0
- salome/kernel/runConsole_impl.py +224 -0
- salome/kernel/runSalomeCommon.py +418 -0
- salome/kernel/runSalomeNoServer_impl.py +48 -0
- salome/kernel/runSalomeOld_impl.py +603 -0
- salome/kernel/runSalomeOnDemand_impl.py +72 -0
- salome/kernel/runSalome_impl.py +341 -0
- salome/kernel/runSession.py +360 -0
- salome/kernel/runTests.py +90 -0
- salome/kernel/salome/__init__.py +646 -0
- salome/kernel/salome/kernel/__init__.py +111 -0
- salome/kernel/salome/kernel/datamodeler.py +363 -0
- salome/kernel/salome/kernel/deprecation.py +165 -0
- salome/kernel/salome/kernel/diclookup.py +137 -0
- salome/kernel/salome/kernel/enumerate.py +232 -0
- salome/kernel/salome/kernel/logconfig.py +27 -0
- salome/kernel/salome/kernel/logger.py +290 -0
- salome/kernel/salome/kernel/parametric/__init__.py +26 -0
- salome/kernel/salome/kernel/parametric/compo_utils.py +137 -0
- salome/kernel/salome/kernel/parametric/pyscript_utils.py +135 -0
- salome/kernel/salome/kernel/parametric/study_exchange_vars.py +285 -0
- salome/kernel/salome/kernel/pyunittester.py +184 -0
- salome/kernel/salome/kernel/services.py +267 -0
- salome/kernel/salome/kernel/studyedit.py +637 -0
- salome/kernel/salome/kernel/syshelper.py +116 -0
- salome/kernel/salome/kernel/termcolor.py +239 -0
- salome/kernel/salome/kernel/testdata.py +159 -0
- salome/kernel/salome/kernel/threadhelper.py +385 -0
- salome/kernel/salome/kernel/uiexception.py +121 -0
- salome/kernel/salome/kernel/unittester.py +89 -0
- salome/kernel/salomeContextUtils.py +353 -0
- salome/kernel/salomeContext_impl.py +731 -0
- salome/kernel/salome_ComponentGUI.py +92 -0
- salome/kernel/salome_genericobj.py +44 -0
- salome/kernel/salome_iapp.py +206 -0
- salome/kernel/salome_instance_impl.py +109 -0
- salome/kernel/salome_kernel_utils.py +88 -0
- salome/kernel/salome_notebook.py +183 -0
- salome/kernel/salome_psutil.py +94 -0
- salome/kernel/salome_pynode.py +74 -0
- salome/kernel/salome_study.py +347 -0
- salome/kernel/salome_test.py +56 -0
- salome/kernel/salome_utils.py +563 -0
- salome/kernel/salome_version.py +164 -0
- salome/kernel/searchFreePort.py +130 -0
- salome/kernel/server.py +154 -0
- salome/kernel/setenv_impl.py +240 -0
- salome/kernel/version_and_config.py +24 -0
- salome/share/salome/resources/kernel/Anita semi square.ttf +0 -0
- salome/share/salome/resources/kernel/CatalogModulePersonnel.xml_skel +24 -0
- salome/share/salome/resources/kernel/CatalogResources.xml +4 -0
- salome/share/salome/resources/kernel/KERNELCatalog.xml +102 -0
- salome/share/salome/resources/kernel/SALOMEDS_Resources +10 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/SALOME_CM_LOCAL_MPI_LAN.py +19 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/SALOME_CM_LOCAL_MPI_MPICH.py +18 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/SALOME_CM_LOCAL_MPI_OPENMPI.py +21 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/SALOME_CM_LOCAL_NO_MPI.py +25 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/SALOME_CM_REMOTE.py +108 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/SALOME_CM_REMOTE_OLD.py +115 -0
- salome/share/salome/resources/kernel/ScriptsTemplate/script_parameters.py +25 -0
- salome/share/salome/resources/kernel/app-template/CMakeLists.txt +125 -0
- salome/share/salome/resources/kernel/app-template/LICENCE +504 -0
- salome/share/salome/resources/kernel/app-template/README +0 -0
- salome/share/salome/resources/kernel/app-template/doc/CMakeLists.txt +31 -0
- salome/share/salome/resources/kernel/app-template/doc/README +1 -0
- salome/share/salome/resources/kernel/app-template/doc/conf.py.in +197 -0
- salome/share/salome/resources/kernel/app-template/doc/index.rst +14 -0
- salome/share/salome/resources/kernel/app-template/doc/intro.rst +4 -0
- salome/share/salome/resources/kernel/app-template/doc/link.rst +4 -0
- salome/share/salome/resources/kernel/app-template/resources/CMakeLists.txt +36 -0
- salome/share/salome/resources/kernel/app-template/resources/SalomeApp.xml.in +30 -0
- salome/share/salome/resources/kernel/app-template/resources/about.png +0 -0
- salome/share/salome/resources/kernel/app-template/resources/app_icon.png +0 -0
- salome/share/salome/resources/kernel/app-template/resources/app_logo.png +0 -0
- salome/share/salome/resources/kernel/app-template/resources/doc/CMakeLists.txt +27 -0
- salome/share/salome/resources/kernel/app-template/resources/doc/README +1 -0
- salome/share/salome/resources/kernel/app-template/resources/doc/sample.pdf +0 -0
- salome/share/salome/resources/kernel/app-template/resources/icon_about.png +0 -0
- salome/share/salome/resources/kernel/app-template/resources/splash.png +0 -0
- salome/share/salome/resources/kernel/app-template/src/CMakeLists.txt +22 -0
- salome/share/salome/resources/kernel/app-template/src/resources/CMakeLists.txt +34 -0
- salome/share/salome/resources/kernel/app-template/src/resources/LightApp_images.ts +23 -0
- salome/share/salome/resources/kernel/app-template/src/resources/LightApp_msg_en.ts +35 -0
- salome/share/salome/resources/kernel/app-template/src/resources/LightApp_msg_fr.ts +35 -0
- salome/share/salome/resources/kernel/app-template/src/resources/LightApp_msg_ja.ts +35 -0
- salome/share/salome/resources/kernel/app-template/src/tests/CMakeLists.txt +29 -0
- salome/share/salome/resources/kernel/app-template/src/tests/README +1 -0
- salome/share/salome/resources/kernel/app-template/src/tests/helloWorld.py +1 -0
- salome/share/salome/resources/kernel/background.png +0 -0
- salome/share/salome/resources/kernel/channel.cfg +278 -0
- salome/share/salome/resources/kernel/testLauncher.xml +10 -0
- salome.kernel-9.14.0.dist-info/METADATA +24 -0
- salome.kernel-9.14.0.dist-info/RECORD +399 -0
- salome.kernel-9.14.0.dist-info/WHEEL +6 -0
- salome.kernel-9.14.0.dist-info/entry_points.txt +2 -0
- salome.kernel.libs/libArgvKeeper-822351d5.so +0 -0
- salome.kernel.libs/libCOS4-b4544fb9.so.2.5 +0 -0
- salome.kernel.libs/libCOSDynamic4-618dbb1d.so.2.5 +0 -0
- salome.kernel.libs/libCalciumC-91a70951.so +0 -0
- salome.kernel.libs/libDF-281cc999.so +0 -0
- salome.kernel.libs/libLauncher-d5172385.so +0 -0
- salome.kernel.libs/libLauncherWrapHelper-b990b914.so +0 -0
- salome.kernel.libs/libOpUtil-b4b3b9b6.so +0 -0
- salome.kernel.libs/libRegistry-e24daafb.so +0 -0
- salome.kernel.libs/libResourcesManager-f4ef9548.so +0 -0
- salome.kernel.libs/libSALOMEBasics-f4d874ac.so +0 -0
- salome.kernel.libs/libSALOMELocalTrace-a3992e5b.so +0 -0
- salome.kernel.libs/libSALOMELog-55805468.so +0 -0
- salome.kernel.libs/libSalomeCalcium-781cb934.so +0 -0
- salome.kernel.libs/libSalomeCatalog-5b91a229.so +0 -0
- salome.kernel.libs/libSalomeCommunication-6013ebb8.so +0 -0
- salome.kernel.libs/libSalomeContainer-decf499e.so +0 -0
- salome.kernel.libs/libSalomeContainerServer-9c26efb9.so +0 -0
- salome.kernel.libs/libSalomeDS-fb6237e6.so +0 -0
- salome.kernel.libs/libSalomeDSCContainer-9aba4abc.so +0 -0
- salome.kernel.libs/libSalomeDSCSuperv-cb0c82c4.so +0 -0
- salome.kernel.libs/libSalomeDSCSupervBasic-5e119792.so +0 -0
- salome.kernel.libs/libSalomeDSClient-cfd124a5.so +0 -0
- salome.kernel.libs/libSalomeDSImpl-b0ca6717.so +0 -0
- salome.kernel.libs/libSalomeDatastream-755ff3cb.so +0 -0
- salome.kernel.libs/libSalomeGenericObj-2571fdbd.so +0 -0
- salome.kernel.libs/libSalomeHDFPersist-97851d0e.so +0 -0
- salome.kernel.libs/libSalomeIDLKernel-2eb1ed8e.so +0 -0
- salome.kernel.libs/libSalomeKernelHelpers-ac8d226c.so +0 -0
- salome.kernel.libs/libSalomeLauncher-773b54ed.so +0 -0
- salome.kernel.libs/libSalomeLifeCycleCORBA-3e113d61.so +0 -0
- salome.kernel.libs/libSalomeLoggerServer-973d3d94.so +0 -0
- salome.kernel.libs/libSalomeNS-d87194d5.so +0 -0
- salome.kernel.libs/libSalomeNotification-83bfb2ff.so +0 -0
- salome.kernel.libs/libSalomeORB-07883efb.so +0 -0
- salome.kernel.libs/libSalomePalm-b748443e.so +0 -0
- salome.kernel.libs/libSalomeResourcesManager-5a7077a0.so +0 -0
- salome.kernel.libs/libSalomeSDS-cc7aada7.so +0 -0
- salome.kernel.libs/libSalomeTestComponentEngine-ae724ce1.so +0 -0
- salome.kernel.libs/libTOOLSDS-82342bb4.so +0 -0
- salome.kernel.libs/libbatch-6b5b319f.so +0 -0
- salome.kernel.libs/libboost_atomic-489c2d94.so.1.81.0 +0 -0
- salome.kernel.libs/libboost_filesystem-e610b554.so.1.81.0 +0 -0
- salome.kernel.libs/libboost_system-4a7650ea.so.1.81.0 +0 -0
- salome.kernel.libs/libcppunit-1-17e77af1.12.so.1.0.0 +0 -0
- salome.kernel.libs/libhdf5-60e81d69.so.103.0.0 +0 -0
- salome.kernel.libs/liblzma-004595ca.so.5.2.2 +0 -0
- salome.kernel.libs/libomniDynamic4-9edc765d.so.2.5 +0 -0
- salome.kernel.libs/libomniORB4-4725824d.so.2.5 +0 -0
- salome.kernel.libs/libomnithread-99f9d0d3.so.4.1 +0 -0
- salome.kernel.libs/libwith_loggerTraceCollector-7ed0f3a0.so +0 -0
- salome.kernel.libs/libwith_loggerTraceCollector.so +0 -0
- salome.kernel.libs/libxml2-3998bec4.so.2.9.1 +0 -0
|
@@ -0,0 +1,1557 @@
|
|
|
1
|
+
# -*- coding: iso-8859-1 -*-
|
|
2
|
+
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
|
3
|
+
#
|
|
4
|
+
# This library is free software; you can redistribute it and/or
|
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
6
|
+
# License as published by the Free Software Foundation; either
|
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+
# Lesser General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
15
|
+
# License along with this library; if not, write to the Free Software
|
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17
|
+
#
|
|
18
|
+
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
# File : SALOME_PyNode.py
|
|
22
|
+
# Author : Christian CAREMOLI, EDF
|
|
23
|
+
# Module : SALOME
|
|
24
|
+
# $Header$
|
|
25
|
+
#
|
|
26
|
+
import abc
|
|
27
|
+
import linecache
|
|
28
|
+
import logging
|
|
29
|
+
import os
|
|
30
|
+
import pickle
|
|
31
|
+
import sys
|
|
32
|
+
import traceback
|
|
33
|
+
from pathlib import Path
|
|
34
|
+
|
|
35
|
+
import omniORB
|
|
36
|
+
from . import Engines
|
|
37
|
+
from . import Engines__POA
|
|
38
|
+
from . import KernelBasis
|
|
39
|
+
from . import SALOME
|
|
40
|
+
from . import SALOME__POA
|
|
41
|
+
|
|
42
|
+
from .SALOME_ContainerHelper import ScriptExecInfo
|
|
43
|
+
|
|
44
|
+
MY_CONTAINER_ENTRY_IN_GLBS = "my_container"
|
|
45
|
+
|
|
46
|
+
MY_PERFORMANCE_LOG_ENTRY_IN_GLBS = "my_log_4_this_session"
|
|
47
|
+
|
|
48
|
+
MY_KEY_TO_DETECT_FINISH = "neib av tuot"
|
|
49
|
+
|
|
50
|
+
class Generic(SALOME__POA.GenericObj):
|
|
51
|
+
"""A Python implementation of the GenericObj CORBA IDL"""
|
|
52
|
+
def __init__(self,poa):
|
|
53
|
+
self.poa=poa
|
|
54
|
+
self.cnt=1
|
|
55
|
+
|
|
56
|
+
def Register(self):
|
|
57
|
+
#print("Register called : %d"%self.cnt)
|
|
58
|
+
self.cnt+=1
|
|
59
|
+
|
|
60
|
+
def UnRegister(self):
|
|
61
|
+
#print("UnRegister called : %d"%self.cnt)
|
|
62
|
+
self.cnt-=1
|
|
63
|
+
if self.cnt <= 0:
|
|
64
|
+
oid=self.poa.servant_to_id(self)
|
|
65
|
+
self.poa.deactivate_object(oid)
|
|
66
|
+
|
|
67
|
+
def Destroy(self):
|
|
68
|
+
print("WARNING SALOME::GenericObj::Destroy() function is obsolete! Use UnRegister() instead.")
|
|
69
|
+
self.UnRegister()
|
|
70
|
+
|
|
71
|
+
def __del__(self):
|
|
72
|
+
#print("Destuctor called")
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
class PyNode_i (Engines__POA.PyNode,Generic):
|
|
76
|
+
"""The implementation of the PyNode CORBA IDL"""
|
|
77
|
+
def __init__(self, nodeName,code,poa,my_container):
|
|
78
|
+
"""Initialize the node : compilation in the local context"""
|
|
79
|
+
Generic.__init__(self,poa)
|
|
80
|
+
self.nodeName=nodeName
|
|
81
|
+
self.code=code
|
|
82
|
+
self.my_container=my_container._container
|
|
83
|
+
linecache.cache[nodeName]=0,None,code.split('\n'),nodeName
|
|
84
|
+
ccode=compile(code,nodeName,'exec')
|
|
85
|
+
self.context={}
|
|
86
|
+
self.context[MY_CONTAINER_ENTRY_IN_GLBS] = self.my_container
|
|
87
|
+
exec(ccode, self.context)
|
|
88
|
+
|
|
89
|
+
def getContainer(self):
|
|
90
|
+
return self.my_container
|
|
91
|
+
|
|
92
|
+
def getCode(self):
|
|
93
|
+
return self.code
|
|
94
|
+
|
|
95
|
+
def getName(self):
|
|
96
|
+
return self.nodeName
|
|
97
|
+
|
|
98
|
+
def defineNewCustomVar(self,varName,valueOfVar):
|
|
99
|
+
self.context[varName] = pickle.loads(valueOfVar)
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
def executeAnotherPieceOfCode(self,code):
|
|
103
|
+
"""Called for initialization of container lodging self."""
|
|
104
|
+
try:
|
|
105
|
+
ccode=compile(code,self.nodeName,'exec')
|
|
106
|
+
exec(ccode, self.context)
|
|
107
|
+
except Exception:
|
|
108
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0))
|
|
109
|
+
|
|
110
|
+
def execute(self,funcName,argsin):
|
|
111
|
+
"""Execute the function funcName found in local context with pickled args (argsin)"""
|
|
112
|
+
try:
|
|
113
|
+
argsin,kws=pickle.loads(argsin)
|
|
114
|
+
func=self.context[funcName]
|
|
115
|
+
argsout=func(*argsin,**kws)
|
|
116
|
+
argsout=pickle.dumps(argsout,-1)
|
|
117
|
+
return argsout
|
|
118
|
+
except Exception:
|
|
119
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
120
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
121
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyNode: %s, function: %s" % (self.nodeName,funcName),0))
|
|
122
|
+
|
|
123
|
+
class SenderByte_i(SALOME__POA.SenderByte,Generic):
|
|
124
|
+
def __init__(self,poa,bytesToSend):
|
|
125
|
+
Generic.__init__(self,poa)
|
|
126
|
+
self.bytesToSend = bytesToSend
|
|
127
|
+
|
|
128
|
+
def getSize(self):
|
|
129
|
+
return len(self.bytesToSend)
|
|
130
|
+
|
|
131
|
+
def sendPart(self,n1,n2):
|
|
132
|
+
return self.bytesToSend[n1:n2]
|
|
133
|
+
|
|
134
|
+
def IsRemote(hostName):
|
|
135
|
+
import socket
|
|
136
|
+
return socket.gethostname() != hostName
|
|
137
|
+
|
|
138
|
+
def RemoveFileSafe( fileName ):
|
|
139
|
+
if os.path.exists( fileName ):
|
|
140
|
+
os.unlink( fileName )
|
|
141
|
+
|
|
142
|
+
def RetrieveRemoteFileLocallyInSameFileName( remoteHostName, fileName):
|
|
143
|
+
""" To customize"""
|
|
144
|
+
dn = os.path.dirname( fileName )
|
|
145
|
+
import subprocess as sp
|
|
146
|
+
p = sp.Popen(["scp","{}:{}".format(remoteHostName,fileName),dn])
|
|
147
|
+
p.communicate()
|
|
148
|
+
|
|
149
|
+
def DestroyRemotely( remoteHostName, fileName):
|
|
150
|
+
import subprocess as sp
|
|
151
|
+
p = sp.Popen(["ssh","-qC","-oStrictHostKeyChecking=no","-oBatchMode=yes",remoteHostName, f"rm {fileName}"])
|
|
152
|
+
p.communicate()
|
|
153
|
+
|
|
154
|
+
class CopyFileFromRemoteCtxMgr:
|
|
155
|
+
def __init__(self, hostName, fileName):
|
|
156
|
+
self._remoteHostName = hostName
|
|
157
|
+
self._fileName = Path(fileName)
|
|
158
|
+
self._isRemote = IsRemote( hostName )
|
|
159
|
+
|
|
160
|
+
def __enter__(self):
|
|
161
|
+
if not self._isRemote:
|
|
162
|
+
return
|
|
163
|
+
dn = self._fileName.parent
|
|
164
|
+
logging.debug(f"[SALOME_PyNode] Creating directory {dn}")
|
|
165
|
+
dn.mkdir(parents=True, exist_ok=True)
|
|
166
|
+
RetrieveRemoteFileLocallyInSameFileName(self._remoteHostName,f"{self._fileName}")
|
|
167
|
+
|
|
168
|
+
def __exit__(self, exctype, exc, tb):
|
|
169
|
+
if not self._isRemote:
|
|
170
|
+
return
|
|
171
|
+
self._fileName.unlink()
|
|
172
|
+
|
|
173
|
+
class BigFileOnDiskBase(abc.ABC):
|
|
174
|
+
"""
|
|
175
|
+
Base class in charge of managing
|
|
176
|
+
Copy or share of file accross computation Nodes
|
|
177
|
+
"""
|
|
178
|
+
def __init__(self, fileName):
|
|
179
|
+
self._file_name = fileName
|
|
180
|
+
|
|
181
|
+
def getFileName(self):
|
|
182
|
+
return self._file_name
|
|
183
|
+
|
|
184
|
+
@abc.abstractmethod
|
|
185
|
+
def get(self, visitor = None):
|
|
186
|
+
"""
|
|
187
|
+
Method called client side of data.
|
|
188
|
+
"""
|
|
189
|
+
raise NotImplementedError
|
|
190
|
+
|
|
191
|
+
@abc.abstractmethod
|
|
192
|
+
def unlink(self):
|
|
193
|
+
"""
|
|
194
|
+
Method called client side of data.
|
|
195
|
+
"""
|
|
196
|
+
raise NotImplementedError
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class BigFileOnDiskShare(BigFileOnDiskBase):
|
|
200
|
+
|
|
201
|
+
def get(self, visitor = None):
|
|
202
|
+
return GetObjectFromFile( self._file_name, visitor )
|
|
203
|
+
|
|
204
|
+
def unlink(self):
|
|
205
|
+
RemoveFileSafe( self._file_name )
|
|
206
|
+
|
|
207
|
+
class BigFileOnDiskSSDNoShare(BigFileOnDiskBase):
|
|
208
|
+
def __init__(self, fileName):
|
|
209
|
+
import socket
|
|
210
|
+
super().__init__( fileName )
|
|
211
|
+
# hostname hosting data
|
|
212
|
+
self._hostname = socket.gethostname()
|
|
213
|
+
|
|
214
|
+
def get(self, visitor = None):
|
|
215
|
+
logging.debug(f"[SALOME_PyNode] Directory {Path(self._file_name).parent} should be created")
|
|
216
|
+
with CopyFileFromRemoteCtxMgr(self._hostname, self._file_name):
|
|
217
|
+
return GetObjectFromFile( self._file_name, visitor )
|
|
218
|
+
|
|
219
|
+
def unlink(self):
|
|
220
|
+
if IsRemote( self._hostname ):
|
|
221
|
+
DestroyRemotely(self._hostname,self._file_name)
|
|
222
|
+
else:
|
|
223
|
+
RemoveFileSafe( self._file_name )
|
|
224
|
+
|
|
225
|
+
BigFileOnDiskClsFromProtocol = { 0 : BigFileOnDiskShare, 1 : BigFileOnDiskSSDNoShare }
|
|
226
|
+
|
|
227
|
+
DicoForProxyFile = { }
|
|
228
|
+
|
|
229
|
+
def GetSizeOfBufferedReader(f):
|
|
230
|
+
"""
|
|
231
|
+
This method returns in bytes size of a file openned.
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
----
|
|
235
|
+
f (io.IOBase): buffered reader returned by open
|
|
236
|
+
|
|
237
|
+
Returns
|
|
238
|
+
-------
|
|
239
|
+
int: number of bytes
|
|
240
|
+
"""
|
|
241
|
+
import io
|
|
242
|
+
pos = f.tell()
|
|
243
|
+
f.seek(0,io.SEEK_END)
|
|
244
|
+
pos2 = f.tell()
|
|
245
|
+
f.seek(pos,io.SEEK_SET)
|
|
246
|
+
return pos2-pos
|
|
247
|
+
|
|
248
|
+
def GetObjectFromFile(fname, visitor = None):
|
|
249
|
+
with open(fname,"rb") as f:
|
|
250
|
+
if visitor:
|
|
251
|
+
visitor.setHDDMem( GetSizeOfBufferedReader(f) )
|
|
252
|
+
visitor.setFileName( fname )
|
|
253
|
+
obj = pickle.load(f)
|
|
254
|
+
return obj
|
|
255
|
+
|
|
256
|
+
def DumpInFile(obj,fname):
|
|
257
|
+
with open(fname,"wb") as f:
|
|
258
|
+
f.write( obj )
|
|
259
|
+
|
|
260
|
+
def IncrRefInFile(fname):
|
|
261
|
+
"""
|
|
262
|
+
:param fname:
|
|
263
|
+
:type fname: str
|
|
264
|
+
"""
|
|
265
|
+
fnameEff = fname.getFileName()
|
|
266
|
+
if fnameEff in DicoForProxyFile:
|
|
267
|
+
DicoForProxyFile[fnameEff] += 1
|
|
268
|
+
else:
|
|
269
|
+
DicoForProxyFile[fnameEff] = 2
|
|
270
|
+
pass
|
|
271
|
+
|
|
272
|
+
def DecrRefInFile(fname):
|
|
273
|
+
"""
|
|
274
|
+
:param fname:
|
|
275
|
+
:type fname: BigFileOnDiskBase
|
|
276
|
+
"""
|
|
277
|
+
if fname.getFileName() not in DicoForProxyFile:
|
|
278
|
+
cnt = 1
|
|
279
|
+
else:
|
|
280
|
+
cnt = DicoForProxyFile[fname.getFileName()]
|
|
281
|
+
DicoForProxyFile[fname.getFileName()] -= 1
|
|
282
|
+
if cnt == 1:
|
|
283
|
+
del DicoForProxyFile[fname.getFileName()]
|
|
284
|
+
if cnt == 1:
|
|
285
|
+
fname.unlink()
|
|
286
|
+
pass
|
|
287
|
+
|
|
288
|
+
def GetBigObjectOnDiskThreshold():
|
|
289
|
+
return KernelBasis.GetBigObjOnDiskThreshold()
|
|
290
|
+
|
|
291
|
+
def ActivateProxyMecanismOrNot( sizeInByte ):
|
|
292
|
+
thres = GetBigObjectOnDiskThreshold()
|
|
293
|
+
if thres == -1:
|
|
294
|
+
return False
|
|
295
|
+
else:
|
|
296
|
+
return sizeInByte > thres
|
|
297
|
+
|
|
298
|
+
class BigObjectDirHandler(abc.ABC):
|
|
299
|
+
def __init__(self, directory):
|
|
300
|
+
self._directory = Path(directory)
|
|
301
|
+
|
|
302
|
+
@property
|
|
303
|
+
def directory(self):
|
|
304
|
+
return self._directory
|
|
305
|
+
|
|
306
|
+
def __enter__(self):
|
|
307
|
+
return self
|
|
308
|
+
|
|
309
|
+
def __exit__(self, exctype, exc, tb):
|
|
310
|
+
return
|
|
311
|
+
|
|
312
|
+
class BigObjectDirHandlerOnDiskShare(BigObjectDirHandler):
|
|
313
|
+
pass
|
|
314
|
+
|
|
315
|
+
class BigObjectDirHandlerOnDiskSSDNoShare(BigObjectDirHandler):
|
|
316
|
+
|
|
317
|
+
def __enter__(self):
|
|
318
|
+
logging.debug(f"[SALOME_PyNode] Creating directory {self._directory}")
|
|
319
|
+
self._directory.mkdir(parents=True, exist_ok=True)
|
|
320
|
+
return self
|
|
321
|
+
|
|
322
|
+
def __exit__(self, exctype, exc, tb):
|
|
323
|
+
pass
|
|
324
|
+
|
|
325
|
+
BigObjectDirHandlerFromProtocol = { 0 : BigObjectDirHandlerOnDiskShare, 1 : BigObjectDirHandlerOnDiskSSDNoShare }
|
|
326
|
+
|
|
327
|
+
def GetBigObjectDirectory():
|
|
328
|
+
import os
|
|
329
|
+
protocol, directory = KernelBasis.GetBigObjOnDiskProtocolAndDirectory()
|
|
330
|
+
if not directory:
|
|
331
|
+
raise RuntimeError("An object of size higher than limit detected and no directory specified to dump it in file !")
|
|
332
|
+
return protocol, os.path.expanduser( os.path.expandvars( directory ) )
|
|
333
|
+
|
|
334
|
+
def GetBigObjectFileName():
|
|
335
|
+
"""
|
|
336
|
+
Return a filename in the most secure manner (see tempfile documentation)
|
|
337
|
+
"""
|
|
338
|
+
import tempfile
|
|
339
|
+
protocol, directory = GetBigObjectDirectory()
|
|
340
|
+
with BigObjectDirHandlerFromProtocol[protocol](directory) as handler:
|
|
341
|
+
with tempfile.NamedTemporaryFile(dir = handler.directory, prefix="mem_", suffix=".pckl") as f:
|
|
342
|
+
ret = f.name
|
|
343
|
+
return BigFileOnDiskClsFromProtocol[protocol]( ret )
|
|
344
|
+
|
|
345
|
+
class BigObjectOnDiskBase:
|
|
346
|
+
def __init__(self, fileName, objSerialized):
|
|
347
|
+
"""
|
|
348
|
+
:param fileName: the file used to dump into.
|
|
349
|
+
:param objSerialized: the object in pickeled form
|
|
350
|
+
:type objSerialized: bytes
|
|
351
|
+
"""
|
|
352
|
+
self._filename = fileName
|
|
353
|
+
# attribute _destroy is here to tell client side or server side
|
|
354
|
+
# only client side can be with _destroy set to True. server side due to risk of concurrency
|
|
355
|
+
# so pickled form of self must be done with this attribute set to False.
|
|
356
|
+
self._destroy = False
|
|
357
|
+
self.__dumpIntoFile(objSerialized)
|
|
358
|
+
|
|
359
|
+
def getDestroyStatus(self):
|
|
360
|
+
return self._destroy
|
|
361
|
+
|
|
362
|
+
def incrRef(self):
|
|
363
|
+
if self._destroy:
|
|
364
|
+
IncrRefInFile( self._filename )
|
|
365
|
+
else:
|
|
366
|
+
# should never happen !
|
|
367
|
+
RuntimeError("Invalid call to incrRef !")
|
|
368
|
+
|
|
369
|
+
def decrRef(self):
|
|
370
|
+
if self._destroy:
|
|
371
|
+
DecrRefInFile( self._filename )
|
|
372
|
+
else:
|
|
373
|
+
# should never happen !
|
|
374
|
+
RuntimeError("Invalid call to decrRef !")
|
|
375
|
+
|
|
376
|
+
def unlinkOnDestructor(self):
|
|
377
|
+
self._destroy = True
|
|
378
|
+
|
|
379
|
+
def doNotTouchFile(self):
|
|
380
|
+
"""
|
|
381
|
+
Method called slave side. The life cycle management of file is client side not slave side.
|
|
382
|
+
"""
|
|
383
|
+
self._destroy = False
|
|
384
|
+
|
|
385
|
+
def __del__(self):
|
|
386
|
+
if self._destroy:
|
|
387
|
+
DecrRefInFile( self._filename )
|
|
388
|
+
|
|
389
|
+
def getFileName(self):
|
|
390
|
+
return self._filename
|
|
391
|
+
|
|
392
|
+
def __dumpIntoFile(self, objSerialized):
|
|
393
|
+
DumpInFile( objSerialized, self._filename.getFileName() )
|
|
394
|
+
|
|
395
|
+
def get(self, visitor = None):
|
|
396
|
+
return self._filename.get(visitor)
|
|
397
|
+
|
|
398
|
+
def __float__(self):
|
|
399
|
+
return float( self.get() )
|
|
400
|
+
|
|
401
|
+
def __int__(self):
|
|
402
|
+
return int( self.get() )
|
|
403
|
+
|
|
404
|
+
def __str__(self):
|
|
405
|
+
obj = self.get()
|
|
406
|
+
if isinstance(obj,str):
|
|
407
|
+
return obj
|
|
408
|
+
else:
|
|
409
|
+
raise RuntimeError("Not a string")
|
|
410
|
+
|
|
411
|
+
class BigObjectOnDisk(BigObjectOnDiskBase):
|
|
412
|
+
def __init__(self, fileName, objSerialized):
|
|
413
|
+
BigObjectOnDiskBase.__init__(self, fileName, objSerialized)
|
|
414
|
+
|
|
415
|
+
class BigObjectOnDiskListElement(BigObjectOnDiskBase):
|
|
416
|
+
def __init__(self, pos, length, fileName):
|
|
417
|
+
self._filename = fileName
|
|
418
|
+
self._destroy = False
|
|
419
|
+
self._pos = pos
|
|
420
|
+
self._length = length
|
|
421
|
+
|
|
422
|
+
def get(self, visitor = None):
|
|
423
|
+
fullObj = BigObjectOnDiskBase.get(self, visitor)
|
|
424
|
+
return fullObj[ self._pos ]
|
|
425
|
+
|
|
426
|
+
def __getitem__(self, i):
|
|
427
|
+
return self.get()[i]
|
|
428
|
+
|
|
429
|
+
def __len__(self):
|
|
430
|
+
return len(self.get())
|
|
431
|
+
|
|
432
|
+
class BigObjectOnDiskSequence(BigObjectOnDiskBase):
|
|
433
|
+
def __init__(self, length, fileName, objSerialized):
|
|
434
|
+
BigObjectOnDiskBase.__init__(self, fileName, objSerialized)
|
|
435
|
+
self._length = length
|
|
436
|
+
|
|
437
|
+
def __getitem__(self, i):
|
|
438
|
+
return BigObjectOnDiskListElement(i, self._length, self.getFileName())
|
|
439
|
+
|
|
440
|
+
def __len__(self):
|
|
441
|
+
return self._length
|
|
442
|
+
|
|
443
|
+
class BigObjectOnDiskList(BigObjectOnDiskSequence):
|
|
444
|
+
def __init__(self, length, fileName, objSerialized):
|
|
445
|
+
BigObjectOnDiskSequence.__init__(self, length, fileName, objSerialized)
|
|
446
|
+
|
|
447
|
+
class BigObjectOnDiskTuple(BigObjectOnDiskSequence):
|
|
448
|
+
def __init__(self, length, fileName, objSerialized):
|
|
449
|
+
BigObjectOnDiskSequence.__init__(self, length, fileName, objSerialized)
|
|
450
|
+
|
|
451
|
+
def ProxyfyPickeled( obj, pickleObjInit = None, visitor = None ):
|
|
452
|
+
"""
|
|
453
|
+
This method return a proxy instance of pickled form of object given in input.
|
|
454
|
+
|
|
455
|
+
Args:
|
|
456
|
+
----
|
|
457
|
+
obj (pickelable type) : object to be proxified
|
|
458
|
+
pickleObjInit (bytes) : Optionnal. Original pickeled form of object to be proxyfied if already computed. If not this method generate it
|
|
459
|
+
|
|
460
|
+
Returns
|
|
461
|
+
-------
|
|
462
|
+
BigObjectOnDiskBase: proxy instance
|
|
463
|
+
"""
|
|
464
|
+
pickleObj = pickleObjInit
|
|
465
|
+
if pickleObj is None:
|
|
466
|
+
pickleObj = pickle.dumps( obj , pickle.HIGHEST_PROTOCOL )
|
|
467
|
+
fileName = GetBigObjectFileName()
|
|
468
|
+
if visitor:
|
|
469
|
+
visitor.setHDDMem( len(pickleObj) )
|
|
470
|
+
visitor.setFileName( fileName.getFileName() )
|
|
471
|
+
if isinstance( obj, list):
|
|
472
|
+
proxyObj = BigObjectOnDiskList( len(obj), fileName, pickleObj )
|
|
473
|
+
elif isinstance( obj, tuple):
|
|
474
|
+
proxyObj = BigObjectOnDiskTuple( len(obj), fileName , pickleObj )
|
|
475
|
+
else:
|
|
476
|
+
proxyObj = BigObjectOnDisk( fileName , pickleObj )
|
|
477
|
+
return proxyObj
|
|
478
|
+
|
|
479
|
+
def SpoolPickleObject( obj, visitor = None ):
|
|
480
|
+
import pickle
|
|
481
|
+
with InOutputObjVisitorCM(visitor) as v:
|
|
482
|
+
pickleObjInit = pickle.dumps( obj , pickle.HIGHEST_PROTOCOL )
|
|
483
|
+
if not ActivateProxyMecanismOrNot( len(pickleObjInit) ):
|
|
484
|
+
return pickleObjInit
|
|
485
|
+
else:
|
|
486
|
+
proxyObj = ProxyfyPickeled( obj, pickleObjInit, v.visitor() )
|
|
487
|
+
pickleProxy = pickle.dumps( proxyObj , pickle.HIGHEST_PROTOCOL )
|
|
488
|
+
return pickleProxy
|
|
489
|
+
|
|
490
|
+
from .SALOME_ContainerHelper import InOutputObjVisitorCM, InOutputObjVisitor
|
|
491
|
+
|
|
492
|
+
def UnProxyObjectSimple( obj, visitor = None ):
|
|
493
|
+
"""
|
|
494
|
+
Method to be called in Remote mode. Alterate the obj _status attribute.
|
|
495
|
+
Because the slave process does not participate in the reference counting
|
|
496
|
+
|
|
497
|
+
Args:
|
|
498
|
+
----
|
|
499
|
+
visitor (InOutputObjVisitor): A visitor to keep track of amount of memory on chip and those on HDD
|
|
500
|
+
|
|
501
|
+
"""
|
|
502
|
+
with InOutputObjVisitorCM(visitor) as v:
|
|
503
|
+
logging.debug( "UnProxyObjectSimple {}".format(type(obj)) )
|
|
504
|
+
if isinstance(obj,BigObjectOnDiskBase):
|
|
505
|
+
obj.doNotTouchFile()
|
|
506
|
+
return obj.get( v )
|
|
507
|
+
elif isinstance( obj, list):
|
|
508
|
+
retObj = []
|
|
509
|
+
for elt in obj:
|
|
510
|
+
retObj.append( UnProxyObjectSimple(elt,v.visitor()) )
|
|
511
|
+
return retObj
|
|
512
|
+
else:
|
|
513
|
+
return obj
|
|
514
|
+
|
|
515
|
+
def UnProxyObjectSimpleLocal( obj ):
|
|
516
|
+
"""
|
|
517
|
+
Method to be called in Local mode. Do not alterate the PyObj counter
|
|
518
|
+
"""
|
|
519
|
+
if isinstance(obj,BigObjectOnDiskBase):
|
|
520
|
+
return obj.get()
|
|
521
|
+
elif isinstance( obj, list):
|
|
522
|
+
retObj = []
|
|
523
|
+
for elt in obj:
|
|
524
|
+
retObj.append( UnProxyObjectSimpleLocal(elt) )
|
|
525
|
+
return retObj
|
|
526
|
+
else:
|
|
527
|
+
return obj
|
|
528
|
+
|
|
529
|
+
class FileHolder:
|
|
530
|
+
def __init__(self, fileName):
|
|
531
|
+
self._filename = fileName
|
|
532
|
+
@property
|
|
533
|
+
def filename(self):
|
|
534
|
+
return self._filename
|
|
535
|
+
|
|
536
|
+
class FileDeleter(FileHolder):
|
|
537
|
+
def __init__(self, fileName):
|
|
538
|
+
super().__init__( fileName )
|
|
539
|
+
def __del__(self):
|
|
540
|
+
import os
|
|
541
|
+
if os.path.exists( self._filename ):
|
|
542
|
+
os.unlink( self._filename )
|
|
543
|
+
|
|
544
|
+
class MonitoringInfo:
|
|
545
|
+
def __init__(self, pyFileName, intervalInMs, outFileName, pid):
|
|
546
|
+
self._py_file_name = pyFileName
|
|
547
|
+
self._interval_in_ms = intervalInMs
|
|
548
|
+
self._out_file_name = outFileName
|
|
549
|
+
self._pid = pid
|
|
550
|
+
|
|
551
|
+
@property
|
|
552
|
+
def pyFileName(self):
|
|
553
|
+
return self._py_file_name
|
|
554
|
+
|
|
555
|
+
@property
|
|
556
|
+
def pid(self):
|
|
557
|
+
return self._pid
|
|
558
|
+
|
|
559
|
+
@pid.setter
|
|
560
|
+
def pid(self, value):
|
|
561
|
+
self._pid = value
|
|
562
|
+
|
|
563
|
+
@property
|
|
564
|
+
def outFileName(self):
|
|
565
|
+
return self._out_file_name
|
|
566
|
+
|
|
567
|
+
@property
|
|
568
|
+
def intervalInMs(self):
|
|
569
|
+
return self._interval_in_ms
|
|
570
|
+
|
|
571
|
+
def FileSystemMonitoring(intervalInMs, dirNameToInspect, outFileName = None):
|
|
572
|
+
"""
|
|
573
|
+
This method loops indefinitely every intervalInMs milliseconds to scan
|
|
574
|
+
number of inodes and size of content recursively included into the in input directory.
|
|
575
|
+
|
|
576
|
+
Args:
|
|
577
|
+
----
|
|
578
|
+
|
|
579
|
+
outFileName (str) : name of file inside the results will be written. If None a new file is generated
|
|
580
|
+
|
|
581
|
+
See also CPUMemoryMonitoring
|
|
582
|
+
"""
|
|
583
|
+
global orb
|
|
584
|
+
import os
|
|
585
|
+
dirNameToInspect2 = os.path.abspath( os.path.expanduser(dirNameToInspect) )
|
|
586
|
+
import tempfile
|
|
587
|
+
from . import KernelBasis
|
|
588
|
+
# outFileNameSave stores the content of outFileName during phase of dumping
|
|
589
|
+
with tempfile.NamedTemporaryFile(prefix="fs_monitor_",suffix=".txt") as f:
|
|
590
|
+
outFileNameSave = f.name
|
|
591
|
+
with tempfile.NamedTemporaryFile(prefix="fs_monitor_",suffix=".py") as f:
|
|
592
|
+
tempPyFile = f.name
|
|
593
|
+
tempOutFile = outFileName
|
|
594
|
+
if tempOutFile is None:
|
|
595
|
+
tempOutFile = "{}.txt".format( os.path.splitext( tempPyFile )[0] )
|
|
596
|
+
with open(tempPyFile,"w") as f:
|
|
597
|
+
f.write("""
|
|
598
|
+
import subprocess as sp
|
|
599
|
+
import re
|
|
600
|
+
import os
|
|
601
|
+
import time
|
|
602
|
+
import datetime
|
|
603
|
+
with open("{tempOutFile}","a") as f:
|
|
604
|
+
f.write( "{{}}\\n".format( "{dirNameToInspect2}" ) )
|
|
605
|
+
f.write( "{{}}\\n".format( "{intervalInMs}" ) )
|
|
606
|
+
while(True):
|
|
607
|
+
nbinodes = -1
|
|
608
|
+
try:
|
|
609
|
+
nbinodes = sp.check_output("{{}} | wc -l".format( " ".join(["find","{dirNameToInspect2}"]), ), shell = True).decode().strip()
|
|
610
|
+
except:
|
|
611
|
+
pass
|
|
612
|
+
szOfDirStr = "fail"
|
|
613
|
+
try:
|
|
614
|
+
st = sp.check_output(["du","-sh","{dirNameToInspect2}"]).decode()
|
|
615
|
+
szOfDirStr = re.split("[\s]+",st)[0]
|
|
616
|
+
except:
|
|
617
|
+
pass
|
|
618
|
+
f.write( "{{}}\\n".format( str( datetime.datetime.now().timestamp() ) ) )
|
|
619
|
+
f.write( "{{}}\\n".format( str( nbinodes ) ) )
|
|
620
|
+
f.write( "{{}}\\n".format( str( szOfDirStr ) ) )
|
|
621
|
+
f.flush()
|
|
622
|
+
time.sleep( {intervalInMs} / 1000.0 )
|
|
623
|
+
""".format( **locals()))
|
|
624
|
+
logging.debug( "File for FS monitoring dump file : {}".format(tempPyFile) )
|
|
625
|
+
pyFileName = FileDeleter( tempPyFile )
|
|
626
|
+
if outFileName is None:
|
|
627
|
+
outFileName = FileDeleter( tempOutFile )
|
|
628
|
+
else:
|
|
629
|
+
outFileName = FileHolder(outFileName)
|
|
630
|
+
return MonitoringInfo(pyFileName, intervalInMs, outFileName, None)
|
|
631
|
+
|
|
632
|
+
def CPUMemoryMonitoring( intervalInMs, outFileName = None ):
|
|
633
|
+
"""
|
|
634
|
+
Launch a subprocess monitoring self process.
|
|
635
|
+
This monitoring subprocess is a python process lauching every intervalInMs ms evaluation of
|
|
636
|
+
CPU usage and RSS memory of the calling process.
|
|
637
|
+
Communication between subprocess and self is done by file.
|
|
638
|
+
|
|
639
|
+
Args:
|
|
640
|
+
----
|
|
641
|
+
outFileName (str) : name of file inside the results will be written. If None a new file is generated
|
|
642
|
+
|
|
643
|
+
See also FileSystemMonitoring
|
|
644
|
+
"""
|
|
645
|
+
from . import KernelBasis
|
|
646
|
+
def BuildPythonFileForCPUPercent( intervalInMs, outFileName):
|
|
647
|
+
import os
|
|
648
|
+
import tempfile
|
|
649
|
+
with tempfile.NamedTemporaryFile(prefix="cpu_mem_monitor_",suffix=".py") as f:
|
|
650
|
+
tempPyFile = f.name
|
|
651
|
+
tempOutFile = outFileName
|
|
652
|
+
if tempOutFile is None:
|
|
653
|
+
tempOutFile = "{}.txt".format( os.path.splitext( tempPyFile )[0] )
|
|
654
|
+
pid = os.getpid()
|
|
655
|
+
with open(tempPyFile,"w") as f:
|
|
656
|
+
f.write("""import psutil
|
|
657
|
+
pid = {}
|
|
658
|
+
process = psutil.Process( pid )
|
|
659
|
+
def getChargeOf( p ):
|
|
660
|
+
a,b = p.cpu_percent(), p.memory_info().rss
|
|
661
|
+
try:
|
|
662
|
+
for c in p.children():
|
|
663
|
+
a += c.cpu_percent(interval=0.01) ; b += c.memory_info().rss
|
|
664
|
+
except:
|
|
665
|
+
pass
|
|
666
|
+
return a,b
|
|
667
|
+
import time
|
|
668
|
+
with open("{}","a") as f:
|
|
669
|
+
f.write( "{{}}\\n".format( "{}" ) )
|
|
670
|
+
while True:
|
|
671
|
+
cpu,mem_rss = getChargeOf( process )
|
|
672
|
+
f.write( "{{}}\\n".format( str( cpu ) ) )
|
|
673
|
+
f.write( "{{}}\\n".format( str( mem_rss ) ) )
|
|
674
|
+
f.flush()
|
|
675
|
+
time.sleep( {} / 1000.0 )
|
|
676
|
+
""".format(pid, tempOutFile, intervalInMs, intervalInMs))
|
|
677
|
+
if outFileName is None:
|
|
678
|
+
autoOutFile = FileDeleter(tempOutFile)
|
|
679
|
+
else:
|
|
680
|
+
autoOutFile = FileHolder(tempOutFile)
|
|
681
|
+
return FileDeleter(tempPyFile),autoOutFile
|
|
682
|
+
pyFileName, outFileName = BuildPythonFileForCPUPercent( intervalInMs, outFileName )
|
|
683
|
+
return MonitoringInfo(pyFileName, intervalInMs, outFileName, None)
|
|
684
|
+
|
|
685
|
+
class GenericPythonMonitoringLauncherCtxMgr:
|
|
686
|
+
def __init__(self, monitoringParams):
|
|
687
|
+
"""
|
|
688
|
+
Args:
|
|
689
|
+
----
|
|
690
|
+
monitoringParams (MonitoringInfo)
|
|
691
|
+
"""
|
|
692
|
+
self._monitoring_params = monitoringParams
|
|
693
|
+
def __enter__(self):
|
|
694
|
+
from . import KernelBasis
|
|
695
|
+
pid = KernelBasis.LaunchMonitoring(self._monitoring_params.pyFileName.filename)
|
|
696
|
+
self._monitoring_params.pid = pid
|
|
697
|
+
return self._monitoring_params
|
|
698
|
+
|
|
699
|
+
def __exit__(self,exctype, exc, tb):
|
|
700
|
+
StopMonitoring( self._monitoring_params )
|
|
701
|
+
del self._monitoring_params
|
|
702
|
+
import gc
|
|
703
|
+
gc.collect() # force destruction of objects even in raise context
|
|
704
|
+
|
|
705
|
+
def StopMonitoring( monitoringInfo ):
|
|
706
|
+
"""
|
|
707
|
+
Kill monitoring subprocess.
|
|
708
|
+
|
|
709
|
+
Args:
|
|
710
|
+
----
|
|
711
|
+
monitoringInfo (MonitoringInfo): info returned by LaunchMonitoring
|
|
712
|
+
"""
|
|
713
|
+
from . import KernelBasis
|
|
714
|
+
KernelBasis.StopMonitoring(monitoringInfo.pid)
|
|
715
|
+
|
|
716
|
+
class CPUMemInfo:
|
|
717
|
+
def __init__(self, intervalInMs, cpu, mem_rss):
|
|
718
|
+
"""
|
|
719
|
+
Args:
|
|
720
|
+
----
|
|
721
|
+
intervalInMs (int)
|
|
722
|
+
cpu (list<float>) CPU usage
|
|
723
|
+
mem_rss (list<int>) rss memory usage
|
|
724
|
+
"""
|
|
725
|
+
self._interval_in_ms = intervalInMs
|
|
726
|
+
self._data = [(a,b) for a,b in zip(cpu,mem_rss)]
|
|
727
|
+
def __str__(self):
|
|
728
|
+
st = """Interval in ms : {self.intervalInMs}
|
|
729
|
+
Data : ${self.data}
|
|
730
|
+
""".format( **locals() )
|
|
731
|
+
return st
|
|
732
|
+
@property
|
|
733
|
+
def intervalInMs(self):
|
|
734
|
+
return self._interval_in_ms
|
|
735
|
+
@property
|
|
736
|
+
def data(self):
|
|
737
|
+
"""
|
|
738
|
+
list of triplets. First param of pair is cpu usage
|
|
739
|
+
Second param of pair is memory usage
|
|
740
|
+
"""
|
|
741
|
+
return self._data
|
|
742
|
+
|
|
743
|
+
def ReadCPUMemInfoInternal( fileName ):
|
|
744
|
+
intervalInMs = 0
|
|
745
|
+
cpu = [] ; mem_rss = []
|
|
746
|
+
if os.path.exists( fileName ):
|
|
747
|
+
try:
|
|
748
|
+
with open(fileName, "r") as f:
|
|
749
|
+
coarseData = [ elt.strip() for elt in f.readlines() ]
|
|
750
|
+
intervalInMs = int( coarseData[0] )
|
|
751
|
+
coarseData = coarseData[1:]
|
|
752
|
+
cpu = [float(elt) for elt in coarseData[::2]]
|
|
753
|
+
mem_rss = [ int(elt) for elt in coarseData[1::2]]
|
|
754
|
+
except:
|
|
755
|
+
pass
|
|
756
|
+
return CPUMemInfo(intervalInMs,cpu,mem_rss)
|
|
757
|
+
|
|
758
|
+
def ReadCPUMemInfo( monitoringInfo ):
|
|
759
|
+
"""
|
|
760
|
+
Retrieve CPU/Mem data of monitoring.
|
|
761
|
+
|
|
762
|
+
Args:
|
|
763
|
+
----
|
|
764
|
+
monitoringInfo (MonitoringInfo): info returned by LaunchMonitoring
|
|
765
|
+
|
|
766
|
+
Returns
|
|
767
|
+
-------
|
|
768
|
+
CPUMemInfo instance
|
|
769
|
+
"""
|
|
770
|
+
return ReadCPUMemInfoInternal( monitoringInfo.outFileName.filename )
|
|
771
|
+
|
|
772
|
+
class InodeSizeInfo:
|
|
773
|
+
def __init__(self, dirNameMonitored, intervalInMs, timeStamps, nbInodes, volumeOfDir):
|
|
774
|
+
"""
|
|
775
|
+
Args:
|
|
776
|
+
----
|
|
777
|
+
timeStamps (list<datetimestruct>)
|
|
778
|
+
nbInodes (list<int>)
|
|
779
|
+
volumeOfDir (list<str>)
|
|
780
|
+
"""
|
|
781
|
+
self._dir_name_monitored = dirNameMonitored
|
|
782
|
+
self._interval_in_ms = intervalInMs
|
|
783
|
+
self._data = [(t,a,b) for t,a,b in zip(timeStamps,nbInodes,volumeOfDir)]
|
|
784
|
+
def __str__(self):
|
|
785
|
+
st = """Filename monitored : {self.dirNameMonitored}
|
|
786
|
+
Interval in ms : ${self.intervalInMs}
|
|
787
|
+
Data : ${self.data}
|
|
788
|
+
""".format( **locals() )
|
|
789
|
+
return st
|
|
790
|
+
@property
|
|
791
|
+
def dirNameMonitored(self):
|
|
792
|
+
return self._dir_name_monitored
|
|
793
|
+
@property
|
|
794
|
+
def intervalInMs(self):
|
|
795
|
+
return self._interval_in_ms
|
|
796
|
+
@property
|
|
797
|
+
def data(self):
|
|
798
|
+
"""
|
|
799
|
+
list of triplets. First param of triplet is datetimestruct
|
|
800
|
+
Second param of triplet is #inodes.
|
|
801
|
+
Thirst param of triplet is size.
|
|
802
|
+
"""
|
|
803
|
+
return self._data
|
|
804
|
+
|
|
805
|
+
def ReadInodeSizeInfoInternal( fileName ):
|
|
806
|
+
import datetime
|
|
807
|
+
import os
|
|
808
|
+
with open(fileName, "r") as f:
|
|
809
|
+
coarseData = [ elt.strip() for elt in f.readlines() ]
|
|
810
|
+
dirNameMonitored = coarseData[0] ; intervalInMs = int( coarseData[1] ) ; coarseData = coarseData[2:]
|
|
811
|
+
tss = [ datetime.datetime.fromtimestamp( float(elt) ) for elt in coarseData[::3] ]
|
|
812
|
+
nbInodes = [int(elt) for elt in coarseData[1::3]]
|
|
813
|
+
volumeOfDir = coarseData[2::3]
|
|
814
|
+
return InodeSizeInfo(dirNameMonitored,intervalInMs,tss,nbInodes,volumeOfDir)
|
|
815
|
+
|
|
816
|
+
def ReadInodeSizeInfo( monitoringInfo ):
|
|
817
|
+
"""
|
|
818
|
+
Retrieve nb of inodes and size of monitoring
|
|
819
|
+
|
|
820
|
+
Args:
|
|
821
|
+
----
|
|
822
|
+
monitoringInfo (MonitoringInfo): info returned by LaunchMonitoring
|
|
823
|
+
|
|
824
|
+
Returns
|
|
825
|
+
-------
|
|
826
|
+
InodeSizeInfo
|
|
827
|
+
"""
|
|
828
|
+
return ReadInodeSizeInfoInternal( monitoringInfo.outFileName.filename )
|
|
829
|
+
|
|
830
|
+
class SeqByteReceiver:
|
|
831
|
+
# 2GB limit to trigger split into chunks
|
|
832
|
+
CHUNK_SIZE = 2000000000
|
|
833
|
+
def __init__(self,sender):
|
|
834
|
+
self._obj = sender
|
|
835
|
+
def __del__(self):
|
|
836
|
+
self._obj.UnRegister()
|
|
837
|
+
pass
|
|
838
|
+
def data(self):
|
|
839
|
+
size = self._obj.getSize()
|
|
840
|
+
if size <= SeqByteReceiver.CHUNK_SIZE:
|
|
841
|
+
return self.fetchOneShot( size )
|
|
842
|
+
else:
|
|
843
|
+
return self.fetchByChunks( size )
|
|
844
|
+
def fetchOneShot(self,size):
|
|
845
|
+
return self._obj.sendPart(0,size)
|
|
846
|
+
def fetchByChunks(self,size):
|
|
847
|
+
"""
|
|
848
|
+
To avoid memory peak parts over 2GB are sent using EFF_CHUNK_SIZE size.
|
|
849
|
+
"""
|
|
850
|
+
data_for_split_case = bytes(0)
|
|
851
|
+
EFF_CHUNK_SIZE = SeqByteReceiver.CHUNK_SIZE // 8
|
|
852
|
+
iStart = 0 ; iEnd = EFF_CHUNK_SIZE
|
|
853
|
+
while iStart!=iEnd and iEnd <= size:
|
|
854
|
+
part = self._obj.sendPart(iStart,iEnd)
|
|
855
|
+
data_for_split_case = bytes(0).join( [data_for_split_case,part] )
|
|
856
|
+
iStart = iEnd; iEnd = min(iStart + EFF_CHUNK_SIZE,size)
|
|
857
|
+
return data_for_split_case
|
|
858
|
+
|
|
859
|
+
FinalCode = """import pickle
|
|
860
|
+
from salome.kernel.SALOME_PyNode import LogOfCurrentExecutionSession,MY_PERFORMANCE_LOG_ENTRY_IN_GLBS
|
|
861
|
+
from salome.kernel.SALOME_PyNode import ExchangeModeServerSideFactory
|
|
862
|
+
from salome.kernel.KernelBasis import VerbosityActivated,SetVerbosityLevel,SetVerbosityActivated
|
|
863
|
+
from salome.kernel.salome_utils import positionVerbosityOfLoggerRegardingState
|
|
864
|
+
from salome.kernel import Engines
|
|
865
|
+
from salome.kernel import salome
|
|
866
|
+
import os
|
|
867
|
+
import sys
|
|
868
|
+
salome.salome_init()
|
|
869
|
+
from datetime import datetime
|
|
870
|
+
SetVerbosityActivated( {} )
|
|
871
|
+
SetVerbosityLevel( "{}" )
|
|
872
|
+
positionVerbosityOfLoggerRegardingState()
|
|
873
|
+
# WorkDir may be important to replay : "{}"
|
|
874
|
+
orb = salome.orb
|
|
875
|
+
caseDirectory = "{}"
|
|
876
|
+
contextExchangeMode = "{}"
|
|
877
|
+
bigObjExchanger = ExchangeModeServerSideFactory( contextExchangeMode )
|
|
878
|
+
codeFileName = os.path.join( caseDirectory, "{}" )
|
|
879
|
+
inputFileName = "{}"
|
|
880
|
+
outputFileName = "{}"
|
|
881
|
+
outputsKeys = {}
|
|
882
|
+
exec( "{{}} = LogOfCurrentExecutionSession( orb.string_to_object( \\"{}\\" ) )".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) )
|
|
883
|
+
if VerbosityActivated():
|
|
884
|
+
eval( "{{}}".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) ).addFreestyleAndFlush( ("b4loadctx",datetime.now()) )
|
|
885
|
+
context = bigObjExchanger.buildContextPointEntry(caseDirectory,inputFileName)
|
|
886
|
+
if VerbosityActivated():
|
|
887
|
+
eval( "{{}}".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) ).addFreestyleAndFlush( ("afterloadctx",datetime.now()) )
|
|
888
|
+
context[MY_PERFORMANCE_LOG_ENTRY_IN_GLBS] = eval( MY_PERFORMANCE_LOG_ENTRY_IN_GLBS )
|
|
889
|
+
with open(codeFileName,"r") as f:
|
|
890
|
+
code = f.read()
|
|
891
|
+
# go for execution
|
|
892
|
+
if VerbosityActivated():
|
|
893
|
+
eval( "{{}}".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) ).addFreestyleAndFlush( ("bforeexec",datetime.now()) )
|
|
894
|
+
exec( code , context )
|
|
895
|
+
if VerbosityActivated():
|
|
896
|
+
eval( "{{}}".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) ).addFreestyleAndFlush( ("afterexec",datetime.now()) )
|
|
897
|
+
# filter part of context to be exported to father process
|
|
898
|
+
context = dict( [(k,v) for k,v in context.items() if k in outputsKeys] )
|
|
899
|
+
if VerbosityActivated():
|
|
900
|
+
eval( "{{}}".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) ).addFreestyleAndFlush( ("strtdumpout",datetime.now()) )
|
|
901
|
+
#
|
|
902
|
+
bigObjExchanger.pushContext(outputFileName,context)
|
|
903
|
+
if VerbosityActivated():
|
|
904
|
+
eval( "{{}}".format(MY_PERFORMANCE_LOG_ENTRY_IN_GLBS) ).addFreestyleAndFlush( ("afterdump",datetime.now()) )
|
|
905
|
+
"""
|
|
906
|
+
|
|
907
|
+
class PythonFunctionEvaluatorParams:
|
|
908
|
+
def __init__(self, mainFileName, codeFileName, inContextFileName, outContextFileName):
|
|
909
|
+
"""
|
|
910
|
+
:param outContextFileName: instance of ExchangeContextCltAbs
|
|
911
|
+
"""
|
|
912
|
+
self._main_filename = mainFileName
|
|
913
|
+
self._code_filename = codeFileName
|
|
914
|
+
self._in_context_filename = inContextFileName
|
|
915
|
+
self._out_context_filename = outContextFileName
|
|
916
|
+
@property
|
|
917
|
+
def result(self):
|
|
918
|
+
return self._out_context_filename.retrieveRemoteContext()
|
|
919
|
+
|
|
920
|
+
def destroyOnOKAndReplay(self):
|
|
921
|
+
self._out_context_filename.removeContextSupport( True )
|
|
922
|
+
for fileToDestroy in [self._main_filename,self._code_filename,self._in_context_filename]:
|
|
923
|
+
if os.path.exists( fileToDestroy ):
|
|
924
|
+
os.unlink( fileToDestroy )
|
|
925
|
+
def destroyOnKOAndReplay(self, containerRef):
|
|
926
|
+
"""
|
|
927
|
+
Called in the context of failure with replay mode activated
|
|
928
|
+
"""
|
|
929
|
+
self._out_context_filename.removeContextSupport( False )
|
|
930
|
+
# register to container files group associated to the
|
|
931
|
+
containerRef.addLogFileNameGroup([self._main_filename,self._code_filename,self._in_context_filename])
|
|
932
|
+
|
|
933
|
+
@property
|
|
934
|
+
def replayCmd(self):
|
|
935
|
+
return "To replay : ( cd {} && python3 {} )".format(os.path.dirname(self._main_filename),os.path.basename(self._main_filename))
|
|
936
|
+
|
|
937
|
+
@property
|
|
938
|
+
def cleanOperations(self):
|
|
939
|
+
import os
|
|
940
|
+
return "To clean files : ( cd {} && rm {} )".format( os.path.dirname(self._main_filename)," ".join( [os.path.basename(self._main_filename),os.path.basename(self._code_filename),os.path.basename(self._in_context_filename)] ) )
|
|
941
|
+
|
|
942
|
+
def strDependingOnReturnCode(self, keepFilesToReplay, returnCode):
|
|
943
|
+
if returnCode == -1:
|
|
944
|
+
return f"return with non zero code ({returnCode})"
|
|
945
|
+
else:
|
|
946
|
+
banner = 200*"*"
|
|
947
|
+
if keepFilesToReplay:
|
|
948
|
+
return f"""return with non zero code ({returnCode})
|
|
949
|
+
{banner}
|
|
950
|
+
Looks like a hard crash as returnCode {returnCode} != 0
|
|
951
|
+
{self.replayCmd}
|
|
952
|
+
{self.cleanOperations}
|
|
953
|
+
{banner}
|
|
954
|
+
"""
|
|
955
|
+
else:
|
|
956
|
+
return f"""return with non zero code ({returnCode})
|
|
957
|
+
{banner}
|
|
958
|
+
Looks like a hard crash as returnCode {returnCode} != 0
|
|
959
|
+
{banner}
|
|
960
|
+
"""
|
|
961
|
+
|
|
962
|
+
class ExchangeContextBridgeAbs(abc.ABC):
|
|
963
|
+
def __init__(self):
|
|
964
|
+
pass
|
|
965
|
+
|
|
966
|
+
@abc.abstractmethod
|
|
967
|
+
def buildContextPointEntry(self, caseDir, contextEntry):
|
|
968
|
+
raise RuntimeError("Must be overloaded")
|
|
969
|
+
|
|
970
|
+
@abc.abstractmethod
|
|
971
|
+
def pushContext(self, contextPointEntry, contextEntry):
|
|
972
|
+
raise RuntimeError("Must be overloaded")
|
|
973
|
+
|
|
974
|
+
class ExchangeContextUsingFile( ExchangeContextBridgeAbs ):
|
|
975
|
+
def buildContextPointEntry(self, caseDir, contextEntry):
|
|
976
|
+
self._case_dir = caseDir
|
|
977
|
+
inputFileName = os.path.join( self._case_dir, contextEntry )
|
|
978
|
+
with open(inputFileName,"rb") as f:
|
|
979
|
+
context = pickle.load( f )
|
|
980
|
+
return context
|
|
981
|
+
|
|
982
|
+
def pushContext(self, contextPointEntry, context):
|
|
983
|
+
outputFileName = os.path.join( self._case_dir, contextPointEntry )
|
|
984
|
+
with open(outputFileName,"wb") as f:
|
|
985
|
+
pickle.dump( context, f )
|
|
986
|
+
|
|
987
|
+
class ContextExchanger_i(Engines__POA.ContextExchanger):
|
|
988
|
+
"""
|
|
989
|
+
In TCP mode, servant hosted SALOME_Container side.
|
|
990
|
+
"""
|
|
991
|
+
def __init__(self, inCtx):
|
|
992
|
+
from . import salome
|
|
993
|
+
self._poa = salome.orb.resolve_initial_references("RootPOA")
|
|
994
|
+
self._in_ctx = inCtx
|
|
995
|
+
self._out_ctx = bytes(0)
|
|
996
|
+
|
|
997
|
+
def getPOA(self):
|
|
998
|
+
return self._poa
|
|
999
|
+
|
|
1000
|
+
def getInputContext(self):
|
|
1001
|
+
obj = SenderByte_i(self._poa, pickle.dumps( self._in_ctx ) ) ; id_o = self._poa.activate_object(obj) ; refPtr = self._poa.id_to_reference(id_o)
|
|
1002
|
+
return refPtr
|
|
1003
|
+
|
|
1004
|
+
def pushOutputContext(self, ctx):
|
|
1005
|
+
try:
|
|
1006
|
+
self._out_ctx += ctx
|
|
1007
|
+
except Exception as e:
|
|
1008
|
+
raise SALOME.SALOME_Exception( SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR,str(e),"pushOutputContext",0) )
|
|
1009
|
+
|
|
1010
|
+
def finishPushContext(self):
|
|
1011
|
+
try:
|
|
1012
|
+
self._output_context = pickle.loads( self._out_ctx )
|
|
1013
|
+
except Exception as e:
|
|
1014
|
+
raise SALOME.SALOME_Exception( SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR,str(e),"finishPushContext",0) )
|
|
1015
|
+
|
|
1016
|
+
def getOutputContext(self):
|
|
1017
|
+
return self._output_context
|
|
1018
|
+
|
|
1019
|
+
class ExchangeContextUsingTCP( ExchangeContextBridgeAbs ):
|
|
1020
|
+
def buildContextPointEntry(self, caseDir, contextEntry):
|
|
1021
|
+
from . import salome
|
|
1022
|
+
salome.salome_init()
|
|
1023
|
+
self._orb = salome.orb
|
|
1024
|
+
self._data_exchange_channel = self._orb.string_to_object( contextEntry )
|
|
1025
|
+
return pickle.loads( SeqByteReceiver( self._data_exchange_channel.getInputContext() ).data() )
|
|
1026
|
+
|
|
1027
|
+
def pushContext(self, contextPointEntry, context):
|
|
1028
|
+
ctxBytes = pickle.dumps( context )
|
|
1029
|
+
size = len( ctxBytes )
|
|
1030
|
+
if size <= SeqByteReceiver.CHUNK_SIZE:
|
|
1031
|
+
self._data_exchange_channel.pushOutputContext( ctxBytes )
|
|
1032
|
+
else:
|
|
1033
|
+
EFF_CHUNK_SIZE = SeqByteReceiver.CHUNK_SIZE // 8
|
|
1034
|
+
iStart = 0 ; iEnd = EFF_CHUNK_SIZE
|
|
1035
|
+
while iStart!=iEnd and iEnd <= size:
|
|
1036
|
+
self._data_exchange_channel.pushOutputContext( ctxBytes[iStart:iEnd] )
|
|
1037
|
+
iStart = iEnd; iEnd = min(iStart + EFF_CHUNK_SIZE,size)
|
|
1038
|
+
self._data_exchange_channel.finishPushContext()
|
|
1039
|
+
|
|
1040
|
+
def ExchangeModeServerSideFactory( exchangeMode ):
|
|
1041
|
+
if exchangeMode == "File":
|
|
1042
|
+
return ExchangeContextUsingFile()
|
|
1043
|
+
elif exchangeMode == "TCP":
|
|
1044
|
+
return ExchangeContextUsingTCP()
|
|
1045
|
+
else:
|
|
1046
|
+
raise RuntimeError( f"ExchangeModeServerSideFactory : {exchangeMode} not in [File,TCP]" )
|
|
1047
|
+
|
|
1048
|
+
class ExchangeContextCltAbs(abc.ABC):
|
|
1049
|
+
def __init__(self):
|
|
1050
|
+
pass
|
|
1051
|
+
|
|
1052
|
+
@abc.abstractmethod
|
|
1053
|
+
def hostInputContext(self, dirForReplayFiles, contextFileBaseName, context):
|
|
1054
|
+
raise RuntimeError("Must be overloaded")
|
|
1055
|
+
|
|
1056
|
+
@abc.abstractmethod
|
|
1057
|
+
def setOutputContextEntryPoint(self, dirForReplayFiles, outCtxtEntryPoint):
|
|
1058
|
+
raise RuntimeError("Must be overloaded")
|
|
1059
|
+
|
|
1060
|
+
@abc.abstractmethod
|
|
1061
|
+
def retrieveRemoteContext(self):
|
|
1062
|
+
raise RuntimeError("Must be overloaded")
|
|
1063
|
+
|
|
1064
|
+
@abc.abstractmethod
|
|
1065
|
+
def removeContextSupport(self, isOK):
|
|
1066
|
+
raise RuntimeError("Must be overloaded")
|
|
1067
|
+
|
|
1068
|
+
class ExchangeContextUsingFileClt(ExchangeContextCltAbs):
|
|
1069
|
+
|
|
1070
|
+
def __init__(self, keepFilesToReplay):
|
|
1071
|
+
self._keep_in_files = keepFilesToReplay
|
|
1072
|
+
|
|
1073
|
+
def hostInputContext(self, dirForReplayFiles, contextFileBaseName, context):
|
|
1074
|
+
self._in_ctx_entry_point = os.path.join( dirForReplayFiles, contextFileBaseName)
|
|
1075
|
+
with open(self._in_ctx_entry_point,"wb") as contextFd:
|
|
1076
|
+
pickle.dump( context, contextFd)
|
|
1077
|
+
return os.path.basename( self._in_ctx_entry_point )
|
|
1078
|
+
|
|
1079
|
+
def setOutputContextEntryPoint(self, dirForReplayFiles, outCtxtEntryPoint):
|
|
1080
|
+
self._out_ctx_entry_point = os.path.join( dirForReplayFiles, outCtxtEntryPoint )
|
|
1081
|
+
return os.path.basename( self._out_ctx_entry_point )
|
|
1082
|
+
|
|
1083
|
+
def retrieveRemoteContext(self):
|
|
1084
|
+
with open(self._out_ctx_entry_point,"rb") as f:
|
|
1085
|
+
return pickle.load( f )
|
|
1086
|
+
|
|
1087
|
+
def removeContextSupport(self, isOK):
|
|
1088
|
+
fileNamesToRm = [self._out_ctx_entry_point]
|
|
1089
|
+
if isOK or not self._keep_in_files:
|
|
1090
|
+
fileNamesToRm += [self._in_ctx_entry_point]
|
|
1091
|
+
for fileName in fileNamesToRm:
|
|
1092
|
+
if os.path.exists( fileName ):
|
|
1093
|
+
os.unlink( fileName )
|
|
1094
|
+
|
|
1095
|
+
class ExchangeContextUsingTCPClt(ExchangeContextCltAbs):
|
|
1096
|
+
|
|
1097
|
+
def hostInputContext(self, dirForReplayFiles, contextFileBaseName, context):
|
|
1098
|
+
from . import salome
|
|
1099
|
+
self._servant = ContextExchanger_i(context)
|
|
1100
|
+
poa = self._servant.getPOA()
|
|
1101
|
+
self._id_o = poa.activate_object(self._servant) ; refPtr = poa.id_to_reference(self._id_o)
|
|
1102
|
+
self._portable_serv_entry = salome.orb.object_to_string( refPtr )
|
|
1103
|
+
return self._portable_serv_entry
|
|
1104
|
+
|
|
1105
|
+
def setOutputContextEntryPoint(self, dirForReplayFiles, outCtxtEntryPoint):
|
|
1106
|
+
return self._portable_serv_entry
|
|
1107
|
+
|
|
1108
|
+
def retrieveRemoteContext(self):
|
|
1109
|
+
return self._servant.getOutputContext()
|
|
1110
|
+
|
|
1111
|
+
def removeContextSupport(self, isOK):# isOK ignored. Because in memory mode nothing to save
|
|
1112
|
+
poa = self._servant.getPOA()
|
|
1113
|
+
poa.deactivate_object(self._id_o)
|
|
1114
|
+
del self._servant
|
|
1115
|
+
import gc
|
|
1116
|
+
gc.collect()
|
|
1117
|
+
|
|
1118
|
+
def ExchangeModeCltSideFactory( exchangeMode, keepFilesToReplay ):
|
|
1119
|
+
if exchangeMode == "File":
|
|
1120
|
+
return ExchangeContextUsingFileClt(keepFilesToReplay)
|
|
1121
|
+
elif exchangeMode == "TCP":
|
|
1122
|
+
return ExchangeContextUsingTCPClt()
|
|
1123
|
+
else:
|
|
1124
|
+
raise RuntimeError( f"ExchangeModeCltSideFactory : {exchangeMode} not in [File,TCP]" )
|
|
1125
|
+
|
|
1126
|
+
def ExecCrashProofGeneric( code, context, outargsname, containerRef, instanceOfLogOfCurrentSession, keepFilesToReplay, closeEyesOnErrorAtExit):
|
|
1127
|
+
"""
|
|
1128
|
+
Equivalent of exec(code,context) but executed in a separate subprocess to avoid to make the current process crash.
|
|
1129
|
+
|
|
1130
|
+
Args:
|
|
1131
|
+
-----
|
|
1132
|
+
|
|
1133
|
+
code (str) : python code to be executed using context
|
|
1134
|
+
context (dict) : context to be used for execution. This context will be updated in accordance with the execution of code.
|
|
1135
|
+
outargsname (list<str>) : list of arguments to be exported
|
|
1136
|
+
containerRef (Engines.Container) : Container ref (retrieving the Files to created when keepFilesToReplay is set to False)
|
|
1137
|
+
instanceOfLogOfCurrentSession (LogOfCurrentExecutionSession) : instance of LogOfCurrentExecutionSession to build remotely the reference in order to log information
|
|
1138
|
+
keepFilesToReplay (bool) : if True when something goes wrong during execution all the files to replay post mortem case are kept. If False only error is reported but files to replay are destoyed.
|
|
1139
|
+
closeEyesOnErrorAtExit (bool) : if True in case of crash of subprocess, if MY_KEY_TO_DETECT_FINISH is displayed at the end of stdout
|
|
1140
|
+
|
|
1141
|
+
Return:
|
|
1142
|
+
-------
|
|
1143
|
+
|
|
1144
|
+
ScriptExecInfo : instance serverside
|
|
1145
|
+
|
|
1146
|
+
In/Out:
|
|
1147
|
+
-------
|
|
1148
|
+
|
|
1149
|
+
context will be modified by this method. elts in outargsname will be added and their corresponding value coming from evaluation.
|
|
1150
|
+
"""
|
|
1151
|
+
import tempfile
|
|
1152
|
+
import pickle
|
|
1153
|
+
import subprocess as sp
|
|
1154
|
+
import logging
|
|
1155
|
+
#
|
|
1156
|
+
def IsConsideredAsOKRun( returnCode, closeEyesOnErrorAtExit , stderr ):
|
|
1157
|
+
def StdErrTreatment(closeEyesOnErrorAtExit , stderr):
|
|
1158
|
+
if not closeEyesOnErrorAtExit:
|
|
1159
|
+
return stderr
|
|
1160
|
+
else:
|
|
1161
|
+
return stderr[:-len(MY_KEY_TO_DETECT_FINISH)]
|
|
1162
|
+
if returnCode == 0:
|
|
1163
|
+
return True,StdErrTreatment(closeEyesOnErrorAtExit , stderr)
|
|
1164
|
+
if not closeEyesOnErrorAtExit:
|
|
1165
|
+
return False, stderr
|
|
1166
|
+
if stderr[-len(MY_KEY_TO_DETECT_FINISH):] == MY_KEY_TO_DETECT_FINISH:
|
|
1167
|
+
return True,stderr[:-len(MY_KEY_TO_DETECT_FINISH)]
|
|
1168
|
+
else:
|
|
1169
|
+
return False,stderr
|
|
1170
|
+
|
|
1171
|
+
#
|
|
1172
|
+
def InternalExecResistant( exchangeMode, keepFilesToReplay, code, context, outargsname):
|
|
1173
|
+
from . import KernelBasis
|
|
1174
|
+
from . import salome
|
|
1175
|
+
salome.salome_init()
|
|
1176
|
+
orb = salome.orb
|
|
1177
|
+
iorScriptLog = orb.object_to_string( instanceOfLogOfCurrentSession._remote_handle )#ref ContainerScriptPerfLog_ptr
|
|
1178
|
+
####
|
|
1179
|
+
EXEC_CODE_FNAME_PXF = "execsafe_"
|
|
1180
|
+
def RetrieveUniquePartFromPfx( fname ):
|
|
1181
|
+
return os.path.splitext( os.path.basename(fname)[len(EXEC_CODE_FNAME_PXF):] )[0]
|
|
1182
|
+
dirForReplayFiles = KernelBasis.GetDirectoryForReplayFiles()
|
|
1183
|
+
if not dirForReplayFiles:
|
|
1184
|
+
raise RuntimeError("You are in context of exec resistant you have to position Directory hosting these files properly")
|
|
1185
|
+
with tempfile.NamedTemporaryFile(dir=dirForReplayFiles,prefix=EXEC_CODE_FNAME_PXF,suffix=".py", mode="w", delete = False) as codeFd:
|
|
1186
|
+
codeFd.write( "{}\n".format( containerRef.get_startup_code() ) )
|
|
1187
|
+
codeFd.write( code )
|
|
1188
|
+
if closeEyesOnErrorAtExit:
|
|
1189
|
+
codeFd.write( """
|
|
1190
|
+
import sys
|
|
1191
|
+
sys.stderr.write({!r})
|
|
1192
|
+
sys.stderr.flush()""".format( MY_KEY_TO_DETECT_FINISH ) )
|
|
1193
|
+
codeFd.flush()
|
|
1194
|
+
exCtx = ExchangeModeCltSideFactory(exchangeMode, keepFilesToReplay)
|
|
1195
|
+
codeFileNameFull = codeFd.name
|
|
1196
|
+
codeFileName = os.path.basename( codeFileNameFull )
|
|
1197
|
+
contextFileName = exCtx.hostInputContext(dirForReplayFiles, "contextsafe_{}.pckl".format( RetrieveUniquePartFromPfx( codeFileName ) ), context)
|
|
1198
|
+
resFileName = exCtx.setOutputContextEntryPoint( dirForReplayFiles, "outcontextsafe_{}.pckl".format( RetrieveUniquePartFromPfx( codeFileName ) ) )
|
|
1199
|
+
mainExecFileName = os.path.join( dirForReplayFiles, "mainexecsafe_{}.py".format( RetrieveUniquePartFromPfx( codeFileName ) ) )
|
|
1200
|
+
with open(mainExecFileName,"w") as f:
|
|
1201
|
+
f.write( FinalCode.format( KernelBasis.VerbosityActivated() ,KernelBasis.VerbosityLevel(),
|
|
1202
|
+
os.getcwd(), dirForReplayFiles, exchangeMode, codeFileName, contextFileName, resFileName, outargsname, iorScriptLog ) )
|
|
1203
|
+
timeOut = KernelBasis.GetExecutionTimeOut()
|
|
1204
|
+
nbRetry = KernelBasis.GetNumberOfRetry()
|
|
1205
|
+
logging.debug( "Nb retry = {} Timout in seconds = {}".format( nbRetry, timeOut ) )
|
|
1206
|
+
for iTry in range( nbRetry ):
|
|
1207
|
+
if iTry > 0:
|
|
1208
|
+
print( "WARNING : Retry # {}. Following code has generated non zero return code ( {} ). Trying again ... \n{}".format( iTry, returnCode, code ) )
|
|
1209
|
+
logging.debug( "try # {} / {} --- ".format( iTry, nbRetry ) )
|
|
1210
|
+
p = sp.Popen(["python3", mainExecFileName],cwd = os.getcwd(),stdout = sp.PIPE, stderr = sp.PIPE)
|
|
1211
|
+
try:
|
|
1212
|
+
args = {}
|
|
1213
|
+
if timeOut > 0:
|
|
1214
|
+
args["timeout"] = timeOut
|
|
1215
|
+
stdout, stderr = p.communicate( **args )
|
|
1216
|
+
except sp.TimeoutExpired as e:
|
|
1217
|
+
print( "WARNING : during retry #{} timeout set to {} s has failed !".format( iTry, timeOut ) )
|
|
1218
|
+
returnCode = 10000000000 + timeOut
|
|
1219
|
+
else:
|
|
1220
|
+
returnCode = p.returncode
|
|
1221
|
+
if returnCode == 0:
|
|
1222
|
+
if iTry >= 1:
|
|
1223
|
+
logging.warning( "At Retry #{} it's successful :)".format(iTry) )
|
|
1224
|
+
break
|
|
1225
|
+
return returnCode, stdout, stderr, PythonFunctionEvaluatorParams(mainExecFileName,codeFileNameFull,contextFileName,exCtx)
|
|
1226
|
+
ret = instanceOfLogOfCurrentSession._current_instance
|
|
1227
|
+
exchangeMode = "File"
|
|
1228
|
+
if not keepFilesToReplay:
|
|
1229
|
+
exchangeMode = "TCP"
|
|
1230
|
+
returnCode, stdout, stderr, evParams = InternalExecResistant( exchangeMode, keepFilesToReplay, code, context, outargsname )
|
|
1231
|
+
stdout = stdout.decode()
|
|
1232
|
+
stderr = stderr.decode()
|
|
1233
|
+
sys.stdout.write( stdout ) ; sys.stdout.flush()
|
|
1234
|
+
isOK, stderr = IsConsideredAsOKRun( returnCode, closeEyesOnErrorAtExit , stderr )
|
|
1235
|
+
sys.stderr.write( stderr ) ; sys.stderr.flush()
|
|
1236
|
+
if isOK:
|
|
1237
|
+
pcklData = instanceOfLogOfCurrentSession._remote_handle.getObj()
|
|
1238
|
+
if len(pcklData) > 0:
|
|
1239
|
+
ret = pickle.loads( pcklData )
|
|
1240
|
+
context.update( evParams.result )
|
|
1241
|
+
evParams.destroyOnOKAndReplay()
|
|
1242
|
+
if returnCode != 0:
|
|
1243
|
+
print( "WARNING : Following code has generated non zero return code ( {} ) but considered as OK\n{}".format( returnCode, code ) )
|
|
1244
|
+
return ret
|
|
1245
|
+
else:
|
|
1246
|
+
if keepFilesToReplay:
|
|
1247
|
+
evParams.destroyOnKOAndReplay( containerRef )
|
|
1248
|
+
else:
|
|
1249
|
+
evParams.destroyOnOKAndReplay()
|
|
1250
|
+
raise RuntimeError(f"Subprocess launched {evParams.strDependingOnReturnCode(keepFilesToReplay,returnCode)}stdout :\n{stdout}\nstderr :\n{stderr}")
|
|
1251
|
+
|
|
1252
|
+
def ExecCrashProofWithReplay( code, context, outargsname, containerRef, instanceOfLogOfCurrentSession ):
|
|
1253
|
+
return ExecCrashProofGeneric(code, context, outargsname, containerRef, instanceOfLogOfCurrentSession, keepFilesToReplay = True, closeEyesOnErrorAtExit = False)
|
|
1254
|
+
|
|
1255
|
+
def ExecCrashProofWithoutReplay( code, context, outargsname, containerRef, instanceOfLogOfCurrentSession ):
|
|
1256
|
+
return ExecCrashProofGeneric(code, context, outargsname, containerRef, instanceOfLogOfCurrentSession, keepFilesToReplay = False, closeEyesOnErrorAtExit = False)
|
|
1257
|
+
|
|
1258
|
+
def ExecCrashProofWithReplayFT( code, context, outargsname, containerRef, instanceOfLogOfCurrentSession ):
|
|
1259
|
+
return ExecCrashProofGeneric(code, context, outargsname, containerRef, instanceOfLogOfCurrentSession, keepFilesToReplay = True, closeEyesOnErrorAtExit = True)
|
|
1260
|
+
|
|
1261
|
+
def ExecCrashProofWithoutReplayFT( code, context, outargsname, containerRef, instanceOfLogOfCurrentSession ):
|
|
1262
|
+
return ExecCrashProofGeneric(code, context, outargsname, containerRef, instanceOfLogOfCurrentSession, keepFilesToReplay = False, closeEyesOnErrorAtExit = True)
|
|
1263
|
+
|
|
1264
|
+
def ExecLocal( code, context, outargsname, containerRef, instanceOfLogOfCurrentSession ):
|
|
1265
|
+
exec( code, context )
|
|
1266
|
+
return instanceOfLogOfCurrentSession._current_instance
|
|
1267
|
+
|
|
1268
|
+
class LogOfCurrentExecutionSessionAbs(abc.ABC):
|
|
1269
|
+
def __init__(self):
|
|
1270
|
+
self._current_instance = ScriptExecInfo()
|
|
1271
|
+
|
|
1272
|
+
def addInfoOnLevel2(self, key, value):
|
|
1273
|
+
setattr(self._current_instance,key,value)
|
|
1274
|
+
|
|
1275
|
+
@abc.abstractmethod
|
|
1276
|
+
def addFreestyleAndFlush(self, value):
|
|
1277
|
+
raise RuntimeError("Must be overloaded")
|
|
1278
|
+
|
|
1279
|
+
class LogOfCurrentExecutionSession(LogOfCurrentExecutionSessionAbs):
|
|
1280
|
+
def __init__(self, handleToCentralizedInst):
|
|
1281
|
+
super().__init__()
|
|
1282
|
+
self._remote_handle = handleToCentralizedInst
|
|
1283
|
+
|
|
1284
|
+
def addFreestyleAndFlush(self, value):
|
|
1285
|
+
self._current_instance.freestyle = value
|
|
1286
|
+
self.finalizeAndPushToMasterAppendFreestyle()
|
|
1287
|
+
|
|
1288
|
+
def finalizeAndPushToMaster(self):
|
|
1289
|
+
"""
|
|
1290
|
+
Voluntary do nothing in case of problem to avoid to trouble execution
|
|
1291
|
+
"""
|
|
1292
|
+
try:
|
|
1293
|
+
self._remote_handle.assign( pickle.dumps( self._current_instance ) )
|
|
1294
|
+
except:
|
|
1295
|
+
pass
|
|
1296
|
+
|
|
1297
|
+
def finalizeAndPushToMasterAppendFreestyle(self):
|
|
1298
|
+
"""
|
|
1299
|
+
Voluntary do nothing in case of problem to avoid to trouble execution
|
|
1300
|
+
"""
|
|
1301
|
+
try:
|
|
1302
|
+
self._remote_handle.assignAndAppendFreestyle( pickle.dumps( self._current_instance ) )
|
|
1303
|
+
except:
|
|
1304
|
+
pass
|
|
1305
|
+
|
|
1306
|
+
class LogOfCurrentExecutionSessionStub(LogOfCurrentExecutionSessionAbs):
|
|
1307
|
+
"""
|
|
1308
|
+
This class is to stub LogOfCurrentExecutionSession in context of replay where the server (handleToCentralizedInst) has vanished
|
|
1309
|
+
"""
|
|
1310
|
+
def __init__(self, handleToCentralizedInst = None):
|
|
1311
|
+
super().__init__()
|
|
1312
|
+
def addFreestyleAndFlush(self, value):
|
|
1313
|
+
pass
|
|
1314
|
+
|
|
1315
|
+
class PyScriptNode_Abstract_i(Engines__POA.PyScriptNode,Generic,abc.ABC):
|
|
1316
|
+
"""The implementation of the PyScriptNode CORBA IDL that executes a script"""
|
|
1317
|
+
def __init__(self, nodeName, code, poa, my_container, logscript):
|
|
1318
|
+
"""Initialize the node : compilation in the local context"""
|
|
1319
|
+
Generic.__init__(self,poa)
|
|
1320
|
+
self.nodeName=nodeName
|
|
1321
|
+
self.code=code
|
|
1322
|
+
self.my_container_py = my_container
|
|
1323
|
+
self.my_container=my_container._container
|
|
1324
|
+
linecache.cache[nodeName]=0,None,code.split('\n'),nodeName
|
|
1325
|
+
self.ccode=compile(code,nodeName,'exec')
|
|
1326
|
+
self.context={}
|
|
1327
|
+
self.context[MY_CONTAINER_ENTRY_IN_GLBS] = self.my_container
|
|
1328
|
+
self._log_script = logscript
|
|
1329
|
+
self._current_execution_session = None
|
|
1330
|
+
sys.stdout.flush() ; sys.stderr.flush() # flush to correctly capture log per execution session
|
|
1331
|
+
|
|
1332
|
+
@abc.abstractmethod
|
|
1333
|
+
def executeNow(self, outargsname):
|
|
1334
|
+
raise RuntimeError("Must be overloaded")
|
|
1335
|
+
|
|
1336
|
+
def __del__(self):
|
|
1337
|
+
# force removal of self.context. Don t know why it s not done by default
|
|
1338
|
+
self.removeAllVarsInContext()
|
|
1339
|
+
pass
|
|
1340
|
+
|
|
1341
|
+
def getContainer(self):
|
|
1342
|
+
return self.my_container
|
|
1343
|
+
|
|
1344
|
+
def getCode(self):
|
|
1345
|
+
return self.code
|
|
1346
|
+
|
|
1347
|
+
def getName(self):
|
|
1348
|
+
return self.nodeName
|
|
1349
|
+
|
|
1350
|
+
def defineNewCustomVar(self,varName,valueOfVar):
|
|
1351
|
+
self.context[varName] = pickle.loads(valueOfVar)
|
|
1352
|
+
pass
|
|
1353
|
+
|
|
1354
|
+
def executeAnotherPieceOfCode(self,code):
|
|
1355
|
+
"""Called for initialization of container lodging self."""
|
|
1356
|
+
try:
|
|
1357
|
+
ccode=compile(code,self.nodeName,'exec')
|
|
1358
|
+
exec(ccode, self.context)
|
|
1359
|
+
except Exception:
|
|
1360
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0))
|
|
1361
|
+
|
|
1362
|
+
def assignNewCompiledCode(self,codeStr):
|
|
1363
|
+
try:
|
|
1364
|
+
self.code=codeStr
|
|
1365
|
+
self.ccode=compile(codeStr,self.nodeName,'exec')
|
|
1366
|
+
except Exception:
|
|
1367
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode.assignNewCompiledCode (%s) : code to be executed \"%s\"" %(self.nodeName,codeStr),0))
|
|
1368
|
+
|
|
1369
|
+
def executeSimple(self, key, val):
|
|
1370
|
+
"""
|
|
1371
|
+
Same as execute method except that no pickelization mecanism is implied here. No output is expected
|
|
1372
|
+
"""
|
|
1373
|
+
try:
|
|
1374
|
+
self.context.update({ "env" : [(k,v) for k,v in zip(key,val)]})
|
|
1375
|
+
exec(self.ccode,self.context)
|
|
1376
|
+
except Exception:
|
|
1377
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1378
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1379
|
+
print("".join(l)) ; sys.stdout.flush() # print error also in logs of remote container
|
|
1380
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s" % (self.nodeName),0))
|
|
1381
|
+
|
|
1382
|
+
def execute(self,outargsname,argsin):
|
|
1383
|
+
"""Execute the script stored in attribute ccode with pickled args (argsin)"""
|
|
1384
|
+
try:
|
|
1385
|
+
argsname,kws=pickle.loads(argsin)
|
|
1386
|
+
self.context.update(kws)
|
|
1387
|
+
exec(self.ccode, self.context)
|
|
1388
|
+
argsout=[]
|
|
1389
|
+
for arg in outargsname:
|
|
1390
|
+
if arg not in self.context:
|
|
1391
|
+
raise KeyError("There is no variable %s in context" % arg)
|
|
1392
|
+
argsout.append(self.context[arg])
|
|
1393
|
+
argsout=pickle.dumps(tuple(argsout),-1)
|
|
1394
|
+
return argsout
|
|
1395
|
+
except Exception:
|
|
1396
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1397
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1398
|
+
print("".join(l)) ; sys.stdout.flush() # print error also in logs of remote container
|
|
1399
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s, outargsname: %s" % (self.nodeName,outargsname),0))
|
|
1400
|
+
|
|
1401
|
+
def executeFirst(self,argsin):
|
|
1402
|
+
""" Same than first part of self.execute to reduce memory peak."""
|
|
1403
|
+
def ArgInMananger(self,argsin):
|
|
1404
|
+
argsInPy = SeqByteReceiver( argsin )
|
|
1405
|
+
data = argsInPy.data()
|
|
1406
|
+
self.addInfoOnLevel2("inputMem",len(data))
|
|
1407
|
+
_,kws=pickle.loads(data)
|
|
1408
|
+
return kws
|
|
1409
|
+
try:
|
|
1410
|
+
self.beginOfCurrentExecutionSession()
|
|
1411
|
+
self.addTimeInfoOnLevel2("startInputTime")
|
|
1412
|
+
# to force call of SeqByteReceiver's destructor
|
|
1413
|
+
kws = ArgInMananger(self,argsin)
|
|
1414
|
+
vis = InOutputObjVisitor()
|
|
1415
|
+
for elt in kws:
|
|
1416
|
+
# fetch real data if necessary
|
|
1417
|
+
kws[elt] = UnProxyObjectSimple( kws[elt],vis)
|
|
1418
|
+
self.addInfoOnLevel2("inputHDDMem",vis)
|
|
1419
|
+
self.context.update(kws)
|
|
1420
|
+
self.addTimeInfoOnLevel2("endInputTime")
|
|
1421
|
+
except Exception:
|
|
1422
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1423
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1424
|
+
print("".join(l)) ; sys.stdout.flush() # print error also in logs of remote container
|
|
1425
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode:First %s" % (self.nodeName),0))
|
|
1426
|
+
|
|
1427
|
+
def executeSecond(self,outargsname):
|
|
1428
|
+
""" Same than second part of self.execute to reduce memory peak."""
|
|
1429
|
+
def executeSecondInternal(monitoringtimeresms):
|
|
1430
|
+
with GenericPythonMonitoringLauncherCtxMgr( CPUMemoryMonitoring( monitoringtimeresms ) ) as monitoringParams:
|
|
1431
|
+
currentInstance = self.executeNow( outargsname )
|
|
1432
|
+
cpumeminfo = ReadCPUMemInfo( monitoringParams )
|
|
1433
|
+
return cpumeminfo, currentInstance
|
|
1434
|
+
|
|
1435
|
+
import sys
|
|
1436
|
+
try:
|
|
1437
|
+
self.addTimeInfoOnLevel2("startExecTime")
|
|
1438
|
+
##
|
|
1439
|
+
self.addInfoOnLevel2("measureTimeResolution",self.my_container_py.monitoringtimeresms())
|
|
1440
|
+
self._current_execution_session.finalizeAndPushToMaster() # flush it to the server (scheduler hosting ContainerManager) in order to retrieve it in Python server
|
|
1441
|
+
cpumeminfo, self._current_execution_session._current_instance = executeSecondInternal( self.my_container_py.monitoringtimeresms() )
|
|
1442
|
+
##
|
|
1443
|
+
self.addInfoOnLevel2("CPUMemDuringExec",cpumeminfo)
|
|
1444
|
+
self.addTimeInfoOnLevel2("endExecTime")
|
|
1445
|
+
self.addTimeInfoOnLevel2("startOutputTime")
|
|
1446
|
+
argsout=[]
|
|
1447
|
+
for arg in outargsname:
|
|
1448
|
+
if arg not in self.context:
|
|
1449
|
+
raise KeyError("There is no variable %s in context" % arg)
|
|
1450
|
+
argsout.append(self.context[arg])
|
|
1451
|
+
ret = [ ]
|
|
1452
|
+
outputMem = 0
|
|
1453
|
+
vis = InOutputObjVisitor()
|
|
1454
|
+
for arg in argsout:
|
|
1455
|
+
# the proxy mecanism is catched here
|
|
1456
|
+
argPickle = SpoolPickleObject( arg, vis )
|
|
1457
|
+
retArg = SenderByte_i( self.poa,argPickle )
|
|
1458
|
+
id_o = self.poa.activate_object(retArg)
|
|
1459
|
+
retObj = self.poa.id_to_reference(id_o)
|
|
1460
|
+
ret.append( retObj._narrow( SALOME.SenderByte ) )
|
|
1461
|
+
outputMem += len(argPickle)
|
|
1462
|
+
self.addInfoOnLevel2("outputMem",outputMem)
|
|
1463
|
+
self.addInfoOnLevel2("outputHDDMem",vis)
|
|
1464
|
+
self.addTimeInfoOnLevel2("endOutputTime")
|
|
1465
|
+
self.endOfCurrentExecutionSession()
|
|
1466
|
+
return ret
|
|
1467
|
+
except Exception:
|
|
1468
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1469
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1470
|
+
print("".join(l)) ; sys.stdout.flush() # print error also in logs of remote container
|
|
1471
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode:Second %s, outargsname: %s" % (self.nodeName,outargsname),0))
|
|
1472
|
+
|
|
1473
|
+
def listAllVarsInContext(self):
|
|
1474
|
+
import re
|
|
1475
|
+
pat = re.compile("^__([a-z]+)__$")
|
|
1476
|
+
return [elt for elt in self.context if not pat.match(elt) and elt != MY_CONTAINER_ENTRY_IN_GLBS]
|
|
1477
|
+
|
|
1478
|
+
def removeAllVarsInContext(self):
|
|
1479
|
+
for elt in self.listAllVarsInContext():
|
|
1480
|
+
del self.context[elt]
|
|
1481
|
+
|
|
1482
|
+
def getValueOfVarInContext(self,varName):
|
|
1483
|
+
try:
|
|
1484
|
+
return pickle.dumps(self.context[varName],-1)
|
|
1485
|
+
except Exception:
|
|
1486
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1487
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1488
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s" %self.nodeName,0))
|
|
1489
|
+
pass
|
|
1490
|
+
|
|
1491
|
+
def assignVarInContext(self, varName, value):
|
|
1492
|
+
try:
|
|
1493
|
+
self.context[varName][0] = pickle.loads(value)
|
|
1494
|
+
except Exception:
|
|
1495
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1496
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1497
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s" %self.nodeName,0))
|
|
1498
|
+
pass
|
|
1499
|
+
|
|
1500
|
+
def callMethodOnVarInContext(self, varName, methodName, args):
|
|
1501
|
+
try:
|
|
1502
|
+
return pickle.dumps( getattr(self.context[varName][0],methodName)(*pickle.loads(args)),-1 )
|
|
1503
|
+
except Exception:
|
|
1504
|
+
exc_typ,exc_val,exc_fr=sys.exc_info()
|
|
1505
|
+
l=traceback.format_exception(exc_typ,exc_val,exc_fr)
|
|
1506
|
+
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyScriptNode: %s" %self.nodeName,0))
|
|
1507
|
+
pass
|
|
1508
|
+
|
|
1509
|
+
def beginOfCurrentExecutionSession(self):
|
|
1510
|
+
self._current_execution_session = LogOfCurrentExecutionSession( self._log_script.addExecutionSession() )
|
|
1511
|
+
self.context[MY_PERFORMANCE_LOG_ENTRY_IN_GLBS] = self._current_execution_session
|
|
1512
|
+
|
|
1513
|
+
def endOfCurrentExecutionSession(self):
|
|
1514
|
+
self._current_execution_session.finalizeAndPushToMaster()
|
|
1515
|
+
self._current_execution_session = None
|
|
1516
|
+
|
|
1517
|
+
def addInfoOnLevel2(self, key, value):
|
|
1518
|
+
self._current_execution_session.addInfoOnLevel2(key, value)
|
|
1519
|
+
|
|
1520
|
+
def addTimeInfoOnLevel2(self, key):
|
|
1521
|
+
from datetime import datetime
|
|
1522
|
+
self._current_execution_session.addInfoOnLevel2(key,datetime.now())
|
|
1523
|
+
|
|
1524
|
+
class PyScriptNode_i(PyScriptNode_Abstract_i):
|
|
1525
|
+
def __init__(self, nodeName, code, poa, my_container, logscript):
|
|
1526
|
+
super().__init__(nodeName, code, poa, my_container, logscript)
|
|
1527
|
+
|
|
1528
|
+
def executeNow(self, outargsname):
|
|
1529
|
+
return ExecLocal(self.ccode,self.context,outargsname,self.my_container,self._current_execution_session)
|
|
1530
|
+
|
|
1531
|
+
class PyScriptNode_OutOfProcess_i(PyScriptNode_Abstract_i):
|
|
1532
|
+
def __init__(self, nodeName, code, poa, my_container, logscript):
|
|
1533
|
+
super().__init__(nodeName, code, poa, my_container, logscript)
|
|
1534
|
+
|
|
1535
|
+
def executeNow(self, outargsname):
|
|
1536
|
+
return ExecCrashProofWithoutReplay(self.code,self.context,outargsname,self.my_container,self._current_execution_session)
|
|
1537
|
+
|
|
1538
|
+
class PyScriptNode_OutOfProcess_Replay_i(PyScriptNode_Abstract_i):
|
|
1539
|
+
def __init__(self, nodeName, code, poa, my_container, logscript):
|
|
1540
|
+
super().__init__(nodeName, code, poa, my_container, logscript)
|
|
1541
|
+
|
|
1542
|
+
def executeNow(self, outargsname):
|
|
1543
|
+
return ExecCrashProofWithReplay(self.code,self.context,outargsname,self.my_container,self._current_execution_session)
|
|
1544
|
+
|
|
1545
|
+
class PyScriptNode_OutOfProcess_FT_i(PyScriptNode_Abstract_i):
|
|
1546
|
+
def __init__(self, nodeName, code, poa, my_container, logscript):
|
|
1547
|
+
super().__init__(nodeName, code, poa, my_container, logscript)
|
|
1548
|
+
|
|
1549
|
+
def executeNow(self, outargsname):
|
|
1550
|
+
return ExecCrashProofWithoutReplayFT(self.code,self.context,outargsname,self.my_container,self._current_execution_session)
|
|
1551
|
+
|
|
1552
|
+
class PyScriptNode_OutOfProcess_Replay_FT_i(PyScriptNode_Abstract_i):
|
|
1553
|
+
def __init__(self, nodeName, code, poa, my_container, logscript):
|
|
1554
|
+
super().__init__(nodeName, code, poa, my_container, logscript)
|
|
1555
|
+
|
|
1556
|
+
def executeNow(self, outargsname):
|
|
1557
|
+
return ExecCrashProofWithReplayFT(self.code,self.context,outargsname,self.my_container,self._current_execution_session)
|