SLAC ESD Software Engineering Group
Stanford Linear Accelerator Center

Integrated Relational Model of Installed Systems

IRMIS @ SLAC

SLAC Detailed
SLAC Computing
Software Home
Software Detailed
topic-homepage, e.g. ESD Standards


IRMIS Overview

"IRMIS is a collaborative effort between several EPICS sites to build a common Relational DataBase schema and a set of tools to populate and search an RDB that contains information about the operational EPICS IOCs installed at that site."  IRMIS (the schema, crawler programs and UI) was developed by Don Dohan and Claude Saunders at APS.  For general information and distributions see the IRMIS home page.


IRMIS at SLAC

IRMIS is used (or will be used) at SLAC to query for PVs and their attributes, and associated resources and PV clients, by a variety of criteria.  Querying can be done using the IRMIS desktop UI program, or by writing sql scripts.   PV lists obtained from IRMIS can be used in the construction of config files for pv clients (alh, car, cw, possibly displays...)

Elements of IRMIS have been adopted and adapted for the controls software group at SLAC:

Other elements of IRMIS include cabling, device and application schemas.  We are not populating these now...but may in the future.

Elements modified or created at SLAC:

top


UI and DATABASE QUERYING

IRMIS DESKTOP

This is a java UI for the IRMIS Oracle database, and can be invoked in 3 ways:


1.  from XP:

for the Production database double click on v:\cd\soft\Projects\IRMIS\IRMIS_APP\irmis.jar

for the Development database double click on v:\cd\soft\Projects\IRMIS\IRMIS_APP_DEV_DB\irmis.jar


2.  from a Solaris or Linux workstation:

run this script (Production database only):

irmisUI

** If you're on XP, please run as shown in #1 above, the v: drive.  Running the solaris or linux version in a teraterm window is slow.

3.  from the lclshome edm display:

click the IRMIS button in the Tools section (Production database only)

So far at SLAC, only the idt::pv and the idt::pvClient document types are populated.

The IRMIS Desktop comes up with the idt::pv document displayed.

To see the pvClient document, select File/New Document/idt::pvClient

Query results can be saved to an ascii file for further processing.

SQL querying

Two views have been created to ease sql querying.  These views combine data from the IOC_BOOT, IOC, REC and REC_TYPE tables, and the FLD and FLD_TYPE tables.  They select currently loaded PVs, where IOC_BOOT.CURRENT_LOAD = 1.


Query scripts for formatted Channel lists for PV Clients (interim)

The plan is to develop a really cool and spiffy way to generate PV Client channel lists for ALH, CW and CAR from the IRMIS db, but for now we have a first pass at a really simple-minded script version. It uses our new irmis_ro account.

The script is:
~jrock/work_lcls_irmis/pvClientQueries/getClientList.csh

You have to cd to ~jrock/work_lcls_irmis/pvClientQueries first in order to run it.

The script currently has no error handling or parameter checking.

The script's parameters are:
PV Client (ALH, CAR or CW)
(optional W) - use this if you want to enter a freeform where clause

For example:
getClientList.csh CAR
or
getClientList.csh ALH W

The script will prompt you for output filename, search criteria and desired client flag values.
The script queries the database based on system (e.g. LCLS), ioc (e.g. XL02) and record name. In any of these, the wildcard character % can be used. For example, %BDES will result in all the BDES values for the given system(s)/IOC(s). XL% will result in all the XL IOCs, % will result in all IOCs, etc.

If you specify "W" as the optional second parameter, you will be prompted for a freeform where clause, instead of being prompted for ioc and record name. For example you could enter
ioc like 'XL%' and (rec_nm like %BDES or rec_nm like %IDES)

top


OPERATIONAL DETAILS



Oracle schemas

The IRMIS database schema is installed in 2 SLAC Oracle instances:

The owner username in both instances is irmisdb.  For the password see Judy Rock, Bob Hall or Ken Underwood.

There is a read-only user as well: irmis_ro, password irmisread.

see schema diagram below.

Crawler scripts

The PV crawler is run once for each IOC boot directory structure.  The SLAC PV crawler (runSLACPVCrawler.csh) runs the crawler 3 times to accommodate the various CD IOC directory structures.  The LCLS PV crawler (runLCLSPVCrawler.csh) runs the crawler only once (so far!).   It is separate to enable it to be run on a different schedule if necessary. 


PV crawler operation summary

For the location of the crawler scripts, see Source code directories below.

The SLAC scripts that run the crawlers (including the LCLS crawler script) live in the CD software distribution path.  The IRMIS crawler perl programs themselves are run by the scripts , which are not gmake-d nor distributed.

runSLACPVCrawler.csh and runLCLSPVCrawlerLx.csh set up for and run the IRMIS pv crawler multiple times to hit all the boot structures and crawl groups.  Environment variables set in the crawl scripts, and in pvCrawlerSetup.csh, point the crawler to IOC boot directories, log directories, etc.   Throughout operation, errors and warnings are written to the log file.

  1. First, source pvCrawlerSetup.csh/pvCrawlerSetupLx.csh to set up crawler env vars.
  2. Do any necessary setup specific to the crawl group (e.g., copy TR01 files, rdist LCLS files, etc.)
  3. Set the Oracle IOC table ACTIVE column to 1 for the set of IOCs to be crawled.  This is done in the set*IOCsActive.csh script for the current crawl operation, based on the IOC's System (crawl group).  e.g., set all LCLS IOCs ACTIVE to 1.
  4. Next, run /afs/slac/package/epics/vers2/tools/irmisV2_SLAC/db/src/crawlers/pv/pv_crawler.pl:
    1. Call /afs/slac/package/epics/vers2/tools/irmisV2_SLAC/db/src/crawlers/pv/SLACBootScan.pm to get list of IOCs to be crawled (Active = 1).
    2. For each IOC in the list, check its boot date.  (Most PEPII IOCs have a TIMEOFBOOT PV- this is checked to determine actual boot date, which is compared to the last boot date crawled by IRMIS. LCLS IOCs for the most part have a STARTTOD PV).  If the boot date has changed, or if there is no boot date found, or if sequence crawling is not disabled, crawl the IOC, otherwise skip this IOC.
    3. Read through the IOC's startup file, and parse each command.
    4. dbd, db and template files are parsed IF their modification date or size has changed.  PVs from the parsed files are stored in the Oracle database. 
    5. Sequence .o are also parsed.  Sequence parsing is NOT done for soft IOCs, nor for LCLS IOCs, because the .o file is not available.
  5. Reset IOC.ACTIVE columns are all reset to their normal state.
  6. Send Error and Warning e-mails.

** For PV Crawlers: the crawler group for any given IOC is determined by its row in the Oracle IOC table.  The system column refers to the boot group for the IOC, as shown below.

** The PV client crawlers load all client directories in their config files; currently includes both CD and LCLS. 

Log filenames are created by appending a timestamp to the root name shown in the tables below.

script name
descr

runSLACPVCrawler.csh

in CD soft escalation directory structure

THIS SCRIPT IS STILL RUNNING, BUT VERY LIMITED. IT WILL BE PHASED OUT SOON.

 

crawls PEPII, NLCTA, CD IOCs

The PV crawler is run 4 times within this script to accommodate the various boot directory structures:

system IOCs crawled log files
PEPII, NLCTA, SOFT

 

IOCs booted from $CD_IOC on gtw00.   Boot dirs mirrored to /nfs/mccfs0/u1/pepii/mirror/cd/ioc for crawling

/nfs/slac/g/cd/log/irmis/pv/pv_crawlerLOG_ALL.*
SOFT-AFS IOCs booted from $CD_IOC on afs. /nfs/slac/g/cd/log/irmis/pv/pv_crawlerLOG_AFS.*
MICRO-IOC MICRO IOCs /nfs/slac/g/cd/log/irmis/pv/pv_crawlerLOG_AFS.*
TR01 TR01 only (old boot structure) /nfs/slac/g/cd/log/irmis/pv/pv_crawlerLOG_TR01.*

runLCLSPVCrawlerLx.bash

in /usr/local/lcls/lcls/tools/irmis/script/

 

crawls LCLS IOCs

system IOCs crawled log files

LCLS

LCLS PRODUCTION IOCs.  all IOC dirs in $IOC /usr/local/lcls/epics/iocCommon
/u1/lcls/tools/crawler/pv/pv_crawlerLOG_LCLS.timestamp
runClientCrawlers.csh

Runs PV client crawlers in sequence. LCLS client config files are all scp-ed to /nfs/slac/g/cd/crawler/lcls*Configs for crawling

Client crawler config file with list of directories/files crawled log files

ALH

$CD_CONF/SLACALHDirs
/nfs/slac/g/cd/log/irmis/alh/alh_crawlerLOG.*
Channel Watcher (CW) $CD_CONF/SLACCWdirs.lst /nfs/slac/g/cd/log/irmis/cw/cw_crawlerLOG.*
Channel Archiver (CAR)

$CD_CONF/SLACCARfiles.lst

note: all CAR files for LCLS are scp-ed over from lcls-archsrv to /nfs/slac/g/cd/crawler/lclsCARConfigs for crawling

/nfs/slac/g/cd/log/irmis/car/car_crawlerLOG.*

Also runs load_vuri_rec_client_type.pl for clients that don't handle vuri_rec_client_type records (sequence crawler only, at the moment)

runRecClientCleanup.csh deletes all non-current rec client rows.  Logs to /nfs/slac/g/cd/log/irmis/client_cleanupLOG.*

run_find_devices.bash

in /usr/local/lcls/tools/irmis/script/

for LCLS only, populate the devices_and_attributes table, a list of device names and attributes based on the LCLS PV naming convention.  For PV DEV:AREA:UNIT:ATTRIBUTE, DEV:AREA:UNIT is the device, ATTRIBUTE is the attribute.

run_load_bsa_root_names.bash

in /usr/local/lcls/tools/irmis/script/

loads bsa_root_names table by running stored procedure LOAD_BSA_ROOT_NAMES

ioc_report.bash

in /usr/local/lcls/tools/irmis/script/

run at the end of the LCLS PV crawl, which is last, creates the web ioc report : http://www.slac.stanford.edu/grp/cd/soft/database/reports/ioc_report.html

updateMaterializedViews.bash

in /usr/local/lcls/tools/irmis/script/

refresh materialized view from curr_pvs

findDupePVs.bash

in /usr/local/lcls/tools/irmis/script/

find duplicate PVs for reporting to e-mail

copyClientConfigs.bash

in /usr/local/lcls/tools/irmis/script/

copy alh, cw and car config files to /nfs for crawling by the client crawler job

pvForMike.bash

in /usr/local/lcls/tools/irmis/script/

a test caget which is e-mailed to Mike Z. Unrelated to IRMIS, but a convenient place to run!


top

Crawler cron schedule and error reporting

Crawlers are launched by trscrontab on slcs2, user cddev.  All run on slcs2, except runLCLSPVCrawlerLx.bash, which runs on lcls-daemon2.

time
script
12:30 am runSLACPVCrawler.csh
2:00 am runLCLSPVCrawlerLx.csh
3:00 am runClientCrawlers.csh
3:30 am runRecClientCleanup.csh

Following the crawls, the calling scripts grep for errors and warnings, and send lists of these to Judy Rock, Bob Hall and Ernest Williams and Jingchen Zhou.  To track down the error messages in the e-mail, refer to the log file du jour.

(for soft IOCs, sequences are not crawled because they are not available as .o files)

(this happens when the boot date is 0 - for those IOCs without a TIMEOFBOOT PV - this is OK)

(we don't need this for crawling)



top


Source directories

description
cvs root
production directory tree root
details
IRMIS software /afs/slac/package/epics/slaconly/cvs

The IRMIS code has diverged from the main SLAC code. It's in the LCLS repository under tools/irmis/crawler_code_CVS.
Please note that the production directory for the LCLS crawlers is /usr/local/lcls/package/irmis/irmisV2_SLAC/. the "package" dir structure is NOT in CVSed. So, to modify crawler code, you can cvs co the code, modify, test, copy the mods straight into production, then CVS them.

/afs/slac/package/epics/tools/irmisV2_SLAC
/usr/local/lcls/package/irmis/irmisV2_SLAC
  • db/src/crawlers contains crawler source code.  SLAC-specific crawlers are in directories named *SLAC
  • apps/src contains UI source code.
  • apps/build.xml is the ant build file
  • README shows how to build the UI app using ant
SLAC scripts /afs/slac/g/cd/soft/cvs $CD_REF/ext/irmis
  • PVCrawler contains the CD pv crawler run scripts
  • ALHCrawler contains alh crawler run scripts
  • CARCrawler contains car crawler run scripts
  • CWCrawler contains cw crawler run scripts
  • client_cleanup contains client cleanup scripts
  • utils contains load_vuri_rec_client_type.pl. runClientCrawlers.csh, ioc_report.pl
LCLS scripts /afs/slac/g/lcls/cvs /usr/local/lcls/tools/irmis
  • script contains the LCLS pv crawler run scripts, etc.

In the SLAC scripts area, each crawler has certain files and directories:

The LCLS script area contains all LCLS-specific scripts, config files, etc.

In the IRMIS software area, each crawler has its own source code directory.  The SLAC/LCLS crawler run scripts cd into these directories to run the crawlers, where db.properties can be found.  The database instance is set here, along with other properties.

The UI is run from a button on lclshome which invokes the irmisUI script. The jar file is here: /usr/local/lcls/package/irmis/irmisV2_SLAC/apps/deploy/irmis.jar

/afs/slac/package/epics/tools/irmisV2_SLAC/README has info on the applications and also instructions for building the IRMIS UI.  (although work on the UI is much better done in Eclipse!!)


top


IOC Boot directories

IOC boot directories are:

crawl group
IOC boot directories
Copy for crawling
PEPII, NLCTA, SOFT GTW00 $CD_IOC /nfs/mccfs0/u1/pepii/mirror/cd/ioc
SOFT-AFS afs  $CD_IOC  
MICRO-IOC afs $CD_IOC  
LCLS /usr/local/lcls/epics/iocCommon
TR01 GTW00 $CD_IOC /nfs/slac/g/cd/crawler/ioc_boot_temp/cd/ioc/rfs00nta01


top


PV Crawler: What gets crawled

The IOC table in the IRMIS schema contains a list of IOCs.  The system column designates which crawl grouping the IOC belongs to.  For LCLS IOCs, the group is "LCLS", not surprisingly!

An IOC will be hit by the pv crawler if its ACTIVE column is 1 in the IOC table. 

An IOC will not be crawled unless its STARTTOD (boot time) has changed since the last crawl.

Specific files will not be crawled unless their mod date or size has changed.  Crawling specific files can be triggered by changing the date (e.g. touch).

IOCs without a STARTTOD PV will be crawled every time.

post-crawl emails: what to look for

where IRMIS PVs go

IRMIS PVs create a daily current LCLS PV list, a view called curr_pvs. curr_pvs supplies lcls pv names to one of the AIDA names load jobs (LCLS EPICS names). The current PV and IOC lists are also queried by the IRMIS gui, and by web interfaces, and joined with data in lcls_infrastructure by Elie and co. for Greg and co.

Qualifying IRMIS PVs populate the bsa_root_names table, which is joined in with Elie's complex views to device data in lcls_infrastructure. For details on the bsa_root_names load, please have a look at the code for the stored procedure which loads it (see one of the tables above)

Crawling a new directory structure


top



SCHEMA DIAGRAM

/afs/slac/package/epics/tools/irmisV2_SLAC/db/ddl/irmis-pv-schema.png

 

Added table:  the ioc_alias table contains aliases for LCLS IOCs.  For example, ioc-sys0-al00 alias is AL00.


top


Programmers' Guides, Users' Guides, Requirements, Design, Papers, Administration, How-To, Hardware, IOC, Database

[SLAC ESD Software Engineering Group][ SLAC Home Page]

Author: Judy Rock 27-Nov-2006
Modified by: 17-May-2007, jrock, modified to point to new LCLS crawler run script location for Linux. Note, all modifications are listed on same line!