|
![]() |
Parameters tied to the deployment of an application should be totally described in a xml deployment descriptor. Hence within the source code, there are no longer any references to :
A ProActive application can be deployed on different hosts, with different protocols without changing the source code
newActive(String, Object[], Node);
newActive(String, Object[], VirtualNode); turnActive(Object, String, VirtualNode);
<ProActiveDescriptor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DescriptorSchema.xsd"> <componentDefinition> <virtualNodesDefinition> <virtualNode name="Dispatcher"/> </virtualNodesDefinition> <componentDefinition/> <deployment> <mapping> <map virtualNode="Dispatcher"> <jvmSet> <vmName value="Jvm1"/> </jvmSet> </map> </mapping> <jvms> <jvm name="Jvm1"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> </jvms> </deployment> <infrastructure> <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> </processes> </infrastructure> </ProActiveDescriptor>This example shows a VirtualNode called Dispatcher, that is mapped to a jvm called Jvm1
ProActiveDescriptor pad = ProActive.getProActiveDescriptor(String xmlFileLocation);
VirtualNode dispatcher = pad.getVirtualNode("Dispatcher");
dispatcher.activate();
Node node = dispatcher.getNode();
C3DDispatcher c3dDispatcher = newActive("org.objectweb.proactive.core.examples.c3d.C3DDispatcher", param, node);
..........................
<virtualNodesDefinition> <virtualNode name="Dispatcher"/> <virtualNodesDefinition/> <deployment> <mapping> <map virtualNode="Dispatcher"> <jvmSet> <vmName value="Jvm0"/> </jvmSet> </map> </mapping>Another possibility for the one to one mapping is to map 1 VN to the jvm running the program. In that case the lookup protocol to be used must be specified as it is shown in the following:
<virtualNodesDefinition> <virtualNode name="Dispatcher"/> <virtualNodesDefinition/> <deployment> <mapping> <map virtualNode="Dispatcher"> <jvmSet> <currentJvm protocol="rmi"/> </jvmSet> </map> </mapping>Since it is the current jvm, it has not to be redifined later in the descriptor. This will be shown in a complete example
<virtualNodesDefinition> <virtualNode name="Renderer" property="multiple"/> <virtualNodesDefinition/> <deployment> <mapping> <map virtualNode="Renderer"> <jvmSet> <currentJvm protocol="rmi"/> <vmName value="Jvm1"/> <vmName value="Jvm2"/> <vmName value="Jvm3"/> <vmName value="Jvm4"/> </jvmSet> </map> </mapping>Note that the property attribute is set to multiple if you want to map 1 VN to multiple JVMs, and then a set of JVMs is defined for the VirtualNode Renderer. Four values are possible for the property attribute: unique which means one to one mapping, unique_singleAO: one to one mapping and only one AO deployed on the corresponding node, multiple: one to N mapping, multiple_cyclic: one to N mapping in a cyclic manner. This property is not mandatory but an exception can be thrown in case of incompatibility. For instance property set to unique, and more than one jvm defined in the jvmSet tag. In case of property set to unique_singleAO method getUniqueAO() in class org.objectweb.proactive.core.descriptor.data.VirtualNode called on such VirtualNode returns the unique AO created
<virtualNodesDefinition> <virtualNode name="Renderer" timeout="200" waitForTimeout="true"/> <virtualNodesDefinition/>The timeout attribute represents an amount of time(in seconds) to wait before accessing Nodes mapped on the VirtualNode. The waitForTimeout attribute is a boolean. If set to true, you will have to wait exaclty timeout seconds before accessing Nodes. If set to false, timeout represents the maximum amount of time to wait, it means that if all nodes are created before the timeout expires, you get access to the Nodes. Defaut value for waitForTimeout attribute is false. The first option is very usefull when there is no idea about how many nodes will be mapped on the VirtualNode(which is often unususal). Those attributes are optional
<virtualNodesDefinition> <virtualNode name="Dispatcher" property="unique_singleAO"/> <virtualNode name="Renderer" property="multiple"/> </virtualNodesDefinition> <deployment> <mapping> <map virtualNode="Dispatcher"> <jvmSet> <vmName value="Jvm1"/> </jvmSet> </map> <map virtualNode="Renderer"> <jvmSet> <vmName value="Jvm1"/> <vmName value="Jvm2"/> <vmName value="Jvm3"/> <vmName value="Jvm4"/> </jvmSet> </map> </mapping>In this example both VirtualNodes Dispatcher and Renderer have a mapping with Jvm1, it means that at deployment time, both VirtualNodes will get nodes created in the same JVM. Here is the notion of co-allocation in a JVM.
<virtualNodesDefinition> <virtualNode name="Dispatcher" property="unique_singleAO"/> <virtualNodesDefinition/> <deployment> <register virtualNode="Dispatcher" protocol="rmi"/> <mapping> <map virtualNode="Dispatcher"> <jvmSet> <vmName value="Jvm0"/> </jvmSet> </map> </mapping>The register tag allows to register the VirtualNode Dispatcher when activated, on the local machine in the RMIRegistry. As said before if the protocol is jini, the VirtualNode will be registered in JINI Lookup Service.
<virtualNodesAcquisition> <virtualNode name="Dispatcher"/> </virtualNodesAcquisition> .......... <deployment> .......... <lookup virtualNode="Dispatcher" host="machine_name" protocol="rmi"/> </deployment>As mentioned in the previous section, in order to acquire VirtualNode Dispatcher, it must have been previously registered on the specified host by another application. Sometimes, the host where to perform the lookup will only be known at runtime, it that case it is specified in the descriptor with "*" for the host attribute
<lookup virtualNode="Dispatcher" host="*" protocol="rmi"/>Then when the host name is available, ProActive provides method setRuntimeInformations in class org.objectweb.proactive.core.descriptor.data.VirtualNode to update the value and to perform the lookup. Typical example of code:
ProActiveDescriptor pad = ProActive.getProActiveDescriptor(String xmlFileLocation);
pad.activateMappings;
vnDispatcher = pad.getVirtualNode("Dispatcher");
..........................
vnDispatcher.setRuntimeInformations("LOOKUP_HOST","machine_name);
ProActive.registerVirtualNode(VirtualNode virtualNode, String registrationProtocol, boolean replacePreviousBinding );
ProActive.lookupVirtualNode(String url, String protocol);
ProActive.unregisterVirtualNode(VirtualNode virtualNode);
........................... <jvm name="jvm1"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> .................................In this example, jvm1 will be created using the process called jvmProcess (discussed later, this process represents a java process and can be seen as java ProActiveClassname command)
......................... <jvm name="Jvm1" nodeNumber="3"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> ..........................Note that the nodeNumber attribute is set to the number of Nodes associated to the Jvm1
<ProActiveDescriptor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Location_of_DescriptorSchema.xsd">Note that this schema is available in the ProActive distribution package under ProActive\descriptor directory. Using descriptors related methods (Proactive.getProActiveDescriptor(file)) triggers automatic and transparent validation of the file using Xerces2_4_0 if the ProActive property schema.validation is set to enable(see configuration file for more details). If a problem occurs during the validation, an error message is displayed otherwise if the validation is successful no message appear. An XML validation tool such as XMLSPY5.0(windows) can also be used to validate XML descriptors.
<ProActiveDescriptor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DescriptorSchema.xsd"> <componentDefinition> <virtualNodesDefinition> <virtualNode name="Dispatcher" property="unique_singleAO"/> <virtualNode name="Renderer" property="multiple"/> </virtualNodesDefinition> </componentDefinition> <deployment> <register virtualNode="Dispatcher" protocol="rmi"/> <mapping> <map virtualNode="Dispatcher"> <jvmSet> <currentJvm protocol="rmi"/> </jvmSet> </map> <map virtualNode="Renderer"> <jvmSet> <vmName value="Jvm1"/> <vmName value="Jvm2"/> <vmName value="Jvm3"/> <vmName value="Jvm4"/> </jvmSet> </map> </mapping> <jvms> <jvm name="Jvm1"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> <jvm name="Jvm2"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> <jvm name="Jvm3"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> <jvm name="Jvm4"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> </jvms> </deployment> <infrastructure> <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> </processes> </infrastructure> </ProActiveDescriptor>This example represents xml deployment descriptor for the C3D application. The abstract part containing VirtualNodes definition and deployment informations has already been explained. To summarize, two VirtualNodes are defined Dispatcher and Renderer. Dispatcher is mapped to the jvm running the main(), whose acquisition method is performed by looking up the RMIRegistry. This VirtualNode will be registered in the RMIRegistry when activated. Renderer is mapped to a set of JVMs called Jvm1, ..., Jvm4.
<ProActiveDescriptor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DescriptorSchema.xsd"> <componentDefinition> <virtualNodesDefinition> <virtualNode name="User"/> </virtualNodesDefinition> <virtualNodesAcquisition> <virtualNode name="Dispatcher"/> </virtualNodesAcquisition> </componentDefinition> <deployment> <mapping> <map virtualNode="User"> <jvmSet> <currentJvm protocol="rmi"/> </jvmSet> </map> </mapping> <lookup virtualNode="Dispatcher" host="*" protocol="rmi"/> </deployment> <infrastructure> <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> </processes> </infrastructure> </ProActiveDescriptor>This filespecify is read when addind a C3DUser. Two VirtualNodes are defined User which is mapped to the jvm running the main(), whose acquisition method is performed by looking up the RMIRegistry and Dispatcher in the virtualNodesAcquisition part which will be the result of a lookup in the RMIRegistry of a host to be specified at runtime.
org.objectweb.proactive.core.process.JVMNodeProcess
<infrastructure> <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcesss"> <classpath> <relativePath origin="user.home" value="/ProActive/classes"/> <relativePath origin="user.home" value="/ProActive/lib/bcel.jar"/> <relativePath origin="user.home" value="/ProActive/lib/asm.jar"/> <relativePath origin="user.home" value="/ProActive/lib/jini-core.jar"/> <relativePath origin="user.home" value="/ProActive/lib/jini-ext.jar"/> <relativePath origin="user.home" value="/ProActive/lib/reggie.jar"/> </classpath> <javaPath> <absolutePath value="/usr/local/jdk1.4.0/bin/java"/> </javaPath> <policyFile> <absolutePath value="/net/home/rquilici/ProActive/scripts/unix/proactive.java.policy"/> </policyFile> <log4jpropertiesFile> <relativePath origin="user.home" value="ProActive/scripts/unix/proactive-log4j"/> </log4jpropertiesFile> <ProActiveUserPropertiesFile> <absolutePath value="/net/home/rquilici/config.xml"/> </ProActiveUserPropertiesFile> <jvmParameters> <parameter value="-Djava.library.path=/home1/fabrice/workProActive/ProActive/lib"/> <parameter value="-Dsun.boot.library.path=/home1/fabrice/workProActive/ProActive/lib"/> <parameter value=-Xms512 -Xmx512"/> </jvmParameters> </jvmProcess> </processDefinition> </processes> </infrastructure>As shown in the example above, ProActive provides the ability to define or change the classpath environment variable, the java path, the policy file path, the log4j properties file path, the ProActive properties file path (see configuration file for more details) and also to pass parameters to the JVM to be created. Note that parameters to be passed here are related to the jvm in opposition to properties given in the configuration file(more focused on ProActive or application behaviour). In fact parameters given here will be part of the java command to create other jvms, whereas properties given in the config file will be loaded once the jvm is created.
<bootclasspath> <absolutePath value="/home1/fabrice/IOFAb/Ibis/"/> <absolutePath value="/home1/fabrice/IOFAb/classlibs/jdk"/> </bootclasspath>
<jvm name="Jvm2"> <creation> <processReference refid="rshProcess"/> </creation> </jvm> ................................................... <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id="rshProcess"> <rshProcess class="org.objectweb.proactive.core.process.rsh.RSHJVMProcess" hostname="sea.inria.fr"> <processReference refid="jvmProcess"/> </rshProcess> </processDefinition> </processes>For the Jvm2 the creation process is rshProcess(still an abstract name), which is defined in the infrastructure section. To define this process you have to give the class to instantiate to create the rsh process. ProActive provides
org.objectweb.proactive.core.process.rsh.RSHJVMProcess
to create rsh process. You must give the remote host name to log on with rsh. You can define as well username="toto"
if you plan to use rsh with -l option. As said before this rsh process must reference a local process, and in the example, it references the process defined with the id jvmProcess. It means that once logged on sea.inria.fr with rsh, a local JVM will be launched, ie a ProActive node will be created on sea.inria.fr thanks to the process defined by jvmProcess.<jvm name="Jvm2"> <creation> <processReference refid="rloginProcess"/> </creation> </jvm> ................................................... <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id=""rloginProcess"> <rloginProcess class="org.objectweb.proactive.core.process.lsf.RLoginProcess" hostname="sea.inria.fr"> <processReference refid="jvmProcess"/> </rloginProcess> </processDefinition> </processes>You can use rlogin in the same way that you would use rsh
<jvm name="Jvm2"> <creation> <processReference refid="sshProcess"/> </creation> </jvm> ................................................... <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id="sshProcess"> <sshProcess class="org.objectweb.proactive.core.process.ssh.SSHProcess" hostname="sea.inria.fr"> <processReference refid="jvmProcess"/> </sshProcess> </processDefinition>ProActive provides
org.objectweb.proactive.core.process.ssh.SSHProcess
to create ssh process. org.objectweb.proactive.core.process.lsf.LSFBSubProcess
to create bsub process. <jvm name="Jvm2"> <creation> <processReference refid="sshProcess"/> </creation> </jvm> ................................................... <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id="bsubInriaCluster"> <bsubProcess class="org.objectweb.proactive.core.process.lsf.LSFBSubProcess"> <processReference refid="jvmProcess"/> <bsubOption> <hostlist>cluster_machine1 cluster_machine2<hostlist/> <processor>6</processor> <scriptPath> <absolutePath value="/net/home/rquilici/ProActive/scripts/unix/cluster/startRuntime.sh"/> </scriptPath> </bsubOption> </bsubProcess> </processDefinition> <processDefinition id="sshProcess"> <sshProcess class="org.objectweb.proactive.core.process.ssh.SSHProcess" hostname="sea.inria.fr"> <processReference refid="bsubInriaCluster"/> </sshProcess> </processDefinition> </processes>In this example, the JVM called Jvm2 will be created using ssh to log on the cluster front end. Then a bsub command will be generated thanks to the process defined by bsubInriaCluster. This bsub command will create Nodes on several cluster machines, since bsubInriaCluster references the jvmProcess defined process. All tags defined under <bsubOption> are not mandatory, but they can be very usefull. The <hostlist> tag defines possible candidates in the job attribution, if not set the job will be allocated among all cluster's machines. The <processor> tag defines the number of processor requested, if not set, one processor is requested. The <resourceRequirement> tag defines the expected number of processors per machine. For instance <resourceRequirement value="span[ptile=2]"/> ensures that 2 processors per machines will be used, whereas value="span[ptile=1]" forces that LSF allocates only only one processor per machine. It represents the -R option of LSF. At last <scriptPath> defines the path on the cluster front end of the script startRuntime.sh which is necessary to run ProActive on a cluster. This script is located under Proactive/scripts/unix/cluster. If not set the default location is set as ~/Proactive/scripts/unix/cluster.
<jvm name="Jvm2"> <creation> <processReference refid="bsubProcess"/> </creation> </jvm> ................................................... <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id="bsubInriaCluster"> <bsubProcess class="org.objectweb.proactive.core.process.lsf.LSFBSubProcess" interactive="true" queue="short'> <processReference refid="jvmProcess"/> <bsubOption> <hostlist>cluster_machine1 cluster_machine2<hostlist/> <processor>6</processor> <resourceRequirement value="span[ptile=2]"/> <scriptPath> <absolutePath value="/net/home/rquilici/ProActive/scripts/unix/cluster/startRuntime.sh"/> </scriptPath> </bsubOption> </bsubProcess> </processDefinition> </processes>Note that in the example above two attributes: interactive and queue appear. They are optional, and have a default value: respectively false and normal. They represent option in the bsub command: interactive mode, and the name of the queue.
org.objectweb.proactive.core.process.globus.GlobusProcess
to create globus process. <jvm name="Jvm2"> <creation> <processReference refid="globusProcess"/> </creation> </jvm> ................................................... <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id="globusProcess"> <globusProcess class="org.objectweb.proactive.core.process.globus.GlobusProcess" hostname="globus1.inria.fr"> <processReference refid="jvmProcess"/> <environment> <variable name="DISPLAY" value="machine_name0.0"/> </environment> <globusOption> <count>10</count> </globusOption> </globusProcess> </processDefinition> </processes>In this example, Jvm2 will be created using GRAM. An RSL request will be generated with informations provided in the descriptor. For instance, the <environment> tag is not mandatory, but for the globus host to export the DISPLAY on your machine, you can define the value in the descriptor as well as other environment variable, except the classpath(or java path,...) which must be defined in the local process referenced by globusProcess as explained before. <globusOption> is neither manatory. Default value for <count> element is 1. It represents the number of processor requested.
<virtualNodesDefinition> <virtualNode name="PenguinNode" property="multiple"/> <virtualNodesDefinition/> <deployment> <mapping> <map virtualNode="PenguinNode"> <jvmSet> <vmName value="Jvm1"/> <vmName value="Jvm2"/> <vmName value="Jvm3"/> <vmName value="Jvm4"/> </jvmSet> </map> </mapping> <jvms> <jvm name="Jvm1"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> <jvm name="Jvm2"> <creation> <processReference refid="jvmProcess"/> </creation> </jvm> <jvm name="Jvm3"> <creation> <processReference refid="sshInriaCluster"/> </creation> </jvm> <jvm name="Jvm4"> <creation> <processReference refid="globusProcess"/> </creation> </jvm> </jvms> </deployment> <infrastructure> <processes> <processDefinition id="jvmProcess"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"/> </processDefinition> <processDefinition id="jvmProcess1"> <jvmProcess class="org.objectweb.proactive.core.process.JVMNodeProcess"> <classpath> <relativePath origin="userHome" value="/ProActive/classes"/> <relativePath origin="userHome" value="/ProActive/lib/bcel.jar"/> <relativePath origin="userHome" value="/ProActive/lib/asm.jar"/> <relativePath origin="userHome" value="/ProActive/lib/jini-core.jar"/> <relativePath origin="userHome" value="/ProActive/lib/jini-ext.jar"/> <relativePath origin="userHome" value="/ProActive/lib/reggie.jar"/> ............. </classpath> <javaPath> <absolutePath value="/usr/local/jdk1.4.0/bin/java"/> </javaPath> <policyFile> <absolutePath value="/net/home/rquilici/ProActive/scripts/unix/proactive.java.policy"/> </policyFile> <log4jpropertiesFile> <absolutePath value="/net/home/rquilici/ProActive/scripts/unix/proactive-log4j"/> </log4jpropertiesFile> <ProActiveUserPropertiesFile> <absolutePath value="/net/home/rquilici/config.xml"/> </ProActiveUserPropertiesFile> </jvmProcess> </processDefinition> <processDefinition id="bsubInriaCluster"> <bsubProcess class="org.objectweb.proactive.core.process.lsf.LSFBSubProcess"> <processReference refid="jvmProcess1"/> <bsubOption> <hostlist>cluster_group1 cluster_group2<hostlist/> <processor>4</processor> <resourceRequirement value="span[ptile=2]"/> <scriptPath> <absolutePath value="/net/home/rquilici/ProActive/scripts/unix/cluster/startRuntime.sh"/> </scriptPath> </bsubOption> </bsubProcess> </processDefinition> <processDefinition id="sshInriaCluster"> <sshProcess class="org.objectweb.proactive.core.process.ssh.SSHProcess" hostname="sea.inria.fr"> <processReference refid="bsubInriaCluster"/> </sshProcess> </processDefinition> <processDefinition id="globusProcess"> <globusProcess class="org.objectweb.proactive.core.process.globus.GlobusProcess" hostname="cluster.inria.fr"> <processReference refid="jvmProcess1"/> <environment> <variable name="DISPLAY" value="machine_name0.0"/> </environment> <globusOption> <count>10</count> </globusOption> </globusProcess> </processDefinition> </processes> </infrastructure> </ProActiveDescriptor>
ProActiveDescriptor pad = ProActive.getProActiveDescriptor(String xmlFileLocation);
pad.activateMappings();
--------------------------------------------
--------------------------------------------
--------------------------------------------
pad.killall(false);