Chapter 4
Service Developer’s Workshop
Welcome to the hands-on section of this guide. This section is for those users who would like to develop future ClaRA application building blocks, i.e. services. We will walk you through the steps you need to do to handle a particular scenario or use case. Examples provided in this chapter are in Java, yet syntactically C++ is not much different.
To compile, deploy and run provided examples you need a copy of the Java platform: JDK6 (Standard Development Kit, edition 6.0) or JDK7 (edition 7.0). Usually you will have java already installed, if not you can download the JDK software package from
http://www.oracle.com/technetwork/java/javase/downloads/index.htm
One other software package that is necessary for checking out ClaRA from the Clas12 software repository is the Subversion version control system (SVN). If you do not already have SVN installed, install it from
http://www.collab.net/downloads/subversion#tab-3
If you would like to offer suggestions for this section contact us at gurjyan@jlab.org.
How to install ClaRA?
First make sure the CLARA environmental variable is set and that it points to an existing directory.
mkdir -p $HOME/clara/services
export CLARA_SEVICES=$HOME/clara/services
or in tcsh:
setenv CLARA_SERVICES $HOME/clara/services
The environment variables should be set in your .bashrc or .cshrc file.
JToolBox
Next you need to checkout the JToolBox project and build it.
svn co https://clas12svn.jlab.org/repos/clas12/JToolBox/trunk $HOME/clara/JToolBox
cd $HOME/clara/JToolBox
ant
Clara Platform
To install Clara you need to check out the latest release from the clas12 software svn repository.
svn co https://clas12svn.jlab.org/repos/clas12/Clara/tags/2.1.3 $HOME/clara/Clara-2.1.3
The next step is to change directories to a newly checked out Clara distribution directory and type install. However, it is important to make sure that the CLARA environmental variable is set and is pointing to a local directory where the future service engine binary files as well CLAS12 software common java libraries will be installed.
cd $HOME/clara/Clara-2.1.3
ant
What if I also need the source code?
The stable version of the project can be checked out from the ClaRA svn repository trunk directory, and an ant command will compile and install ClaRA locally.
svn co https://clas12svn.jlab.org/repos/clas12/Clara/trunk Clara
cd Clara
ant
Note, that the package requires Sun's Java Runtime Environment (JRE) release 1.6.x (or later), as well as Ant 1.8.x to compile.
How do I start a platform? Environment Setup
Assuming you have the Clara platform checked out into $HOME/clara/Clara-2.1.3 you will need to update the PATH environmental variable and have $HOME/clara/Clara-2.1.3/bin added to the shell's executable search path.
export PATH=$PATH=$HOME/clara/Clara-2.1.3/bin
or in tcsh:
setenv PATH ${PATH${HOME}/clara/Clara-2.1.3/bin
Again, these environment variables should be included in your .bashrc or .cshrc file.
Clara data processing environments will be assigned names based on the ClaRA naming convention. A ClaRA platform (i.e. the master DPE) will have a name composed from an IP address of the hosting node + “_platform” (e.g. 129.57.29.62_platform). Regular DPEs will get name = IP_address+”_admin” (e.g. 129.57.29.62_admin).
Running the Platform
The set of Unix shell scripts and Windows executable files are provided in the bin directory of the distribution that will help to start and operate the ClaRA framework environment. You can start the platform with following command:
>clara-platform
Below is the console of a ClaRA platform that was started locally.
>> **** cMsg server sucessfully started at Wed Sep 05 14:57:08 EDT 2012 **** <<
**************************************************
* Clara-2 Platform *
**************************************************
- Name = 129.57.70.17_platform
- Host = 129.57.70.17
- TCP port = 45000
- UDP port = 45000
- Start time = 2012/09/05 14:57:08
**************************************************
**************************************************
* Clara-2 Data Processing Environment *
**************************************************
- Name = 129.57.70.17_admin
- Host = 129.57.70.17
- Start time = 2012/09/05 14:57:08
-
- Platform host = 129.57.70.17
- Platform name = 129.57.70.17_platform
- Platform TCP port = 45000
- Platform UDP port = 45000
**************************************************
129.57.70.17_admin registered with the platform at 2012/09/05 14:57:08
How to start an additional data processing environment?
A platform starts the master DPE (platform) that hosts the ClaRA normative services. These are services that are responsible for user service registration and discovery as well as overall service runtime management and administration. By design only one DPE is allowed to be running on a single computing node. Thus, additional DPEs must be started on a node that is different than the platform node. To start an additional DPE on a host one can use the provided Unix shell script from the bin directory of the ClaRA distribution. The –host option of the script will define the host of the master DPE (platform). Below is shown a console of the DPE that is started using the Unix shell script from the bin directory of the distribution.
>bin/clara-dpe –host ankaa.jlab.org
>> **** cMsg server sucessfully started at Wed Jul 27 15:41:55 EDT 2012 **** <<
**************************************************
* CLARA-2 Data Processing Environment *
**************************************************
- Name = 129.57.29.104_admin
- Host = 129.57.29.104
- Start time = 2012/07/25 22:41:55
-
- Platform host = 129.57.29.62
- Platform name = 129.57.29.62_platform
- Platform TCP port = 45000
- Platform UDP port = 45000
**************************************************
129.57.29.104_admin registered with the platform at 2012/07/27 15:41:55
Share with your friends: |