plushy

Examples

plushy

A Modelnet Example

This example shows how to run an experiment on a Modelnet cluster. It assumes the user already knows how to set up a Modelnet cluster. More information on Modelnet can be found here. There are two phases in the application's execution. The first phase deploys the Modelnet topology, and the second phase runs the application on the virtual hosts. In this case the application simply prints the virtual hostname of each Plush client.

Not looking for Modelnet? You can find a simple example here.

The following files are needed to run this application. They must be modified slightly (look for machine names and user names) to run on your machines.

  1. modelnet.xml
  2. directory.xml
  3. plush.prefs

Application Description: modelnet.xml

modelnet.xml is a Plush application description file. It defines two Plush components. The first component contains the physical machines, and the second component contains the Modelnet virtual hosts. The first component block defines the process required for deploying the Modelnet topology, and the second component block defines the process that runs hostname on all virtual hosts. Notice the use of "predecessor" to indicate that the first component block should run to completion before starting the second component block.

    <?xml version="1.0" encoding="utf-8"?>
    <plush>
      <project name="SimpleModelnetProj">
        <component name="PhysicalResources">
          <rspec>
            <num_hosts>5</num_hosts>
          </rspec>
          <resources>
            <resource type="ssh" group="modelnet_deploy" />            
            <hostfile>hosts</hostfile>   //Modelnet host file
          </resources>
        </component>
        <component name="VirtualHosts">
          <rspec>
            <num_hosts>40</num_hosts>
          </rspec>
          <resources>
            <resource type="ssh" group="modelnet" />
          </resources>
        </component>

        <experiment name="SimpleModelnetExp">
          <execution>

            <component_block name="PhysCompBlock">
              <component name="PhysicalResources" />
              <process_block name="DeployProcBlock">
                <process name="Deploy">
                  <path>/projects/modelnet/bin/deployhost</path>
                  <cmdline>
                    <arg>example.model</arg>
                    <arg>example.route</arg>
                  </cmdline>
                </process>
              </process_block>
            </component_block>

            <component_block name="VirtCompBlock">
              <component name="VirtualHosts" />
	      <predecessor name="DeployProcBlock" />
              <process_block name="RunProcBlock">
                <process name="Run">
                  <path>hostname</path>
                </process>
              </process_block>
            </component_block>

          </execution>
        </experiment>
      </project>
    </plush>
    

Environment configuration: directory.xml

directory.xml defines the Plush resource directory. Here we will tell Plush which physical machines we are using, as well as the mapping from physical to virtual hosts. This file can be automatically generated using the Modelnet model file and XMLConvert.java in the helper-scripts directory.

    <?xml version="1.0" encoding="UTF-8"?>
    <plush>
       <resource_manager type="ssh">
          <node hostname="sysnet80.ucsd.edu:15400" user="jalbrecht" group="modelnet_deploy" flag="core" />
          <node hostname="sysnet82.ucsd.edu:15400" user="jalbrecht" vip="10.0.0.1" vn="0" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15401" user="jalbrecht" vip="10.0.0.2" vn="4" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15402" user="jalbrecht" vip="10.0.0.3" vn="8" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15403" user="jalbrecht" vip="10.0.0.4" vn="12" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15404" user="jalbrecht" vip="10.0.0.5" vn="16" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15405" user="jalbrecht" vip="10.0.0.6" vn="20" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15406" user="jalbrecht" vip="10.0.0.7" vn="24" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15407" user="jalbrecht" vip="10.0.0.8" vn="28" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15408" user="jalbrecht" vip="10.0.0.9" vn="32" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15409" user="jalbrecht" vip="10.0.0.10" vn="36" group="modelnet" />
          <node hostname="sysnet82.ucsd.edu:15410" user="jalbrecht" group="modelnet_deploy" />
          <node hostname="sysnet85.ucsd.edu:15400" user="jalbrecht" vip="10.0.0.49" vn="3" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15401" user="jalbrecht" vip="10.0.0.50" vn="7" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15402" user="jalbrecht" vip="10.0.0.51" vn="11" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15403" user="jalbrecht" vip="10.0.0.52" vn="15" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15404" user="jalbrecht" vip="10.0.0.53" vn="19" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15405" user="jalbrecht" vip="10.0.0.54" vn="23" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15406" user="jalbrecht" vip="10.0.0.55" vn="27" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15407" user="jalbrecht" vip="10.0.0.56" vn="31" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15408" user="jalbrecht" vip="10.0.0.57" vn="35" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15409" user="jalbrecht" vip="10.0.0.58" vn="39" group="modelnet" />
          <node hostname="sysnet85.ucsd.edu:15410" user="jalbrecht" group="modelnet_deploy" />
          <node hostname="sysnet84.ucsd.edu:15400" user="jalbrecht" vip="10.0.0.33" vn="2" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15401" user="jalbrecht" vip="10.0.0.34" vn="6" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15402" user="jalbrecht" vip="10.0.0.35" vn="10" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15403" user="jalbrecht" vip="10.0.0.36" vn="14" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15404" user="jalbrecht" vip="10.0.0.37" vn="18" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15405" user="jalbrecht" vip="10.0.0.38" vn="22" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15406" user="jalbrecht" vip="10.0.0.39" vn="26" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15407" user="jalbrecht" vip="10.0.0.40" vn="30" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15408" user="jalbrecht" vip="10.0.0.41" vn="34" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15409" user="jalbrecht" vip="10.0.0.42" vn="38" group="modelnet" />
          <node hostname="sysnet84.ucsd.edu:15410" user="jalbrecht" group="modelnet_deploy" />
          <node hostname="sysnet83.ucsd.edu:15400" user="jalbrecht" vip="10.0.0.17" vn="1" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15401" user="jalbrecht" vip="10.0.0.18" vn="5" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15402" user="jalbrecht" vip="10.0.0.19" vn="9" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15403" user="jalbrecht" vip="10.0.0.20" vn="13" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15404" user="jalbrecht" vip="10.0.0.21" vn="17" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15405" user="jalbrecht" vip="10.0.0.22" vn="21" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15406" user="jalbrecht" vip="10.0.0.23" vn="25" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15407" user="jalbrecht" vip="10.0.0.24" vn="29" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15408" user="jalbrecht" vip="10.0.0.25" vn="33" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15409" user="jalbrecht" vip="10.0.0.26" vn="37" group="modelnet" />
          <node hostname="sysnet83.ucsd.edu:15410" user="jalbrecht" group="modelnet_deploy" />
       </resource_manager>
    </plush>
    

Plush preferences: plush.prefs

The plush.prefs file defines basic preferences that customize the way applications are run. In this example we specify the ClientPrefix and ClientPath which control how the client is started ({ClientPrefix}/client) and what working directory the client uses when executing commands (chdir {ClientPath}).

    <preferences>
       <pref key="ClientPrefix">/home/jalbrecht/</pref>
       <pref key="ClientPath">/home/jalbrecht/</pref>
    </preferences>
    

Start Plush

Now we are ready to run our example. The following shows the output from a single run. You only need to type the commands found in red.

    $ ./plush -P 15413
    plush> load modelnet.xml
    SimpleModelnetProj is selected.
    SimpleModelnetExp is selected.
    plush> run
    Starting experiment run.
    Running experiment Deploy...
    The configuration matcher has finished matching.
    The resource allocator has finished successfully.
    jalbrecht@sysnet83.ucsd.edu:15410 has joined the mesh.
    jalbrecht@sysnet84.ucsd.edu:15410 has joined the mesh.
    jalbrecht@sysnet85.ucsd.edu:15410 has joined the mesh.
    jalbrecht@sysnet82.ucsd.edu:15410 has joined the mesh.
    jalbrecht@sysnet80.ucsd.edu:15400 has joined the mesh.
              .
              .
              .
    (lots of deployhost output)
              .
              .
              .
    (The topology has been deployed.  Now run "hostname").
    The configuration matcher has finished matching.
    The resource allocator has finished successfully.
    jalbrecht@sysnet82.ucsd.edu:15401 has joined the mesh.
    jalbrecht@sysnet82.ucsd.edu:15400 has joined the mesh.
    jalbrecht@sysnet82.ucsd.edu:15405 has joined the mesh.
    jalbrecht@sysnet82.ucsd.edu:15403 has joined the mesh.
    jalbrecht@sysnet82.ucsd.edu:15407 has joined the mesh.
    jalbrecht@sysnet83.ucsd.edu:15401 has joined the mesh.
    jalbrecht@sysnet82.ucsd.edu:15408 has joined the mesh.
              .
              .
              .
    (all 40 virtual hosts join the mesh)
              .
              .
              .
    jalbrecht@sysnet82.ucsd.edu:15403,12560: client12
    jalbrecht@sysnet82.ucsd.edu:15401,12562: client4
    jalbrecht@sysnet82.ucsd.edu:15405,12564: client20
    jalbrecht@sysnet83.ucsd.edu:15403,22740: client13
              .
              .
              .
    (all 40 virtual hosts print their virtual hostname)
              .
              .
              .
    The experiment has ended.

    plush> disconnect
    plush> quit