Version: 9.15.0
YACS::ENGINE::PyFuncNode Class Reference

#include <PythonNode.hxx>

Inheritance diagram for YACS::ENGINE::PyFuncNode:
Collaboration diagram for YACS::ENGINE::PyFuncNode:

Public Member Functions

 PyFuncNode (const PyFuncNode &other, ComposedNode *father)
 
 PyFuncNode (const std::string &name)
 
virtual ~PyFuncNode ()
 
virtual void init (bool start=true)
 
virtual void checkBasicConsistency () const
 
virtual void execute ()
 
virtual void load ()
 
virtual void loadRemote ()
 
virtual void loadLocal ()
 
virtual void executeRemote ()
 
virtual void executeLocal ()
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
void imposeResource (const std::string &resource_name, const std::string &container_name) override
 
bool canAcceptImposedResource () override
 
bool hasImposedResource () const override
 
std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
PyFuncNodecloneNode (const std::string &name)
 Create a new node of same type with a given name. More...
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::InlineFuncNode
virtual void setFname (const std::string &fname)
 Set the function name to use in node execution. More...
 
virtual std::string getFname ()
 
void accept (Visitor *visitor)
 
virtual ~InlineFuncNode ()
 
- Public Member Functions inherited from YACS::ENGINE::InlineNode
virtual void setScript (const std::string &script)
 Set the script (as a string) to execute. More...
 
virtual std::string getScript ()
 
virtual ~InlineNode ()
 
virtual void setExecutionMode (const std::string &mode)
 
virtual std::string getExecutionMode ()
 
virtual void setContainer (Container *container)
 
virtual ContainergetContainer ()
 
void performDuplicationOfPlacement (const Node &other)
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
void performShallowDuplicationOfPlacement (const Node &other)
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
bool isDeployable () const
 
int getMaxLevelOfParallelism () const
 
- Public Member Functions inherited from YACS::ENGINE::ElementaryNode
virtual ~ElementaryNode ()
 
void exUpdateState ()
 Update the node state. More...
 
ComponentInstancegetComponent ()
 
const ComponentInstancegetComponent () const
 
YACS::StatesForNode getState () const
 
void getReadyTasks (std::vector< Task * > &tasks)
 
void edRemovePort (Port *port)
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
NodegetChildByName (const std::string &name) const
 
ComposedNodegetDynClonerIfExists (const ComposedNode *levelToStop) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::string getInPortName (const InPort *) const
 
std::string getOutPortName (const OutPort *) const
 
InputPortgetInputPort (const std::string &name) const
 
OutputPortgetOutputPort (const std::string &name) const
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const
 
virtual InputPortcreateInputPort (const std::string &inputPortName, TypeCode *type)
 
virtual OutputPortcreateOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortcreateInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortcreateOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual InputPortedAddInputPort (const std::string &inputPortName, TypeCode *type)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual void edOrderInputPorts (const std::list< InputPort * > &ports)
 
virtual void edOrderOutputPorts (const std::list< OutputPort * > &ports)
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
ComplexWeightgetWeight ()
 
void setWeight (double elementaryWeight)
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
void begin ()
 
bool isReady ()
 
void finished ()
 
void aborted ()
 
void loaded ()
 Notify this node that it is loaded. More...
 
void connected ()
 Notify this node that it is connected. More...
 
virtual std::string getErrorDetails ()
 Give a description of error when node status is ERROR. More...
 
virtual void initService ()
 
virtual void connectService ()
 
virtual void disconnectService ()
 
virtual void getCoupledTasks (std::set< Task * > &coupledSet)
 Calls getCoupledNodes for Task interface. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledSet)
 Put all nodes that are coupled to this node in coupledSet. More...
 
virtual void addDatastreamPortToInitMultiService (const std::string &port_name, int number)
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
virtual void resetState (int level)
 Reset the node state depending on the parameter level. More...
 
Nodeclone (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
NodecloneWithoutCompAndContDeepCpy (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
void setState (YACS::StatesForNode theState)
 Sets the given state for node. More...
 
virtual YACS::StatesForNode getEffectiveState () const
 Return the node state in the context of its father. More...
 
virtual YACS::StatesForNode getEffectiveState (const Node *) const
 Return the effective state of a node in the context of this one (its father) More...
 
std::string getColorState (YACS::StatesForNode state) const
 Return the color associated to a state. More...
 
InGategetInGate ()
 
OutGategetOutGate ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 Change the name of the node. More...
 
ComposedNodegetFather () const
 
const std::string getId () const
 
bool exIsControlReady () const
 
std::list< Node * > getOutNodes () const
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
void writeDotInFile (const std::string &fileName) const
 
virtual void exFailedState ()
 Notify this node that its execution has failed. More...
 
virtual void exDisabledState ()
 Notify this node that it has been disabled. More...
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
InPortgetInPort (const std::string &name) const
 
InPropertyPortgetInPropertyPort () const
 
virtual OutPortgetOutPort (const std::string &name) const
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
DynParaLoopgetClosestDPLAmongAncestors () const
 
virtual ComposedNodegetRootNode () const
 
virtual void setProperty (const std::string &name, const std::string &value)
 
virtual std::string getProperty (const std::string &name)
 
std::map< std::string, std::string > getProperties ()
 
std::map< std::string, std::string > getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
std::string getQualifiedName () const
 same as Node::getName() in most cases, but differs for children of switch More...
 
int getNumId ()
 return node instance identifiant, unique for each node instance More...
 
std::vector< std::pair< std::string, int > > getDPLScopeInfo (ComposedNode *gfn)
 
virtual void applyDPLScope (ComposedNode *gfn)
 
virtual void sendEvent (const std::string &event)
 emit notification to all observers registered with the dispatcher More...
 
virtual void sendEvent2 (const std::string &event, void *something)
 emit notification to all observers registered with the dispatcher More...
 
virtual std::string getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Task
virtual ~Task ()
 

Static Public Attributes

static const char SCRIPT_FOR_SERIALIZATION []
 
- Static Public Attributes inherited from YACS::ENGINE::InlineNode
static const char LOCAL_STR [] ="local"
 
static const char REMOTE_STR [] ="remote"
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 
- Static Public Attributes inherited from YACS::ENGINE::PythonEntry
static const char SCRIPT_FOR_SIMPLE_SERIALIZATION []
 

Protected Member Functions

NodesimpleClone (ComposedNode *father, bool editionOnly) const
 
void createRemoteAdaptedPyInterpretor (Engines::Container_ptr objContainer)
 returns an object, you have to deal with (UnRegister) More...
 
Engines::PyNodeBase_var retrieveDftRemotePyInterpretorIfAny (Engines::Container_ptr objContainer) const
 returns (if any) an object, you have to deal with (UnRegister) More...
 
void assignRemotePyInterpretor (Engines::PyNodeBase_var remoteInterp)
 
Engines::PyNodeBase_var getRemoteInterpreterHandle ()
 
const char * getSerializationScript () const
 
- Protected Member Functions inherited from YACS::ENGINE::InlineFuncNode
 InlineFuncNode (const InlineFuncNode &other, ComposedNode *father)
 
 InlineFuncNode (const std::string &name)
 
- Protected Member Functions inherited from YACS::ENGINE::InlineNode
 InlineNode (const InlineNode &other, ComposedNode *father)
 
 InlineNode (const std::string &name)
 
- Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
 ElementaryNode (const std::string &name)
 
 ElementaryNode (const ElementaryNode &other, ComposedNode *father)
 
void initCommonPartWithoutStateManagement (bool start)
 
virtual void createMultiDatastreamPorts ()
 
void edDisconnectAllLinksWithMe ()
 
bool areAllInputPortsValid () const
 
template<class PORT >
PORT * getPort (const std::string &name, const std::list< PORT * > &setOfPorts) const
 
template<class PORT , class ENUMTYPE >
PORT * edAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type)
 
template<class PORT , class ENUMTYPE >
bool edCheckAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type)
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 
- Protected Member Functions inherited from YACS::ENGINE::PythonEntry
 PythonEntry ()
 
 ~PythonEntry ()
 
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)
 

Protected Attributes

PyObject * _pyfunc
 
Engines::PyNode_var _pynode
 
- Protected Attributes inherited from YACS::ENGINE::InlineFuncNode
std::string _fname
 
- Protected Attributes inherited from YACS::ENGINE::InlineNode
std::string _script
 
std::string _mode
 
Container_container
 
- Protected Attributes inherited from YACS::ENGINE::ElementaryNode
std::list< InputPort * > _setOfInputPort
 
std::list< OutputPort * > _setOfOutputPort
 
std::list< InputDataStreamPort * > _setOfInputDataStreamPort
 
std::list< OutputDataStreamPort * > _setOfOutputDataStreamPort
 
ComplexWeight _weight
 
bool _createDatastreamPorts
 
bool _multi_port_node
 
- Protected Attributes inherited from YACS::ENGINE::Node
InGate _inGate
 
OutGate _outGate
 
InPropertyPort_inPropertyPort
 
std::string _name
 
ComposedNode_father
 
YACS::StatesForNode _state
 
int _modified
 
std::string _errorDetails
 
int _numId
 
std::string _implementation
 
std::map< std::string, std::string > _propertyMap
 
Node_eventReceiver =nullptr
 
- Protected Attributes inherited from YACS::ENGINE::PythonEntry
PyObject * _context
 
PyObject * _pyfuncSer
 
PyObject * _pyfuncUnser
 
PyObject * _pyfuncSimpleSer
 
std::string _imposedResource
 
std::string _imposedContainer
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
static void checkValidityOfNodeName (const std::string &name)
 
- Static Public Member Functions inherited from YACS::ENGINE::PythonEntry
static bool IsProxy (PyObject *ob)
 
static bool GetDestroyStatus (PyObject *ob)
 
static void DoNotTouchFileIfProxy (PyObject *ob)
 
static void UnlinkOnDestructorIfProxy (PyObject *ob)
 
static void IfProxyDoSomething (PyObject *ob, const char *meth)
 
- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Static Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
template<class PORT >
static void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts)
 
template<class PORT >
static bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Static Protected Member Functions inherited from YACS::ENGINE::Node
static void checkValidityOfPortName (const std::string &name)
 
static ComposedNodecheckHavingCommonFather (Node *node1, Node *node2)
 
- Static Protected Member Functions inherited from YACS::ENGINE::PythonEntry
static std::string GetContainerLog (const std::string &mode, Container *container, const Task *askingTask)
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 
- Static Protected Attributes inherited from YACS::ENGINE::PythonEntry
static PyObject * _pyClsBigObject = nullptr
 

Detailed Description

Definition at line 134 of file PythonNode.hxx.

Constructor & Destructor Documentation

◆ PyFuncNode() [1/2]

PyFuncNode::PyFuncNode ( const PyFuncNode other,
ComposedNode father 
)

Definition at line 1093 of file PythonNode.cxx.

1093  :InlineFuncNode(other,father),_pyfunc(0)
1094 {
1096  {
1097  AutoGIL agil;
1098  _context=PyDict_New();
1099  DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
1100  if( PyDict_SetItemString( _context, "__builtins__", getSALOMERuntime()->getBuiltins() ))
1101  {
1102  stringstream msg;
1103  msg << "Not possible to set builtins" << __FILE__ << ":" << __LINE__;
1104  _errorDetails=msg.str();
1105  throw Exception(msg.str());
1106  }
1107  }
1108 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
InlineFuncNode(const InlineFuncNode &other, ComposedNode *father)
Definition: InlineNode.hxx:95
std::string _implementation
Definition: Node.hxx:97
std::string _errorDetails
Definition: Node.hxx:93
static const char IMPL_NAME[]
Definition: PythonNode.hxx:123
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()

References YACS::ENGINE::PythonEntry::_context, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::Node::_implementation, DEBTRACE, YACS::ENGINE::getSALOMERuntime(), and YACS::ENGINE::PythonNode::IMPL_NAME.

Referenced by cloneNode(), and simpleClone().

◆ PyFuncNode() [2/2]

PyFuncNode::PyFuncNode ( const std::string &  name)

Definition at line 1110 of file PythonNode.cxx.

1110  : InlineFuncNode(name),_pyfunc(0)
1111 {
1112 
1114  DEBTRACE( "PyFuncNode::PyFuncNode " << name );
1115  {
1116  AutoGIL agil;
1117  _context=PyDict_New();
1118  DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
1119  if( PyDict_SetItemString( _context, "__builtins__", getSALOMERuntime()->getBuiltins() ))
1120  {
1121  stringstream msg;
1122  msg << "Not possible to set builtins" << __FILE__ << ":" << __LINE__;
1123  _errorDetails=msg.str();
1124  throw Exception(msg.str());
1125  }
1126  }
1127 }

References YACS::ENGINE::PythonEntry::_context, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::Node::_implementation, DEBTRACE, YACS::ENGINE::getSALOMERuntime(), and YACS::ENGINE::PythonNode::IMPL_NAME.

◆ ~PyFuncNode()

PyFuncNode::~PyFuncNode ( )
virtual

Definition at line 1129 of file PythonNode.cxx.

1130 {
1131  if(!CORBA::is_nil(_pynode))
1132  {
1133  _pynode->UnRegister();
1134  }
1135 }
Engines::PyNode_var _pynode
Definition: PythonNode.hxx:168

References _pynode.

Member Function Documentation

◆ assignRemotePyInterpretor()

void PyFuncNode::assignRemotePyInterpretor ( Engines::PyNodeBase_var  remoteInterp)
protectedvirtual

Implements YACS::ENGINE::PythonEntry.

Definition at line 1593 of file PythonNode.cxx.

1594 {
1595  if(!CORBA::is_nil(_pynode))
1596  {
1597  Engines::PyNode_var tmpp(Engines::PyNode::_narrow(remoteInterp));
1598  if(_pynode->_is_equivalent(tmpp))
1599  return ;
1600  }
1601  if(!CORBA::is_nil(_pynode))
1602  _pynode->UnRegister();
1603  _pynode=Engines::PyNode::_narrow(remoteInterp);
1604 }

References _pynode.

◆ canAcceptImposedResource()

bool PyFuncNode::canAcceptImposedResource ( )
overridevirtual

Reimplemented from YACS::ENGINE::Task.

Definition at line 1659 of file PythonNode.cxx.

1660 {
1661  return _container != nullptr && _container->canAcceptImposedResource();
1662 }
virtual bool canAcceptImposedResource()
Definition: Container.cxx:59

References YACS::ENGINE::InlineNode::_container, and YACS::ENGINE::Container::canAcceptImposedResource().

◆ checkBasicConsistency()

void PyFuncNode::checkBasicConsistency ( ) const
virtual

Reimplemented from YACS::ENGINE::InlineFuncNode.

Definition at line 1151 of file PythonNode.cxx.

1152 {
1153  DEBTRACE("checkBasicConsistency");
1155  {
1156  AutoGIL agil;
1157  PyObject* res;
1158  res=Py_CompileString(_script.c_str(),getName().c_str(),Py_file_input);
1159  if(res == NULL)
1160  {
1161  std::string error="";
1162  PyObject* new_stderr = newPyStdOut(error);
1163  PySys_SetObject((char*)"stderr", new_stderr);
1164  PyErr_Print();
1165  PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
1166  Py_DECREF(new_stderr);
1167  throw Exception(error);
1168  }
1169  else
1170  Py_XDECREF(res);
1171  }
1172 }
virtual void checkBasicConsistency() const
Definition: InlineNode.cxx:75
const std::string & getName() const
Definition: Node.hxx:125
PyObject * newPyStdOut(std::string &out)
Definition: PyStdout.cxx:129

References YACS::ENGINE::InlineNode::_script, YACS::ENGINE::InlineFuncNode::checkBasicConsistency(), DEBTRACE, YACS::ENGINE::Node::getName(), and YACS::ENGINE::newPyStdOut().

◆ cloneNode()

PyFuncNode * PyFuncNode::cloneNode ( const std::string &  name)
virtual

Create a new node of same type with a given name.

Reimplemented from YACS::ENGINE::InlineNode.

Definition at line 1612 of file PythonNode.cxx.

1613 {
1614  PyFuncNode* n=new PyFuncNode(name);
1615  n->setScript(_script);
1616  n->setFname(_fname);
1617  list<InputPort *>::iterator iter;
1618  for(iter = _setOfInputPort.begin(); iter != _setOfInputPort.end(); iter++)
1619  {
1620  InputPyPort *p=(InputPyPort *)*iter;
1621  n->edAddInputPort(p->getName(),p->edGetType());
1622  }
1623  list<OutputPort *>::iterator iter2;
1624  for(iter2 = _setOfOutputPort.begin(); iter2 != _setOfOutputPort.end(); iter2++)
1625  {
1626  OutputPyPort *p=(OutputPyPort *)*iter2;
1627  n->edAddOutputPort(p->getName(),p->edGetType());
1628  }
1629  return n;
1630 }
std::string getName() const
std::list< InputPort * > _setOfInputPort
std::list< OutputPort * > _setOfOutputPort
Class for Python Ports.
Definition: PythonPorts.hxx:74
PyFuncNode(const PyFuncNode &other, ComposedNode *father)
Proc * p
Definition: driver.cxx:216

References YACS::ENGINE::InlineFuncNode::_fname, YACS::ENGINE::InlineNode::_script, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, YACS::ENGINE::ComposedNode::getName(), gui.Appli::n, p, and PyFuncNode().

◆ createRemoteAdaptedPyInterpretor()

void PyFuncNode::createRemoteAdaptedPyInterpretor ( Engines::Container_ptr  objContainer)
protectedvirtual

returns an object, you have to deal with (UnRegister)

Implements YACS::ENGINE::PythonEntry.

Definition at line 1576 of file PythonNode.cxx.

1577 {
1578  if(!CORBA::is_nil(_pynode))
1579  _pynode->UnRegister();
1580  _pynode=objContainer->createPyNode(getName().c_str(),getScript().c_str());
1581 }
virtual std::string getScript()
Definition: InlineNode.hxx:51

References _pynode, YACS::ENGINE::Node::getName(), and YACS::ENGINE::InlineNode::getScript().

◆ execute()

void PyFuncNode::execute ( )
virtual

Implements YACS::ENGINE::Task.

Definition at line 1260 of file PythonNode.cxx.

1261 {
1263  executeRemote();
1264  else
1265  executeLocal();
1266 }
virtual void executeRemote()
virtual void executeLocal()
static const char REMOTE_NAME[]
Definition: PythonNode.hxx:125

References YACS::ENGINE::InlineNode::_mode, executeLocal(), executeRemote(), and YACS::ENGINE::PythonNode::REMOTE_NAME.

◆ executeLocal()

void PyFuncNode::executeLocal ( )
virtual

Definition at line 1455 of file PythonNode.cxx.

1456 {
1457  DEBTRACE( "++++++++++++++ PyFuncNode::execute: " << getName() << " ++++++++++++++++++++" );
1458 
1459  int pos=0;
1460  PyObject* ob;
1461  if(!_pyfunc)throw Exception("PyFuncNode badly loaded");
1462  {
1463  AutoGIL agil;
1464  DEBTRACE( "---------------PyFuncNode::inputs---------------" );
1465  PyObject* args = PyTuple_New(getNumberOfInputPorts()) ;
1466  list<InputPort *>::iterator iter2;
1467  for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
1468  {
1469  InputPyPort *p=(InputPyPort *)*iter2;
1470  DEBTRACE( "port name: " << p->getName() );
1471  DEBTRACE( "port kind: " << p->edGetType()->kind() );
1472  ob=p->getPyObj();
1473 #ifdef _DEVDEBUG_
1474  PyObject_Print(ob,stderr,Py_PRINT_RAW);
1475  cerr << endl;
1476 #endif
1477  DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
1478  Py_INCREF(ob);
1479  PyTuple_SetItem(args,pos,ob);
1480  DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
1481  pos++;
1482  }
1483  DEBTRACE( "---------------End PyFuncNode::inputs---------------" );
1484 
1485  DEBTRACE( "----------------PyFuncNode::calculation---------------" );
1486 #ifdef _DEVDEBUG_
1487  PyObject_Print(_pyfunc,stderr,Py_PRINT_RAW);
1488  cerr << endl;
1489  PyObject_Print(args,stderr,Py_PRINT_RAW);
1490  cerr << endl;
1491 #endif
1492  DEBTRACE( "_pyfunc refcnt: " << _pyfunc->ob_refcnt );
1493  PyObject* result = PyObject_CallObject( _pyfunc , args ) ;
1494  DEBTRACE( "_pyfunc refcnt: " << _pyfunc->ob_refcnt );
1495  Py_DECREF(args);
1496  fflush(stdout);
1497  fflush(stderr);
1498  if(result == NULL)
1499  {
1500  _errorDetails="";
1501  PyObject* new_stderr = newPyStdOut(_errorDetails);
1502  PySys_SetObject((char*)"stderr", new_stderr);
1503  std::ostringstream stream;
1504  stream << "/tmp/PythonNode_";
1505  stream << getpid();
1506  ofstream errorfile(stream.str().c_str());
1507  if (errorfile.is_open())
1508  {
1509  errorfile << _script;
1510  errorfile.close();
1511  }
1512  PyErr_Print();
1513  PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
1514  Py_DECREF(new_stderr);
1515  throw Exception("Error during execution");
1516  }
1517  DEBTRACE( "----------------End PyFuncNode::calculation---------------" );
1518 
1519  DEBTRACE( "-----------------PyFuncNode::outputs-----------------" );
1520  int nres=1;
1521  if(result == Py_None)
1522  nres=0;
1523  else if(PyTuple_Check(result))
1524  nres=PyTuple_Size(result);
1525 
1526  if(getNumberOfOutputPorts() != nres)
1527  {
1528  std::string msg="Number of output arguments : Mismatch between definition and execution";
1529  Py_DECREF(result);
1530  _errorDetails=msg;
1531  throw Exception(msg);
1532  }
1533 
1534  pos=0;
1535 #ifdef _DEVDEBUG_
1536  PyObject_Print(result,stderr,Py_PRINT_RAW);
1537  cerr << endl;
1538 #endif
1539  list<OutputPort *>::iterator iter;
1540  try
1541  {
1542  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
1543  {
1544  OutputPyPort *p=(OutputPyPort *)*iter;
1545  DEBTRACE( "port name: " << p->getName() );
1546  DEBTRACE( "port kind: " << p->edGetType()->kind() );
1547  DEBTRACE( "port pos : " << pos );
1548  if(PyTuple_Check(result))ob=PyTuple_GetItem(result,pos) ;
1549  else ob=result;
1550  DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
1551 #ifdef _DEVDEBUG_
1552  PyObject_Print(ob,stderr,Py_PRINT_RAW);
1553  cerr << endl;
1554 #endif
1555  p->put(ob);
1556  pos++;
1557  }
1558  }
1559  catch(ConversionException& ex)
1560  {
1561  Py_DECREF(result);
1562  _errorDetails=ex.what();
1563  throw;
1564  }
1565  DEBTRACE( "-----------------End PyFuncNode::outputs-----------------" );
1566  Py_DECREF(result);
1567  }
1568  DEBTRACE( "++++++++++++++ End PyFuncNode::execute: " << getName() << " ++++++++++++++++++++" );
1569 }

References YACS::ENGINE::Node::_errorDetails, _pyfunc, YACS::ENGINE::InlineNode::_script, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, driver_internal::args, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::ElementaryNode::getNumberOfInputPorts(), YACS::ENGINE::ElementaryNode::getNumberOfOutputPorts(), YACS::ENGINE::newPyStdOut(), and p.

Referenced by execute().

◆ executeRemote()

void PyFuncNode::executeRemote ( )
virtual

Definition at line 1268 of file PythonNode.cxx.

1269 {
1270  DEBTRACE( "++++++++++++++ PyFuncNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
1271  if(!_pyfuncSer)
1272  throw Exception("DistributedPythonNode badly loaded");
1273  //
1274  if(dynamic_cast<HomogeneousPoolContainer *>(getContainer()))
1275  {
1276  bool dummy;
1277  loadPythonAdapter(this,dummy);
1278  _pynode->executeAnotherPieceOfCode(getScript().c_str());
1279  }
1280  //
1281  Engines::pickledArgs_var serializationInputCorba(new Engines::pickledArgs);;
1282  {
1283 #if PY_VERSION_HEX < 0x03070000
1284  std::unique_lock<std::mutex> lock(data_mutex);
1285 #endif
1286  AutoGIL agil;
1287  PyObject *ob(0);
1288  //===========================================================================
1289  // Get inputs in input ports, build a Python tuple and pickle it
1290  //===========================================================================
1291  PyObject *args(PyTuple_New(getNumberOfInputPorts()));
1292  int pos(0);
1293  for(std::list<InputPort *>::iterator iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++,pos++)
1294  {
1295  InputPyPort *p=(InputPyPort *)*iter2;
1296  ob=p->getPyObj();
1297  Py_INCREF(ob);
1298  PyTuple_SetItem(args,pos,ob);
1299  }
1300 #ifdef _DEVDEBUG_
1301  PyObject_Print(args,stderr,Py_PRINT_RAW);
1302  std::cerr << endl;
1303 #endif
1304  PyObject *serializationInput=PyObject_CallObject(_pyfuncSer,args);
1305  Py_DECREF(args);
1306  //The pickled string may contain NULL characters so use PyString_AsStringAndSize
1307  char *serializationInputC(0);
1308  Py_ssize_t len;
1309  if (PyBytes_AsStringAndSize(serializationInput, &serializationInputC, &len))
1310  throw Exception("DistributedPythonNode problem in python pickle");
1311 
1312  serializationInputCorba->length(len);
1313  for(int i=0; i < len ; i++)
1314  serializationInputCorba[i]=serializationInputC[i];
1315  Py_DECREF(serializationInput);
1316  }
1317 
1318  //===========================================================================
1319  // Execute in remote Python node
1320  //===========================================================================
1321  DEBTRACE( "-----------------starting remote python invocation-----------------" );
1322  Engines::pickledArgs_var resultCorba;
1323  try
1324  {
1325  resultCorba=_pynode->execute(getFname().c_str(),serializationInputCorba);
1326  }
1327  catch( const SALOME::SALOME_Exception& ex )
1328  {
1329  std::string msg="Exception on remote python invocation";
1330  msg += '\n';
1331  msg += ex.details.text.in();
1332  _errorDetails=msg;
1333  throw Exception(msg);
1334  }
1335  catch(CORBA::COMM_FAILURE& ex)
1336  {
1337  std::ostringstream msg;
1338  msg << "Exception on remote python invocation." << std::endl ;
1339  msg << "Caught system exception COMM_FAILURE -- unable to contact the "
1340  << "object." << std::endl;
1341  _errorDetails=msg.str();
1342  throw Exception(msg.str());
1343  }
1344  catch(CORBA::SystemException& ex)
1345  {
1346  std::ostringstream msg;
1347  msg << "Exception on remote python invocation." << std::endl ;
1348  msg << "Caught a CORBA::SystemException." ;
1349  CORBA::Any tmp;
1350  tmp <<= ex;
1351  CORBA::TypeCode_var tc = tmp.type();
1352  const char *p = tc->name();
1353  if ( *p != '\0' )
1354  msg <<p;
1355  else
1356  msg << tc->id();
1357  msg << std::endl;
1358  _errorDetails=msg.str();
1359  throw Exception(msg.str());
1360  }
1361  catch(CORBA::Exception& ex)
1362  {
1363  std::ostringstream msg;
1364  msg << "Exception on remote python invocation." << std::endl ;
1365  msg << "Caught CORBA::Exception. " ;
1366  CORBA::Any tmp;
1367  tmp <<= ex;
1368  CORBA::TypeCode_var tc = tmp.type();
1369  const char *p = tc->name();
1370  if ( *p != '\0' )
1371  msg <<p;
1372  else
1373  msg << tc->id();
1374  msg << std::endl;
1375  _errorDetails=msg.str();
1376  throw Exception(msg.str());
1377  }
1378  catch(omniORB::fatalException& fe)
1379  {
1380  std::ostringstream msg;
1381  msg << "Exception on remote python invocation." << std::endl ;
1382  msg << "Caught omniORB::fatalException:" << std::endl;
1383  msg << " file: " << fe.file() << std::endl;
1384  msg << " line: " << fe.line() << std::endl;
1385  msg << " mesg: " << fe.errmsg() << std::endl;
1386  _errorDetails=msg.str();
1387  throw Exception(msg.str());
1388  }
1389  DEBTRACE( "-----------------end of remote python invocation-----------------" );
1390  //===========================================================================
1391  // Get results, unpickle and put them in output ports
1392  //===========================================================================
1393  char *resultCorbaC=new char[resultCorba->length()+1];
1394  resultCorbaC[resultCorba->length()]='\0';
1395  for(int i=0;i<resultCorba->length();i++)
1396  resultCorbaC[i]=resultCorba[i];
1397 
1398  {
1399 #if PY_VERSION_HEX < 0x03070000
1400  std::unique_lock<std::mutex> lock(data_mutex);
1401 #endif
1402  AutoGIL agil;
1403 
1404  PyObject *resultPython(PyBytes_FromStringAndSize(resultCorbaC,resultCorba->length()));
1405  delete [] resultCorbaC;
1406  PyObject *args(PyTuple_New(1)),*ob(0);
1407  PyTuple_SetItem(args,0,resultPython);
1408  PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args);
1409  Py_DECREF(args);
1410 
1411  DEBTRACE( "-----------------PythonNode::outputs-----------------" );
1412  int nres=1;
1413  if(finalResult == Py_None)
1414  nres=0;
1415  else if(PyTuple_Check(finalResult))
1416  nres=PyTuple_Size(finalResult);
1417 
1418  if(getNumberOfOutputPorts() != nres)
1419  {
1420  std::string msg="Number of output arguments : Mismatch between definition and execution";
1421  Py_DECREF(finalResult);
1422  _errorDetails=msg;
1423  throw Exception(msg);
1424  }
1425 
1426  try
1427  {
1428  int pos(0);
1429  for(std::list<OutputPort *>::iterator iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++, pos++)
1430  {
1431  OutputPyPort *p=(OutputPyPort *)*iter;
1432  DEBTRACE( "port name: " << p->getName() );
1433  DEBTRACE( "port kind: " << p->edGetType()->kind() );
1434  DEBTRACE( "port pos : " << pos );
1435  if(PyTuple_Check(finalResult))
1436  ob=PyTuple_GetItem(finalResult,pos) ;
1437  else
1438  ob=finalResult;
1439  DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
1440  p->put(ob);
1441  }
1442  Py_DECREF(finalResult);
1443  }
1444  catch(ConversionException& ex)
1445  {
1446  Py_DECREF(finalResult);
1447  _errorDetails=ex.what();
1448  throw;
1449  }
1450  }
1451 
1452  DEBTRACE( "++++++++++++++ ENDOF PyFuncNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
1453 }
int Py_ssize_t
Definition: PythonNode.cxx:45
static std::mutex data_mutex
Definition: PythonNode.cxx:90
virtual std::string getFname()
Definition: InlineNode.hxx:101
virtual Container * getContainer()
Definition: InlineNode.cxx:100
Engines::Container_var loadPythonAdapter(InlineNode *reqNode, bool &isInitializeRequested)
Definition: PythonNode.cxx:165

References YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::PythonEntry::_pyfuncSer, YACS::ENGINE::PythonEntry::_pyfuncUnser, _pynode, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, driver_internal::args, data_mutex, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::InlineNode::getContainer(), YACS::ENGINE::InlineFuncNode::getFname(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::ElementaryNode::getNumberOfInputPorts(), YACS::ENGINE::ElementaryNode::getNumberOfOutputPorts(), YACS::ENGINE::InlineNode::getScript(), yacsorb.CORBAEngineTest::i, YACS::ENGINE::PythonEntry::loadPythonAdapter(), and p.

Referenced by execute().

◆ getContainerLog()

std::string PyFuncNode::getContainerLog ( )
virtual

returns a string that contains the name of the container log file if it exists

Do nothing here. To subclass

Reimplemented from YACS::ENGINE::Node.

Definition at line 1632 of file PythonNode.cxx.

1633 {
1635 }
static std::string GetContainerLog(const std::string &mode, Container *container, const Task *askingTask)
Definition: PythonNode.cxx:283

References YACS::ENGINE::InlineNode::_container, YACS::ENGINE::InlineNode::_mode, and YACS::ENGINE::PythonEntry::GetContainerLog().

◆ getRemoteInterpreterHandle()

Engines::PyNodeBase_var PyFuncNode::getRemoteInterpreterHandle ( )
protectedvirtual

Implements YACS::ENGINE::PythonEntry.

Definition at line 1606 of file PythonNode.cxx.

1607 {
1608  return Engines::PyNodeBase::_narrow(_pynode);
1609 }

References _pynode.

◆ getSerializationScript()

const char* YACS::ENGINE::PyFuncNode::getSerializationScript ( ) const
inlineprotectedvirtual

Implements YACS::ENGINE::PythonEntry.

Definition at line 143 of file PythonNode.hxx.

143 { return SCRIPT_FOR_SERIALIZATION; }
static const char SCRIPT_FOR_SERIALIZATION[]
Definition: PythonNode.hxx:165

◆ hasImposedResource()

bool PyFuncNode::hasImposedResource ( ) const
overridevirtual

Reimplemented from YACS::ENGINE::PythonEntry.

Definition at line 1664 of file PythonNode.cxx.

1665 {
1667 }
virtual bool hasImposedResource() const
Definition: PythonNode.cxx:326

References YACS::ENGINE::PythonEntry::hasImposedResource().

◆ imposeResource()

void PyFuncNode::imposeResource ( const std::string &  resource_name,
const std::string &  container_name 
)
overridevirtual

Reimplemented from YACS::ENGINE::Task.

Definition at line 1649 of file PythonNode.cxx.

1651 {
1652  if(!resource_name.empty() && !container_name.empty())
1653  {
1654  _imposedResource = resource_name;
1655  _imposedContainer = container_name;
1656  }
1657 }
std::string _imposedResource
Definition: PythonNode.hxx:69
std::string _imposedContainer
Definition: PythonNode.hxx:70

References YACS::ENGINE::PythonEntry::_imposedContainer, and YACS::ENGINE::PythonEntry::_imposedResource.

◆ init()

void PyFuncNode::init ( bool  start = true)
virtual

initialisation of all input and output ports and gates, for execution

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 1137 of file PythonNode.cxx.

1138 {
1140  if(_state == YACS::DISABLED)
1141  {
1142  exDisabledState(); // to refresh propagation of DISABLED state
1143  return ;
1144  }
1145  if(start) //complete initialization
1147  else if(_state > YACS::LOADED)// WARNING FuncNode has internal vars (CEA usecase) ! Partial initialization (inside a loop). Exclusivity of funcNode.
1149 }
void initCommonPartWithoutStateManagement(bool start)
void setState(YACS::StatesForNode theState)
Sets the given state for node.
Definition: Node.cxx:652
virtual void exDisabledState()
Notify this node that it has been disabled.
Definition: Node.cxx:232
YACS::StatesForNode _state
Definition: Node.hxx:91
@ LOADED
Definition: define.hxx:39
@ READY
Definition: define.hxx:37
@ DISABLED
Definition: define.hxx:50
@ TORECONNECT
Definition: define.hxx:48

References YACS::ENGINE::Node::_state, YACS::DISABLED, YACS::ENGINE::Node::exDisabledState(), YACS::ENGINE::ElementaryNode::initCommonPartWithoutStateManagement(), YACS::LOADED, YACS::READY, YACS::ENGINE::Node::setState(), and YACS::TORECONNECT.

◆ load()

void PyFuncNode::load ( )
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 1174 of file PythonNode.cxx.

1175 {
1176  DEBTRACE( "---------------PyfuncNode::load function---------------" );
1178  loadRemote();
1179  else
1180  loadLocal();
1181 }
virtual void loadLocal()
virtual void loadRemote()

References YACS::ENGINE::InlineNode::_mode, DEBTRACE, loadLocal(), loadRemote(), and YACS::ENGINE::PythonNode::REMOTE_NAME.

◆ loadLocal()

void PyFuncNode::loadLocal ( )
virtual

Definition at line 1188 of file PythonNode.cxx.

1189 {
1190  DEBTRACE( "---------------PyFuncNode::load function " << getName() << " ---------------" );
1191  DEBTRACE( _script );
1192 
1193 #ifdef _DEVDEBUG_
1194  list<OutputPort *>::iterator iter;
1195  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
1196  {
1197  OutputPyPort *p=(OutputPyPort *)*iter;
1198  DEBTRACE( "port name: " << p->getName() );
1199  DEBTRACE( "port kind: " << p->edGetType()->kind() );
1200  }
1201 #endif
1202 
1203  {
1204  AutoGIL agil;
1205  DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
1206 
1207  std::ostringstream stream;
1208  stream << "/tmp/PythonNode_";
1209  stream << getpid();
1210 
1211  PyObject* code=Py_CompileString(_script.c_str(), stream.str().c_str(), Py_file_input);
1212  if(code == NULL)
1213  {
1214  _errorDetails="";
1215  PyObject* new_stderr = newPyStdOut(_errorDetails);
1216  PySys_SetObject((char*)"stderr", new_stderr);
1217  PyErr_Print();
1218  PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
1219  Py_DECREF(new_stderr);
1220  throw Exception("Error during execution");
1221  }
1222  PyObject *res = PyEval_EvalCode( code, _context, _context);
1223  Py_DECREF(code);
1224  Py_XDECREF(res);
1225 
1226  DEBTRACE( "_context refcnt: " << _context->ob_refcnt );
1227  if(PyErr_Occurred ())
1228  {
1229  _errorDetails="";
1230  PyObject* new_stderr = newPyStdOut(_errorDetails);
1231  PySys_SetObject((char*)"stderr", new_stderr);
1232  ofstream errorfile(stream.str().c_str());
1233  if (errorfile.is_open())
1234  {
1235  errorfile << _script;
1236  errorfile.close();
1237  }
1238  PyErr_Print();
1239  PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
1240  Py_DECREF(new_stderr);
1241  throw Exception("Error during execution");
1242  return;
1243  }
1244  _pyfunc=PyDict_GetItemString(_context,_fname.c_str());
1245  DEBTRACE( "_pyfunc refcnt: " << _pyfunc->ob_refcnt );
1246  if(_pyfunc == NULL)
1247  {
1248  _errorDetails="";
1249  PyObject* new_stderr = newPyStdOut(_errorDetails);
1250  PySys_SetObject((char*)"stderr", new_stderr);
1251  PyErr_Print();
1252  PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
1253  Py_DECREF(new_stderr);
1254  throw Exception("Error during execution");
1255  }
1256  DEBTRACE( "---------------End PyFuncNode::load function---------------" );
1257  }
1258 }

References YACS::ENGINE::PythonEntry::_context, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::InlineFuncNode::_fname, _pyfunc, YACS::ENGINE::InlineNode::_script, YACS::ENGINE::ElementaryNode::_setOfOutputPort, DEBTRACE, YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::newPyStdOut(), and p.

Referenced by load().

◆ loadRemote()

void PyFuncNode::loadRemote ( )
virtual

Definition at line 1183 of file PythonNode.cxx.

1184 {
1185  commonRemoteLoad(this);
1186 }
void commonRemoteLoad(InlineNode *reqNode)
Definition: PythonNode.cxx:318

References YACS::ENGINE::PythonEntry::commonRemoteLoad().

Referenced by load().

◆ retrieveDftRemotePyInterpretorIfAny()

Engines::PyNodeBase_var PyFuncNode::retrieveDftRemotePyInterpretorIfAny ( Engines::Container_ptr  objContainer) const
protectedvirtual

returns (if any) an object, you have to deal with (UnRegister)

Implements YACS::ENGINE::PythonEntry.

Definition at line 1583 of file PythonNode.cxx.

1584 {
1585  Engines::PyNode_var ret(objContainer->getDefaultPyNode(getName().c_str()));
1586  if(!CORBA::is_nil(ret))
1587  {
1588  ret->Register();
1589  }
1590  return Engines::PyNodeBase::_narrow(ret);
1591 }

References YACS::ENGINE::Node::getName().

◆ shutdown()

void PyFuncNode::shutdown ( int  level)
virtual

Stop all pending activities of the node.

This method should be called when a Proc is finished and must be deleted from the YACS server

Reimplemented from YACS::ENGINE::Node.

Definition at line 1637 of file PythonNode.cxx.

1638 {
1639  DEBTRACE("PyFuncNode::shutdown " << level);
1640  if(_mode=="local")return;
1641  if(_container)
1642  {
1643  if(!CORBA::is_nil(_pynode)) _pynode->UnRegister();
1644  _pynode=Engines::PyNode::_nil();
1645  _container->shutdown(level);
1646  }
1647 }
virtual void shutdown(int level)=0

References YACS::ENGINE::InlineNode::_container, YACS::ENGINE::InlineNode::_mode, _pynode, DEBTRACE, and YACS::ENGINE::Container::shutdown().

◆ simpleClone()

Node * PyFuncNode::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Implements YACS::ENGINE::Node.

Definition at line 1571 of file PythonNode.cxx.

1572 {
1573  return new PyFuncNode(*this,father);
1574 }

References PyFuncNode().

◆ typeName()

virtual std::string YACS::ENGINE::PyFuncNode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::InlineFuncNode.

Definition at line 163 of file PythonNode.hxx.

163 { return "YACS__ENGINE__PyFuncNode"; }

Member Data Documentation

◆ _pyfunc

PyObject* YACS::ENGINE::PyFuncNode::_pyfunc
protected

Definition at line 167 of file PythonNode.hxx.

Referenced by executeLocal(), and loadLocal().

◆ _pynode

Engines::PyNode_var YACS::ENGINE::PyFuncNode::_pynode
protected

◆ SCRIPT_FOR_SERIALIZATION

const char PyFuncNode::SCRIPT_FOR_SERIALIZATION
static
Initial value:
="import pickle\n"
"def pickleForDistPyth2009(*args,**kws):\n"
" return pickle.dumps((args,kws),-1)\n"
"\n"
"def unPickleForDistPyth2009(st):\n"
" args=pickle.loads(st)\n"
" return args\n"

Definition at line 165 of file PythonNode.hxx.


The documentation for this class was generated from the following files: