X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2FPythonNode.hxx;h=d13b9570818e208b9c05ff31d687f28b9559cb9b;hb=5bb74846b6e734d5b27c1f0e2b181e47c4e0fa0c;hp=4fca1f072e4f970a54923db17f4f6f11a1c04d1f;hpb=1f1670c987af4441732c0ef3855816192350982a;p=modules%2Fyacs.git diff --git a/src/runtime/PythonNode.hxx b/src/runtime/PythonNode.hxx index 4fca1f072..d13b95708 100644 --- a/src/runtime/PythonNode.hxx +++ b/src/runtime/PythonNode.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2014 CEA/DEN, EDF R&D +// Copyright (C) 2006-2019 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,20 @@ namespace YACS virtual const char *getSerializationScript() const = 0; // void commonRemoteLoad(InlineNode *reqNode); + 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; PyObject *_pyfuncUnser; + PyObject *_pyfuncSimpleSer; + std::string _imposedResource; + std::string _imposedContainer; + public: + static const char SCRIPT_FOR_SIMPLE_SERIALIZATION[]; }; class YACSRUNTIMESALOME_EXPORT PythonNode : public InlineNode, public PythonEntry @@ -62,11 +72,15 @@ 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); virtual ~PythonNode(); - virtual void checkBasicConsistency() const throw(Exception); + virtual void checkBasicConsistency() const ; virtual void execute(); virtual void load(); virtual void loadRemote(); @@ -74,18 +88,33 @@ namespace YACS virtual void executeRemote(); virtual void executeLocal(); virtual void shutdown(int level); + 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"; } + void applyDPLScope(ComposedNode *gfn); + void setSqueezeStatus(bool sqStatus) { _autoSqueeze=sqStatus; } + bool getSqueezeStatus() const { return _autoSqueeze; } + void squeezeMemorySafe(); + protected: + void squeezeMemory(); + void squeezeMemoryRemote(); public: static const char KIND[]; static const char IMPL_NAME[]; static const char SCRIPT_FOR_SERIALIZATION[]; + static const char REMOTE_NAME[]; + static const char DPL_INFO_NAME[]; protected: + bool _autoSqueeze = false; Engines::PyScriptNode_var _pynode; }; - class PyFuncNode : public InlineFuncNode, public PythonEntry + class YACSRUNTIMESALOME_EXPORT PyFuncNode : public InlineFuncNode, public PythonEntry { protected: Node *simpleClone(ComposedNode *father, bool editionOnly) const; @@ -99,7 +128,8 @@ namespace YACS PyFuncNode(const PyFuncNode& other, ComposedNode *father); PyFuncNode(const std::string& name); virtual ~PyFuncNode(); - virtual void checkBasicConsistency() const throw(Exception); + virtual void init(bool start=true); + virtual void checkBasicConsistency() const ; virtual void execute(); virtual void load(); virtual void loadRemote(); @@ -107,6 +137,10 @@ namespace YACS virtual void executeRemote(); virtual void executeLocal(); virtual void shutdown(int level); + 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"; }