[[PageOutline]] = QCG BES/AR Installation = QCG BES/AR service (the successor of the OpenDSP project) is an open source service acting as a computing provider exposing on demand access to computing resources and jobs over the HPC Basic Profile compliant Web Services interface. In addition the QCG BES/AR offers remote interface for Advance Reservations management. IMPORTANT: :: The implementation name of the QCG BES/AR service is '''Smoa Computing''' and this name is used as a common in this guide. = Requirements = Before installing SMOA Computing make sure that following software is installed: == Dependend libraries == 1. libxml2 >= 2.6.27 2. openssl >= 0.9.7 3. unixODBC >= 2.2.0 4. Python >= 2.4 5. [http://activemq.apache.org/cms/ActiveMQ-CPP] >= 3.0.1 (optional - needed only for [http://www.plgrid.pl/en PL-Grid] BAT accounting module) '''Note:''' If you are installing the libraries from binary packages check if those libraries were installed in '''devel''' versions (i.e. with headers files). '''Note:''' For Scientific Linux 5.3 (Boron) you can use the following [http://fury.man.poznan.pl/smoa-packages/sl/x86_64/ rpms] in order to satisfy libxml2 dependency. == Database Backend == For the database backend we recommends the [http://www.postgresql.org/ PostgreSQL], as the SMOA Computing is shipped with SQL script for the database scheme creation for the PostgreSQL. Check if ODBC drivers for the PostgreSQL were installed (i.e. if the `libodbcpsql.so` and `libodbcpsqlS.so` files are available in your system), if not install it independently. == DRMAA and ARES libraries == If you decided to use LSF as the LRMS system you need to install two external libraries: * DRMAA library for LSF (you can get it from [http://node2.qoscosgrid.man.poznan.pl/~qcg/download/lsf_drmaa-1.0.4.tar.gz here]) * ARES (Advance REServation) library for LSF (you can get it from [http://node2.qoscosgrid.man.poznan.pl/~qcg/download/lsf_ares-1.0.tar.gz here]) '''Note:''' Remember were the libraries where installed. You will need this information during [[#Serviceconfiguration|Service configuration]]. If SGE: * DRMAA library is provided with standard SGE installation. * Instead of ARES library a Python module (installed by default with SMOA Computing) is used. Thus to make Advance Reservation capabilities accessible via SMOA Computing you will need Python interpreter (version 2.4 at least) together with the python library for XML processing (''lxml'' or ''elementtree''). If Torque with Maui scheduler: * DRMAA library can be obtained from the [http://sourceforge.net/projects/pbspro-drmaa/ PBS DRMAA sourceforge project]. After installation, as described in the library README file, you need either to: * configure Torque to keep information about completed jobs (e.g.: by setting: qmgr -c 'set server keep_completed = 60'). * configure the DRMAA library to use Torque logs. Sample configuration file of the DRMAA library (/etc/pbs_drmaa.conf): {{{ #!div style="font-size: 90%" {{{#!default # pbs_drmaa.conf - Sample pbs_drmaa configuration file. wait_thread: 1, pbs_home: "/var/spool/pbs", pool_delay: 5, cache_job_state: 1, hello = lambda: "world" }}} }}} * Instead of ARES library a Python module (installed by default with SMOA Computing) is used. Thus to make Advance Reservation capabilities accessible via SMOA Computing you will need Python interpreter (version 2.4 at least) together with the python library for XML processing (''lxml'' or ''elementtree''). = Installation = == SMOA Core library == [http://fury.man.poznan.pl/smoa-downloads/smoa-core/smoa-core-latest.tar.gz SMOA Core] is an utility and interoperability layer for the all SMOA services (SMOA Computing and SMOA Notification in particular). As the GSI (Grid Security Infrastructure) is used to secure the transport layer you must compile the SMOA Core library with GSI support. After successful [[installation_GridFTP|gridFTP installation]] (we recommend to use version 4.2.x of Globus Toolkit) all you need to do is to check if the `GLOBUS_LOCATION` environment variable is set correctly (and the `$GLOBUS_LOCATION/etc/globus-user-env.sh` file sourced). You must also choose globus flavor that you wish to compile with (e.g. `gcc64dbg` for a 64bit machine or `gcc32dbg` if you are installing the SMOA Core on a 32bit machine): {{{ #!div style="font-size: 90%" {{{#!sh . $GLOBUS_LOCATION/etc/globus-user-env.sh tar xzf smoa-core-latest.tar.gz cd smoa-core-2.0.4 ./configure --prefix=/opt/QCG/smoa --with-globus-flavor=gcc64dbg make sudo make install }}} }}} '''Note:''' You may need to pass some additional options to `./configure` script, if some of the dependencies are installed in non-standard locations (type `./configure --help` for more info) == SMOA Computing service == After downloading the [http://fury.man.poznan.pl/smoa-downloads/smoa-comp/smoa-comp-latest.tar.gz source package] the SMOA Computing installation can be done in a few steps, e.g: {{{ #!div style="font-size: 90%" {{{#!sh tar xzf smoa-comp-latest.tar.gz cd smoa-comp-2.2 ./configure --prefix=/opt/QCG/smoa/ --with-smoa-core=/opt/QCG/smoa/ make sudo make install }}} }}} = Configuration = Before you start create a new system user (e.g. `smoa_comp`) that will be used by the service (and only the SMOA Computing service) to run in unprivileged mode: {{{ #!div style="font-size: 90%" {{{#!sh useradd -d /opt/QCG/smoa/var/log/smoa-comp/ -M smoa_comp }}} }}} == Database setup == You need to create a database for SMOA Computing and appropriate tables using the provided `smoa-comp-psql.sql` script. It can be found in `PREFIX/share/smoa-comp/db/`. Currently only PostgreSQL is supported. * Create new database user (e.g. `smoa_comp`) authenticated via password (you will later provide this password in the SMOA Computing configuration file). This user must be allowed to create new databases. {{{ #!div style="font-size: 90%" {{{#!sh su - postgres createuser -P smoa_comp exit }}} }}} * Create new database (e.g. `smoa_comp`) owned by the `smoa_comp` user: {{{ #!div style="font-size: 90%" {{{#!sh su - smoa_comp createdb -U smoa_comp smoa_comp exit }}} }}} * Depending on the local PostgreSQL configuration you may need to edit the `pg_hba.conf` file (''host based authentication'' configuration file) and add the following lines as the two top rules: {{{ #!div style="font-size: 90%" {{{#!default local smoa_comp smoa_comp md5 host smoa_comp smoa_comp 127.0.0.1/32 md5 }}} }}} in order to enable password authentication for the user `smoa_comp`. '''Note:''' You must reload the PostgreSQL server in order to make the changes visible e.g: {{{ #!div style="font-size: 90%" {{{#!sh /etc/init.d/postgresql reload }}} }}} * Create database schema using provided script (`smoa-comp-psql.sql`) : {{{ #!div style="font-size: 90%" {{{#!default psql -f /opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql -U smoa_comp psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:3: ERROR: table "states" does not exist psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:4: ERROR: table "jobs" does not exist psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:5: ERROR: table "jobs_acc" does not exist psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:6: ERROR: table "reservations" does not exist psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:7: ERROR: table "reservations_acc" does not exist psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:12: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "states_pkey" for table "states" CREATE TABLE INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:53: NOTICE: CREATE TABLE will create implicit sequence "jobs_serial_seq" for serial column "jobs.serial" psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:53: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "jobs_pkey" for table "jobs" psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:53: NOTICE: CREATE TABLE / UNIQUE will create implicit index "jobs_drms_id_key" for table "jobs" CREATE TABLE CREATE INDEX CREATE INDEX CREATE INDEX psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:88: NOTICE: CREATE TABLE will create implicit sequence "jobs_acc_serial_seq" for serial column "jobs_acc.serial" psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:88: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "jobs_acc_pkey" for table "jobs_acc" CREATE TABLE CREATE INDEX CREATE INDEX CREATE INDEX psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:109: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "reservations_pkey" for table "reservations" CREATE TABLE CREATE INDEX psql:/opt/QCG/smoa/share/smoa-comp/db/smoa-comp-psql.sql:128: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "reservations_acc_pkey" for table "reservations_acc" CREATE TABLE CREATE INDEX }}} }}} * You need to create ODBC Data Source Name. You can do this by editing system-wide, i.e. `/etc/odbc.ini`, configuration file and adding new section. In this example we assume that the DSN (Database Source Name) will be `smoa_comp`, real database name is also `smoa_comp` and appropriate drivers for PostgreSQL database (i.e. the `libodbcpsql.so` and `libodbcpsqlS.so` files) are located in `/usr/local/lib`: {{{ #!div style="font-size: 90%" {{{#!default [smoa_comp] Description = SMOA Computing database Driver = /usr/local/lib/libodbcpsql.so Setup = /usr/local/lib/libodbcpsqlS.so Database = smoa_comp Servername = localhost Port = 5432 ReadOnly = No }}} }}} '''Note:''' Verify if paths given in the ''Driver'' and ''Setup'' sections are valid. '''Note''' The PostgreSQL odbc driver on many systems is distributed as a separate package (the `postgresql-odbc` or similar). Don't use the PostgreSQL driver shipped with the UnixODBC source tarball, as this one is known to be [[https://bugzilla.redhat.com/show_bug.cgi?id=458708#c7|obsolete]]. * It is recommended to use a command line client to access the database through ODBC to check if everything was configured correctly. For example, unixODBC provides an `isql` client: {{{ #!div style="font-size: 90%" {{{#!sh isql -v smoa_comp smoa_comp +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL>quit }}} }}} '''Note:''' It is recommended to run this command as user different than root (e.g. the smoa_comp user). == Service configuration == You can find the complete reference guide in the SMOA Computing manual (that can be found under the `doc/` directory). For convenience we provided below sample service configuration files (located in `PREFIX/etc/smoa-compd.xml` - do not mislead this file with the client configuration file which is named `smoa-comp.xml`) that you can use as templates: === Template configuration for the SMOA Computing service deployed on the top of LSF system === {{{ #!div style="font-size: 90%" {{{#!xml /opt/QCG/smoa//lib/smoa-core/modules/ /opt/QCG/smoa//lib/smoa-comp/modules/ /opt/QCG/smoa//var/log/smoa-comp/smoa-comp.log INFO frontend.example.com 19000 false /opt/QCG/smoa/certs/smoacert.pem /opt/QCG/smoa/certs/smoakey.pem /etc/grid-security/grid-mapfile http://frontend.example.com:19005/ /opt/QCG/smoa/etc/application_mapfile smoa_comp smoa_comp smoa_comp smoa_comp lsfadmin IT cluster IT department cluster for public use http://example.com/LSF worker.example.com x86_32 4 1073741824 }}} }}} === Template configuration for the SMOA Computing service deployed on the top of Sun Grid Engine === {{{ #!div style="font-size: 90%" {{{#!xml /opt/QCG/smoa/lib/smoa-core/modules/ /opt/QCG/smoa/lib/smoa-comp/modules/ /opt/QCG/smoa/var/log/smoa-comp/smoa-comp.log INFO frontend.example.com 19000 false /opt/QCG/smoa/etc/certs/smoacert.pem /opt/QCG/smoa/etc/certs/smoakey.pem /etc/grid-security/grid-mapfile /opt/QCG/smoa/etc/application_mapfile http://frontend.example.com:19005/ smoa_comp smoa_comp smoa_comp smoa_comp false false sgeadmin IT cluster IT department cluster for public use http://example.com/SunGridEngine worker.example.com x86_32 4 1073741824 }}} }}} === Template configuration for the SMOA Computing service deployed on the top of Torque (using Maui scheduler) === {{{ #!div style="font-size: 90%" {{{#!xml /opt/QCG/smoa/lib/smoa-core/modules/ /opt/QCG/smoa/lib/smoa-comp/modules/ /opt/QCG/smoa/var/log/smoa-comp/smoa-comp.log INFO frontend.example.com 19000 false /opt/QCG/smoa/etc/certs/smoacert.pem /opt/QCG/smoa/etc/certs/smoakey.pem /etc/grid-security/grid-mapfile /opt/QCG/smoa/etc/application_mapfile http://frontend.example.com:19005/ smoa_comp smoa_comp smoa_comp smoa_comp maui frontend.example.com IT department cluster for public use }}} }}} In most cases it should be enough to change only following elements: `Database`:: the contact data for the Database created in the previously steps `Transport/Module/Host`:: the hostname of the machine where the service is deployed `Transport/Module/Authentication/Module/X509CertFile` and `Transport/Module/Authentication/Module/X509KeyFile`:: the service private key and X.509 certificate (consult the [[http://www.globus.org/toolkit/docs/4.0/security/prewsaa/rn01re02.html|Globus User Gide]] on how to generate service certificate request or use the host certificate/key pair). Make sure that the key and certificate is owned by the `smoa_comp` user and the private key is not password protected (generating certificate with the `-service` option implies this). `Module[type="smc:notification_wsn"]/Module/ServiceURL`:: the URL of the [[SMOA_Notification|SMOA Notification Service]] (You can do it later, i.e. after installing the SMOA Notification service) `FactoryAttributes/ContainedResources`:: list of the all worker nodes managed by the LRMS. You should provide at least hostnames (``) and cpus count (``) for every worker node in your cluster. If you are using Torque batch system this information can be provided automatically by enabling `python/monitoring.py` module. `Module[type="submission_drmaa"]/@path`:: path to the DRMAA library (the `libdrmaa.so` - search for this file within the LRMS lib directory. e.g. `/opt/sge/lib/` or `/opt/QCG/LSF/lsf7.0.3/7.0/linux2.6-glibc2.3-x86_64/lib/`) `Module[type="reservation_ares"]/@path`:: path to the ARES library (LSF only) `Module[type="reservation_python"]/@path`:: path to the Python reservation module (SGE only) - only if you installed SMOA Computing in location other than `/opt/QCG/smoa`. `ReservationsAdministrator`:: the user authorized to create and manage reservations. Usually the LRMS administrator user (like `sgeadmin` in SGE or `lsfadmin` in LSF, or any user other than root given in ADMIN* sections of the Maui config file) has sufficient rights. '''Note:''' Later in this manual you will read that the QCG Broker credentials must be mapped to this user (see [[installation_QCG_Broker#ResourceProviderssetup|QCG Broker Resource Providers setup]]). [[Security Note]] Finally make this configuration file readable '''only''' by the `smoa_comp` user (in order to protect database password): {{{ #!div style="font-size: 90%" {{{#!sh chmod 0600 /opt/QCG/smoa/etc/smoa-compd.xml }}} }}} == Configuring BAT accounting module (PL-Grid only) == In order to report resource usage to the central PL-Grid accounting service you must enable the `bat_updater` module. You can do this by including the following snippet in the configuration (just before the `Database` section): {{{ #!div style="font-size: 90%" {{{#!xml tcp://acct.grid.cyf-kr.edu.pl:61616 psnc-smoa-plgrid test-jobs }}} }}} where: BATServiceURL:: URL of the BAT accounting service !SiteName:: local site name as reported to the BAT service !QueueName:: queue name to which report usage data = Note on the security model = The SMOA Computing can be configured with various authentication and authorization modules. However in the typical deployment we assume that the SMOA Computing is configured as in the above example, i.e.: * authentication is provided on basics of ''httpg'' protocol * authorization is based on the local `grid-mapfile` mapfile (see [[GridFTP#Users_configuration| Users configuration]]). = Starting the service = As root type: {{{ #!div style="font-size: 90%" {{{#!sh /opt/QCG/smoa/sbin/smoa-compd }}} }}} or if you want the service not to daemonize and print all logs to console type: {{{ #!div style="font-size: 90%" {{{#!sh /opt/QCG/smoa/sbin/smoa-compd -d }}} }}} otherwise the logs can be found in `/opt/QCG/smoa/var/log/smoa-comp/smoa-comp.log`. '''Note:''' Before starting the `smoa-compd` service make sure that all environment variables needed to contact the LRMS system are set (i.e. the `SGE_ROOT` for SGE or the whole `profile.lsf` file sourced in case of LSF) = Stopping the service = The service is stopped by sending SIGTERM signal, e.g.: {{{ #!div style="font-size: 90%" {{{#!sh pkill smoa-compd }}} }}} = Verifying the installation = * For convenience you can add the `/opt/QCG/smoa/bin` to your `PATH` variable. * Edit the SMOA Computing client configuration file (`PREFIX/etc/smoa-comp.xml`): * set the ''Host'' and ''Port'' to reflects the changes in the service configuration file (`smoa-compd.xml`), * change the authentication module type from `sm:atc_transport_http.client` to `sm:atc_transport_gsi.client`, {{{ #!div style="font-size: 90%" {{{#!xml /opt/QCG/smoa/lib/smoa-core/modules/ /opt/QCG/smoa//lib/smoa-comp/modules/ httpg://frontend.example.com:19000/ }}} }}} * Initialize your credentials: {{{ #!div style="font-size: 90%" {{{#!sh grid-proxy-init Your identity: /O=Grid/OU=QosCosGrid/OU=PSNC/CN=Mariusz Mamonski Enter GRID pass phrase for this identity: Creating proxy .................................................................. Done Your proxy is valid until: Wed Sep 16 05:01:02 2009 }}} }}} * Query the SMOA Computing service: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -G | xmllint --format - # the xmllint is used only to present the result in more pleasant way true IT cluster IT department cluster for public use 0 1 worker.example.com x86_32 41073741824 http://schemas.ggf.org/bes/2006/08/bes/naming/BasicWSAddressing http://schemas.ogf.org/hpcp/2007/01/bp/BasicFilter http://schemas.smoa-project.com/comp/2009/01 http://example.com/SunGridEngine http://localhost:2211/ }}} }}} * Submit a sample job: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -c -J /opt/QCG/smoa/share/smoa-comp/doc/examples/jsdl/sleep.xml Activity Id: ccb6b04a-887b-4027-633f-412375559d73 }}} }}} * Query it status: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -s -a ccb6b04a-887b-4027-633f-412375559d73 status = Executing smoa-comp -s -a ccb6b04a-887b-4027-633f-412375559d73 status = Executing smoa-comp -s -a ccb6b04a-887b-4027-633f-412375559d73 status = Finished exit status = 0 }}} }}} * Create an advance reservation: * copy the provided sample reservation description file (expressed in ARDL - Advance Reservation Description Language) {{{ #!div style="font-size: 90%" {{{#!sh cp /opt/QCG/smoa/share/smoa-comp/doc/examples/ardl/oneslot.xml oneslot.xml }}} }}} * Edit the `oneslot.xml` and modify the ''!StartTime'' and ''!EndTime'' to dates that are in the near future, * Create a new reservation: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -c -D oneslot.xml Reservation Id: aab6b04a-887b-4027-633f-412375559d7d }}} }}} * List all reservations: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -l Reservation Id: aab6b04a-887b-4027-633f-412375559d7d Total number of reservations: 1 }}} }}} * Check which hosts where reserved: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -s -r aab6b04a-887b-4027-633f-412375559d7d Reserved hosts: worker.example.com[used=0,reserved=1,total=4] }}} }}} * In the end delete the reservation: {{{ #!div style="font-size: 90%" {{{#!sh smoa-comp -t -r aab6b04a-887b-4027-633f-412375559d7d Reservation terminated. }}} }}}