]> SALOME platform Git repositories - modules/yacs.git/blobdiff - doc/schemapy.rst
Salome HOME
bos #26458 Versioning of sources via git commit id (sha1)
[modules/yacs.git] / doc / schemapy.rst
index 19b6df984a6c35a6b44ad60bbe11fd0e380eb0ba..f9454197ef8e239b0b6dd0e31f2ae0213eba68d9 100644 (file)
@@ -256,6 +256,9 @@ and to assign a container (see :ref:`py_container` to define a container) to the
   n.setExecutionMode("remote")
   n.setContainer(cont1)
 
+The default option for the execution mode is **local** where the node will run
+on the same container as the scheme executor.
+
 .. _pyfunc:
 
 Python function node
@@ -281,6 +284,9 @@ and to assign a container (see :ref:`py_container` to define a container) to the
   n2.setExecutionMode("remote")
   n2.setContainer(cont1)
 
+The default option for the execution mode is **local** where the node will run
+on the same container as the scheme executor.
+
 .. _pyservice:
 
 SALOME service node
@@ -346,22 +352,21 @@ Node n3 will be executed before node n4.
 
 Dataflow link
 ++++++++++++++++++++++++++++
-The first step in defining a dataflow link is to obtain port objects using one of the methods described above.  
-The edAddDFLink method for the context node is then used, transferring the two ports to be connected to it.
-The following gives an example of a dataflow link between the output port p1 of node n3 and the input port of node n4::
+The first step in defining a dataflow link is to obtain port objects using one of the methods described above.
+Then, the edAddLink method links an output port to an input port::
 
   pout=n3.getOutputPort("p1")
   pin=n4.getInputPort("p1")
-  p.edAddDFLink(pout,pin)
+  p.edAddLink(pout,pin)
 
-Data link
-++++++++++++++++++++++++++++
-A data link is defined as being a dataflow link using the edAddLink method instead of edAddDFLink.  
-The same example as above with a data link::
+Most of the time, when you need a dataflow link between two ports, you also need a control link between the nodes
+of the ports. In this case you can use the method edAddDFLink::
 
   pout=n3.getOutputPort("p1")
   pin=n4.getInputPort("p1")
-  p.edAddLink(pout,pin)
+  p.edAddDFLink(pout,pin)
+
+edAddDFLink is equivalent to edAddCFLink followed by edAddLink.
 
 Initialising an input data port
 '''''''''''''''''''''''''''''''''''''''''''''''
@@ -397,6 +402,7 @@ will appear as follows::
   r = pilot.getRuntime()
   p=r.createProc("pr")
   ti=p.getTypeCode("int")
+  td=p.getTypeCode("double")
   #node1
   n1=r.createScriptNode("","node1")
   p.edAddChild(n1)
@@ -420,11 +426,8 @@ will appear as follows::
   p.edAddCFLink(n1,n2)
   p.edAddCFLink(n1,n4)
   #dataflow links
-  pout=n3.getOutputPort("p1")
-  pin=n4.getInputPort("p1")
-  #dataflow links
-  p.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
-  p.edAddDFLink(n1.getOutputPort("p1"),n4.getInputPort("p1"))
+  p.edAddLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
+  p.edAddLink(n1.getOutputPort("p1"),n4.getInputPort("p1"))
   #initialisation ports
   n1.getInputPort("p1").edInitPy(5)
 
@@ -454,7 +457,6 @@ Repeating a part of the example above, we will get::
   n2.setScript("p1=2*p1")
   n2.edAddInputPort("p1",ti)
   n2.edAddOutputPort("p1",ti)
-  b.edAddCFLink(n1,n2)
   b.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1"))
 
 .. _py_forloop:
@@ -609,19 +611,15 @@ is defined by the class async in the python module myalgo2.py::
 
 Definition of containers
 ''''''''''''''''''''''''''''
-A container is defined using the runtime createContainer method and it is then given a name using its setName method.  
-The next step is to assign constraints to it by adding properties.  
-The following is an example creation of a container named “A”::
 
-  c1=r.createContainer()
-  c1.setName("A")
+This example shows how to add a container to a scheme::
+
+  c1=p.createContainer("MyContainer")
 
 A property is added to a container using its setProperty method that uses 2 arguments (character strings).  
 The first is the property name.  The second is its value.  
-The following is an example of this container “A” with constraints::
+The following is an example of how to set constraints on the container::
 
-  c1=r.createContainer()
-  c1.setName("A")
   c1.setProperty("container_name","FactoryServer")
   c1.setProperty("hostname","localhost")
   c1.setProperty("mem_mb","1000")
@@ -630,10 +628,27 @@ Once the containers have been defined, SALOME components can be placed on this c
 of a SALOME service node is to obtain the component instance of this service node using the getComponent method for this node.  
 The previously defined container is then assigned to this component instance using the setContainer method of the component instance.
 
-If it is required to place the SALOME service defined above (node “node3”) on container “A”, we will write::
+If it is required to place the SALOME service defined above (node “node3”) on
+“MyContainer”, we will write::
 
   n3.getComponent().setContainer(c1)
 
+It is also possible to place python nodes on containers, but the code is a
+little different (see :ref:`pyscript`)::
+
+  n1.setExecutionMode("remote")
+  n1.setContainer(c1)
+
+Since SALOME v7.5, there is a new type of container:
+*Homogeneous Pool of SALOME containers* (HP container).
+It is possible to create this type of container this way::
+
+   my_hp_cont=r.createContainer("MyHPCont","HPSalome")
+
+- "MyHPCont" : name of the container. Same result as my_hp_cont.setName("MyHPCont").
+- "HPSalome" : type of container. Possible values are "HPSalome" (for a HP container)
+  or "Salome" (for a classic container).
+
 Node properties
 '''''''''''''''''''''''''''
 A property is added to an elementary or composite node (or is modified) using its setProperty method that has two 
@@ -765,19 +780,17 @@ The result file will be copied into the local file myfile::
 StudyIn node
 ++++++++++++++
 A StudyIn node is defined using the runtime createInDataNode method.  It uses two arguments, the first of which must be “study” 
-and the second the node name.  The associated study is specified by adding the “StudyID” property to the node using 
-its setProperty method.  Node data are defined by adding output data ports using the edAddOutputPOrt method, transferring 
+and the second the node name.  Node data are defined by adding output data ports using the edAddOutputPOrt method, transferring 
 the name of the data and its type as arguments.  The data is initialised with the reference in the study, using the setData method 
 for the port thus created, transferring a character string to it containing either the SALOME Entry or the path in the study 
 tree structure.
 
 The following is an example of the StudyIn node that defines 2 GEOM_Object type data (a and b).  The study is assumed to be 
-loaded into memory by SALOME as StudyID 1.  Data a is referenced by one SALOME Entry.  Data b is referenced by a path in the 
+loaded into memory by SALOME.  Data a is referenced by one SALOME Entry.  Data b is referenced by a path in the 
 study tree structure::
 
   n=r.createInDataNode("study","study1")
   p.edAddChild(n)
-  n.setProperty("StudyID","1")
   pout=n.edAddOutputPort('a',tgeom)
   pout.setData("0:1:1:1")
   pout=n.edAddOutputPort('b',tgeom)
@@ -788,21 +801,19 @@ study tree structure::
 StudyOut node
 ++++++++++++++
 A StudyOut node is defined using the runtime createOutDataNode method.  It uses two arguments, the first of 
-which must be “study” and the second the node name.  The associated study is specified by adding 
-the “StudyID” property to the node using its setProperty method.  The name of the file in which the study will be 
+which must be “study” and the second the node name. The name of the file in which the study will be 
 saved is specified using the node SetRef method with the file name as an argument.  
 The node results are defined by adding input data ports to it using the edAddInputPort method, transferring the data name 
 and type as arguments.  The setData method for the port is used to associate the entry into the study to the result, transferring 
 a character string to it that contains either the SALOME Entry or the path in the study tree structure.
 
 The following contains an example of the StudyOut node that defines two GEOM_Object type results (a and b).  
-The studyId of the study used is 1.  Result a is referenced by a SALOME Entry.  The result b is referenced by a path.  
+Result a is referenced by a SALOME Entry.  The result b is referenced by a path.  
 The complete study is saved in the study1.hdf file at the end of the calculation::
 
   n=r.createOutDataNode("study","study2")
   n.setRef("study1.hdf")
   p.edAddChild(n)
-  n.setProperty("StudyID","1")
   pout=n.edAddInputPort('a',tgeom)
   pout.setData("0:1:2:1")
   pout=n.edAddInputPort('b',tgeom)