Salome HOME
Some tests are modified to work in session less mode.
[modules/yacs.git] / src / runtime / PythonNode.hxx
index d90c17b29765b1427bdb844ce1bf2da654fd53fd..4d8004e93eb0087fa8430b925a93ea3f35b1b465 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -46,10 +46,11 @@ namespace YACS
       virtual const char *getSerializationScript() const = 0;
       //
       void commonRemoteLoad(InlineNode *reqNode);
-      void commonRemoteLoadPart1(InlineNode *reqNode);
-      Engines::Container_var commonRemoteLoadPart2(InlineNode *reqNode, bool& isInitializeRequested);
-      void commonRemoteLoadPart3(InlineNode *reqNode, Engines::Container_ptr objContainer, bool isInitializeRequested);
+      void loadRemoteContainer(InlineNode *reqNode);
+      Engines::Container_var loadPythonAdapter(InlineNode *reqNode, bool& isInitializeRequested);
+      void loadRemoteContext(InlineNode *reqNode, Engines::Container_ptr objContainer, bool isInitializeRequested);
       static std::string GetContainerLog(const std::string& mode, Container *container, const Task *askingTask);
+      virtual bool hasImposedResource()const;
     protected:
       PyObject *_context;
       PyObject *_pyfuncSer;
@@ -71,6 +72,10 @@ namespace YACS
       void assignRemotePyInterpretor(Engines::PyNodeBase_var remoteInterp);
       Engines::PyNodeBase_var getRemoteInterpreterHandle();
       const char *getSerializationScript() const  { return SCRIPT_FOR_SERIALIZATION; }
+      // A kernel container may manage several python contexts identified by
+      // their name (PyNode and PyScript node). This function returns  the name
+      // of the context used by this object. See SALOME_Component.idl in KERNEL.
+      std::string pythonEntryName()const;
     public:
       PythonNode(const PythonNode& other, ComposedNode *father);
       PythonNode(const std::string& name);
@@ -86,6 +91,8 @@ namespace YACS
       void imposeResource(const std::string& resource_name,
                           const std::string& container_name) override;
       bool canAcceptImposedResource()override;
+      bool hasImposedResource()const override;
+      bool isUsingPythonCache()const;
       std::string getContainerLog();
       PythonNode* cloneNode(const std::string& name);
       virtual std::string typeName() { return "YACS__ENGINE__PythonNode"; }
@@ -96,6 +103,7 @@ namespace YACS
     protected:
       void squeezeMemory();
       void squeezeMemoryRemote();
+      void freeKernelPynode();
     public:
       static const char KIND[];
       static const char IMPL_NAME[];
@@ -133,6 +141,7 @@ namespace YACS
       void imposeResource(const std::string& resource_name,
                           const std::string& container_name) override;
       bool canAcceptImposedResource()override;
+      bool hasImposedResource()const override;
       std::string getContainerLog();
       PyFuncNode* cloneNode(const std::string& name);
       virtual std::string typeName() { return "YACS__ENGINE__PyFuncNode"; }