|
Overview
The LHC Logging Service provided by the AB-CO-DM section
and supported mainly by Chris
Roderick, is composed of
several components. This
presentation by Chris
Roderick gives an overview of the Service.
The clients expect that the data they
send get stored. Since mid-2003 and up to 03.08.2004, the data
was
stored
on the Oracle
Database DEVDB9, the only centrally available and supported Oracle9i
instance in 2003.
Since mid 2004 we are using the dedicated
database cluster LHCLOGDB (~9 Tbyte of disk space). This forms
part of the
Production Software Environment. Many clients
are operational: SPS, SPS EA, PS, LEIR, LHC HWC (QPS, Cryo, PIC,
Power, BLM, RADMON, RF, etc.),
LHC Experiements, etc.
The LHC Logging Service is based on a 3-tier
architecture; several machines are used to host the Oracle Application
Servers (middle) tier.
In the AS, dedicated OC4J containers are
deployed, in which Java Servlets run. It is
anticipated that the AS instances will
work in a Real Application Cluster setup, whereby the load
is taken over transparently if one machine is down. This is not
yet the case.
Our clients implement an
XML schema or use the Measurement
Database Service to
submit their logging data to the
service
(as
well as the
meta
data). This data loading chain is fully operational and in production,
the Data Loading application on CS-CCR-OAS1 takes care
of the XML parsing and loading process.
For Data Extraction, the TIMBER interface
allows users to get to selected logged variables, show their
data graphically,and
extract in
file format.
For our new clients, we have put in place an
identical Test Software Environment in order
to allow them to test out the service, and to allow us to validate
the new client (checking errors, meta
data,
data volumes, data rates, naming, hierarchy).
Similarly, they have an identical TEST
TIMBER interface.
Note that the data resides on the same database server as
the production environment and is backed up. Data can be transferred
upon request when a client
moves
to
the Production Software Environment. Once again, for reasons
of redundancy and symmetry, the Test Software
Environment is deployed on both machines.
|
|
Data Access APIs
In addition to TIMBER,
there are two methods to extract data from the Measurement and/or
Logging Databases - using either a Java API (recommended approach),
or using a PL/SQL API (for non-Java
clients):
Java API
The Java API is accessible
via Common Build (documentation
is here). Before using this API, clients should contact ab-dep-co-dm@cern.ch to register their applications, and ensure that their
intended usage is appropriate and that they are kept informed of
updates. This API , is complemented by a set of domain objects,
whose documentation is here
PL/SQL API
The PL/SQL API is accessed
by making SQL and PL/SQL calls to the relevant database account.
The API allows the creation and maintenance of variable lists, and
queries to extract for either a single variable or a list of variables
the following data representations:
- ALL DATA in the given time range.
- ALL DATA in the given time range, but the LAST AVAILABLE
VALUE (if any) prior to the range if no data is found within the given
time range.
- The LAST AVAILABLE VALUE within the given time range.
- A STATISTICAL SUMMARY (no of records, min/max timestamps, min/max
values) of the data within the given time range.
- A TIME SCALED set of data. Important information about the use
of time scaling is here.
To query data, the client first needs to set the
query parameters (variable or variable list name, time range, and
if required - optional time scaling parameters) - as explained below,
and then make a standard query to the relevant view. There are many
views
exposing
data for
different
data
formats
in different data representations (as listed above).
This
image shows
all of the available views which can be queried.
In order to use this API, clients
should first contact ab-dep-co-dm@cern.ch to
register their applications, and ensure that their intended usage
is appropriate and that they are kept informed of
updates.
Once the formalities are outof the way, clients
need to carry out the following steps:
- Make a PL/SQL call to register their client-id
and application name (without this step, nothing will
work):
DECLARE
l_client_id varchar2(30) := YOUR_CLIENT_ID_HERE;
l_app_name varchar2(30) := 'YOUR_APP_NAME_HERE';
BEGIN data_access.set_client(l_client_id, l_app_name); END;
/
- Set the query parameters. e.g. (for a
single variable)
DECLARE
l_var varchar2(40) := 'RPHH.UA83.RQ4.L8B1:V_MEAS';
l_start varchar2(30) := '2007-11-21 08:00:00';
l_end varchar2(30) := '2007-11-21 09:00:00';
BEGIN
data_access.SET_VARIABLE(l_var);
data_access.SET_TIME_WINDOW(l_start, l_end);
END;
/
- Query the data from the appropriate view e.g. (for numeric data,
for a single variable)
select utc_stamp, value from var_numeric_data_v;
select utc_stamp, value from var_numeric_last_data_v;
select utc_stamp, value from var_numeric_data_or_last_v;
select variable_name, min_utc_stamp, max_utc_stamp, no_of_values,
min_value, max_value from var_stats_data_v;
Below are some examples of creating, modifying, deleting, and using
variable lists:
- Creating a variable list (WARNING!! - lists should
only be used for fixed sets of variables which will be re-used
repeatedly
-
DO NOT continually create and delete lists!):
DECLARE
l_list varchar2(40) := 'POWERCONVERTERS_SECTOR_45';
l_list_descr varchar2(250) := 'Example Powerconverter Variables in
sector 45';
begin
data_access.create_variable_list(l_list, l_list_descr);
end;
/
- Adding some variables to the list:
DECLARE
l_list varchar2(40) := 'POWERCONVERTERS_SECTOR_45';
l_var_name varchar2(40);
begin
l_var_name := 'RPHH.UA83.RQ4.L8B1:V_MEAS';
data_access.add_to_variable_list(l_list, l_var_name);
l_var_name := 'RPHH.UA83.RQ4.L8B1:V_REF';
data_access.add_to_variable_list(l_list, l_var_name);
l_var_name := 'RPHH.UA83.RQ4.L8B1:I_MEAS';
data_access.add_to_variable_list(l_list, l_var_name);
l_var_name := 'RPHH.UA83.RQ4.L8B1:I_REF';
data_access.add_to_variable_list(l_list, l_var_name);
end;
/
- To save your changes, you have to issue a commit. This can take
some time - be patient ;-) :
commit;
- Query ALL variable lists that you own:
select list_name, description from variable_lists_v;
- Set a list to use
DECLARE
l_list varchar2(40) := 'POWERCONVERTERS_SECTOR_45';
BEGIN
data_access.set_variable_list(l_list);
END;
/
- Show variables in the current list (this can take some time -
be patient ;-) :
select variable_name, datatype_name, unit, description from variable_list_variables_v;
- Set
the query parameters for a list:
DECLARE
l_list varchar2(40) := 'POWERCONVERTERS_SECTOR_45';
l_start varchar2(30) := '2007-11-21 08:00:00';
l_end varchar2(30) := '2007-11-21 09:00:00';
BEGIN
data_access.SET_VARIABLE_LIST(l_list);
data_access.SET_TIME_WINDOW(l_start, l_end);
END;
/
- Query the data for all variables in the list using the
appropriate views e.g. (for ALL numeric variables in the list ) :
select variable_name, utc_stamp, value from list_numeric_data_v;
select variable_name, utc_stamp, value from list_numeric_last_data_v;
select variable_name, utc_stamp, value from list_numeric_data_or_last_v;
select variable_name, min_utc_stamp, max_utc_stamp, no_of_values,
min_value, max_value from list_stats_data_v;
-
DELETE ALL variables from an existing list in a single
operation,
whilst leaving the list entry in the database:
DECLARE
l_list varchar2(40) := 'POWERCONVERTERS_SECTOR_45';
BEGIN
data_access.TRUNCATE_VARIABLE_LIST(l_list);
END;
/
-
DELETE a variable list :
DECLARE
l_list varchar2(40) := 'POWERCONVERTERS_SECTOR_45';
BEGIN
data_access.DELETE_VARIABLE_LIST(l_list);
END;
/
Don't forget to COMMIT your changes!
If time scaling is neccesary (check
here), in addition to the normal query parameters, the time
scaling parameters also need to be set e.g.
DECLARE
l_algorithm varchar2(40) := 'AVG';
l_no_intervals number := 10;
l_interval_type varchar2(30) := 'MINUTE';
BEGIN
data_access.SET_TIME_SCALE_PARAMETERS(l_algorithm, l_no_intervals,
l_interval_type);
END;
/
Afterwards, to query the time scaled data, the views
ending in '_ts_data_v' need to be used e.g.
select utc_stamp, value from var_numeric_ts_data_v;
select variable_name, utc_stamp, value from list_numeric_ts_data_v;
The FULL set of PL/SQL Data Access API methods
including default values are defined below:
procedure set_client(
p_client_id in varchar2,
p_client_application in varchar2
);
procedure set_variable_list(
p_list_name in varchar2
);
procedure set_variable(
p_variable_name in varchar2
);
procedure set_time_window(
p_start_stamp in varchar2,
p_end_stamp in varchar2,
p_oldest_stamp in varchar2 default null,
p_stamp_format in varchar2 default 'YYYY-MM-DD HH24:MI:SS'
);
procedure set_time_scale_parameters(
p_algorithm in varchar2,
p_no_of_intervals in number default 1,
p_interval_type in varchar2 default 'HOUR'
);
procedure create_variable_list(
p_list_name in varchar2,
p_list_description in varchar2 default null
);
procedure delete_variable_list(
p_list_name in varchar2
);
procedure add_to_variable_list(
p_list_name in varchar2,
p_variable_name in varchar2
);
procedure delete_from_variable_list(
p_list_name in varchar2,
p_variable_name in varchar2
);
procedure truncate_variable_list(
p_list_name in varchar2
); |