Transcript AIDA - ESRF

Stanford Linear Accelerator Center
Ron MacKenzie, George McIntyre* Judy Rock, Robert Sass,
James Silva, Greg White
8th October 2002
*Independent consultant
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA
Accelerator Integrated Data Access
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
The Problem
The Problem
… allow access to over 3 million individual data attributes
distributed throughout thousands of control systems from any client
application
… make this access mind numbingly simple
… make it lightning fast
… allow complex queries that manipulate, constrain and relate of
any of these attributes
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
How do you use CORBA to …
The Problem
AIDA Priorities
Important not to impose our framework on the application
Speed
1-4ms/simple type round trip including network
Simplicity
Three methods for most functions
Focused around Data access
Get
Set
Monitor
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Integrated
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
The Chosen Architecture
AIDA
Network
Client
AIDA (Da API)
AIDA DA
Service
AIDA
Directory
Service
Server
AIDA Data Provider
Devices
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA Architecture
The Chosen Architecture
AIDA in CORBA
Oracle DB
Client
Application
Da
Server
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Devices
DP Service
Name
Server
Da API
Dp API
AIDA Transport
Dynamic
invocation
AidaObject
IDL Stub
DaServer
IDL Stub
Name
Server
IDL Stub
ORB
Interface
Name
Server
Static
IDL
Skeleton
ORB
DaServer
Static
IDL
Skeleton
AidaObject
Static
IDL
Skeleton
Object
Adapter
Dynamic
invocation
The Chosen Architecture
AIDA Architecture
Location found by URL
All AIDA participants Bootstrap by finding the Directory Service first
Services register with the Directory service when they come on
line as authorised handlers of a named set of service requests
for a particular group(s) of clients
The Directory service can now respond correctly to all clients in
the relevant group (including DA) with this service’s interface
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Directory Service is the key
The Chosen Architecture
AIDA Architecture
Can ask the DA to parse and compile queries as well as
reconstitution of results
Clients can call the Service directly
Clients can parse and compile a target reference so that
It is validated for correctness and its structure is determined
All service references are resolved so that data access can be ultra
rapid
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Clients can call a service via the DA
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
Directory Service
Directory Service Schema
Can map to one or more service chain
Transformation syntax
Based on regex and
Takes chains of sed like arguments
Different transforms for each servers may be specified
Data Provider is called in series "chained" -
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Name//attribute
Directory Service
Directory Service Schema
Eg Attribute //VAL.HIST or //MODEL.TWISS.X.BETA
//VAL references the EPICS data provider.
//VAL.HIST references the Archiver data provider
//MODEL.* gets all model parameters from MODEL data provider
Visibility of Data Providers and AIDA Servers based on Group
Production
Development
New servers
Meta Data
Optional type and length
If not supplied they need to be discovered by the data provider (e.g. history
must discover length), but for instance the slc database data provider must
be given the length in order to make an acquisition.
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Maps flat name spaces (eg EPICS) to single hierarchical name space.
Directory Service
We make each property accessible as part of a hierarchical
namespace
Instantaneous Value
HB60.DCCT.SUMY//VAL
Devices
HB60.DCCT.SUMY//VAL.HIST
DB
Historical Data
AIDA HEIRACHICAL NAMESPACE
FLAT NAMESPACES
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Map Flat namespace to heirachical
Directory Service
Query Execution Chains
Client
DA
1
AIDA Data Provider
AIDA (Da API)
Devices
1 Simple transform of query for
immediate target DP
DS
2
DP
2. Query is translated into a new query for
the intermediate service provider
3
3
3. The query is sent from this service provider
along the chain(s) to the eventual DPs who each
have their own specific message
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Server
Directory Service
AIDA Client
AIDA Name Service
Dp Server implementation
INSTANCE//ATTRIBUTE
SERVICE(INSTANCE//ATTRIBUTE)
INSTANCE//ATTRIBUTE
AIDA Client
AIDA Name Service
INSTANCE//ATTRIBUTE
SERVICE(INSTANCE//ATTRIBUTE)
Complex
structure or
array
Dp Server implementation
INSTANCE//ATTRIBUTE1
INSTANCE//ATTRIBUTE2
AIDA Client
INSTANCE//ATTRIBUTE
Complex
structure or
array
AIDA Name Service
One or more
Services
Dp Server implementation1
SERVICE1(INSTANCE//ATTRIBUTE1)
INSTANCE//ATTRIBUTE1
SERVICE2(INSTANCE//ATTRIBUTE2)
Dp Server implementation2
INSTANCE//ATTRIBUTE2
Arrows show mapping
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Collections
Directory Service
Complex
structure or
array
One or more
Services
Dp Server implementation1
AIDA Client
AIDA Name Service
INSTANCE//ATTRIBUTE1
SERVICE1(INSTANCE//ATTRIBUTE1)
INSTANCE//ATTRIBUTE1
INSTANCE//ATTRIBUTE2
SERVICE2(INSTANCE//ATTRIBUTE2)
Dp Server implementation2
INSTANCE//ATTRIBUTE2
Arrows show mapping
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Collections
Directory Service
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
API
AIDA Da API
Various constructors
Various get/set methods
setParam
DaReference
Various constructors
Various get/set methods
setParam
compile
• Note: automatic therefore unnecessary if constructed with a DaObject
setTarget
• Note: Normally set with constructor
getType/Count
setType/Count
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
DaObject
API
AIDA Common API
DaValue
• Various methods to set, extract and convert data
_DaObject,_DaObjectBase
• Never used directly by clients this provides the transport for client
DaObjects
For Servers
DaValue
• Various methods to set, extract and convert data
_PersistentDaObject, _PersistentDaObjectBase
• AIDA Transport used in Servers
Various helper classes for extra help parsing and using AQS for
use in Servers
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
For Clients
API
Mapping Types - simple
AIDA Client
AIDA Da API
Object get(query, type)
byte get_byte(query)
byte
byte get_byte(query)
long get_long(query)
long
long get_long(query)
double get_double(query)
double
boolean get_boolean(query)
boolean
Byte Long Double Boolean
Dp Server implementation
double get_double(query)
boolean get_boolean(query)
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
CORBA
API
Mapping Types - arrays
AIDA Client
AIDA Da API
Object [] geta(query, type)
byte get_bytea(query)
sequence of byte
byte get_bytea(query)
long get_longa(query)
sequence of long
long get_longa(query)
double get_doublea(query)
sequence of double
boolean get_booleana(query)
sequence of boolean
Byte[] Long[] Double[] String[]
Dp Server implementation
double get_doublea(query)
boolean get_booleana(query)
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
CORBA
API
Mapping Types - Any
AIDA Da API
Any getAny(query)
Any get_any(query)
Any
CORBA
Any
Dp Server implementation
Any get_any(query)
Any
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA Client
API
Mapping Types - DaValue
AIDA Da API
DaValue getDaValue(query)
DaValue getDaValue(query)
Call local methods in
DaValue to extract structured data
CORBA
Any
Dp Server implementation
Any get_any(query)
Any
(DaValue.toAny())
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA Client
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
AQS
query
simple_query
target_string
attribute
range_specification
string_range
numerical_range
bound
user_defined_structure
complex_query
::= <simple_query> | <user_defined_structure>
::= <target_string> [ <aida_symbol_spec> ]
::= <string> // [ <attribute> ]
::= <string> { . <string> } [ range_specification ]
::= [ <string_range> |
<numerical_range> |
<bound> ] { <range_specification> }
::= <string> { , <string> }
::= <bound> [ - [ <bound> ] ] | - [ <bound> ]
::= 0 | <positive_integer> | <aida_symbol>
::= <complex_query> { , <complex_query> }
::= [ <string> = ] { <query> }
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA Query Syntax
AQS
aida_symbol_spec
aida_symbol
::= <aida_symbol> |
( <aida_symbol> + <string> ) |
( <string> + <aida_symbol> ) |
( <aida_symbol> - <string> ) |
( <string> - <aida_symbol> )
::= # <aida_keyword>
aida_keyword
::= LENGTH | TYPE | NAME
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA Query Syntax (Symbols)
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
Examples
DaObject da = new DaObject();
Double v = (Double)da.get("TEST://VAL1", DaValue.Type.DOUBLE);
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
AIDA coding – Simplest example
Examples
AIDA coding – Reference example
DaObject da = new DaObject();
DaReference r = new DaReference("TEST://VAL2", da);
r.setType(DaValue.Type.FLOAT);
for (int i=0; i< 1000 ; i++)
v = (Float)da.get(r);
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Float v;
Examples
AIDA coding – Parameter & DaValue example
da.setParam("STARTTIME", "2001-09-06 12:04");
da.setParam("ENDTIME", "2001-09-06 12:10");
DaValue v = da.getDaValue("TEST://VAL3");
// if v contains an array of Doubles
If ( !v.IsEmpty() )
{
Double [] ad = new Double [v.size()];
v.copyInto(ad);
…
}
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
DaObject da = new DaObject();
Examples
AIDA coding – Complex Query Example
String target = “current={TEST://VAL},last4={TEST://VAL.HIST[(#LENGTH-4)-]}";
DaValue v = da.getDaValue(target);
System.out.println( "\t=" + v.toString() );
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
DaObject da = new DaObject();
Contents
The Chosen Architecture
The directory service
AIDA API
AIDA Query Specification (AQS)
Examples
Future
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
The Problem
Future
Future
Add
Asynchronous support
Global notion of time and timestamps
Method invocation
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
After finishing current development effort
Thank You
Stanford Linear Accelerator Center
Ron MacKenzie, George McIntyre* Judy Rock, Robert Sass,
James Silva, Greg White
10th October 2002
*Independent consultant
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
http://www.slac.stanford.edu/grp/cd/soft/aida
Performance for transmission of an Any
ValueType
Wrapping union
Orbacus Optimization OFF
ValueType
Wrapping union
Orbacus Optimization ON
CORBA Any
Different Host (slcsun1-slcs1)
Copyright © Stanford Linear Accelerator Center
2002 All rights reserved
Same Host (slcs1)