Skip to content
Snippets Groups Projects
Commit 59a94032 authored by Jonas's avatar Jonas
Browse files

Working test partition

parent 0a4f00ae
No related branches found
No related tags found
1 merge request!29Resolve "Initial Publish uptime of CS instance to IS"
Pipeline #812816 failed
...@@ -86,4 +86,4 @@ class InfoServiceThread(threading.Thread): ...@@ -86,4 +86,4 @@ class InfoServiceThread(threading.Thread):
self.logger.debug("Update sent: %s", str(is_data)) self.logger.debug("Update sent: %s", str(is_data))
except Exception as ex: except Exception as ex:
self.logger.warning("Error occured in send_update(). Error was: %s", str(ex)) self.logger.error("Error occured in send_update(). Error was: %s", str(ex))
...@@ -78,9 +78,14 @@ ...@@ -78,9 +78,14 @@
<oks-schema> <oks-schema>
<info name="" type="" num-of-items="1" oks-format="schema" oks-version="oks-07-00-02 built &quot;Apr 16 2019&quot;" created-by="jholm" created-on="pc-tbed-pub-32.cern.ch" creation-time="20190415T141919" last-modified-by="jholm" last-modified-on="pc-tbed-pub-27.cern.ch" last-modification-time="20190416T091405"/> <info name="" type="" num-of-items="2" oks-format="schema" oks-version="oks-07-00-02 built &quot;Apr 16 2019&quot;" created-by="jholm" created-on="pc-tbed-pub-32.cern.ch" creation-time="20190415T141919" last-modified-by="jholm" last-modified-on="pc-tbed-pub-27.cern.ch" last-modification-time="20190416T091405"/>
<include>
<file path="is/is.xml"/>
</include>
<class name="CastorScriptState" description="CastorScript instance state variables"> <class name="CastorScriptState" description="CastorScript instance state variables">
<superclass name="Info"/>
<attribute name="uptime_seconds" description="uptime in seconds, since the CastorScript instance has started." type="double"/> <attribute name="uptime_seconds" description="uptime in seconds, since the CastorScript instance has started." type="double"/>
</class> </class>
......
========
HOW TO MAKE your own partition containing the CastorScriptState OKS schema:
GENERATE partition file:
pm_part_hlt.py
=> OUTPUTS A FILE part_hlt_*.data.xml
COPY part_hlt_*.data.xml TO your afs-home's public folder
COPY CastorScriptState.schema.xml TO your afs-home's public folder.
INSIDE your afs-home's public folder:
oks_merge part_hlt_USERNAME.data.xml
-o new_part_hlt_USERNAME.data.xml
-s new_part_hlt_USERNAME.schema.xml
This merges the dependency references with your partition file.
Now we can:
EDIT FILE: new_part_hlt_USERNAME.data.xml:
find the many lines containing: <data val="share/data/.../*.xml"/>
ADD CastorScriptState schema in an entry like so:
<data val="/afs/cern.ch/user/[YOUR_AFS_HOME]/public/CastorScriptState.schema.xml"/>
THEN run with:
setup_daq -p part_hlt_USERNAME -d new_part_hlt_USERNAME.data.xml
\ No newline at end of file
# Guide to creating OKS Schema's and adding classes to these: =======
# Make a new schema file # HOW TO CREATE OKS Schema's and adding classes to these:
MAKE a new schema file
1. source the release 1. source the release
2. > is_edit_repository.sh (with no params) 2. > is_edit_repository.sh (with no params)
3. "right-click-hold" on the "schema" box 3. "right-click-hold" on the "schema" box
...@@ -10,34 +12,36 @@ ...@@ -10,34 +12,36 @@
(ie. cs.schema.xml) (ie. cs.schema.xml)
4c. press "OK". 4c. press "OK".
# if you just need to EDIT an existing schema file
5. source the release
6. > is_edit_repository.sh cs.schema.xml
# If schema is not set as active: # If schema is not set as active:
7. "right-click-hold" on the "cs.schema.xml" schema entry, 5. "right-click-hold" on the "cs.schema.xml" schema entry,
move mouse cursor down to, "set active", and release. move mouse cursor down to, "set active", and release.
# Add class to schema file # Add class to schema file
8. "right-click-hold" on the "Classes" box, and "select" the "new" option 6. "right-click-hold" on the "Classes" box, and "select" the "new" option
9. "Input name" of the new class 7. "Input name" of the new class
# All classes should inherit from the Info class # All classes should inherit from the Info class
10. Add required Info SuperClass: 8. Add required Info SuperClass:
"right-click-hold" on the "All super classes" box "right-click-hold" on the "All super classes" box
select "add superclass" select "add superclass"
11. select "info" by double clicking 9. select "info" by double clicking
# Adding attributes to a class # Adding attributes to a class
12a. "Right-click-hold" on "All Attributes" Box 10a. "Right-click-hold" on "All Attributes" Box
select "add attribute" select "add attribute"
12b. "pick a name" (remember your code style!) 10b. "pick a name" (remember your code style!)
12c. in new window select "type" (ie string or similar) 10c. in new window select "type" (ie string or similar)
12d. remember to set "description" in the bottom!! 10d. remember to set "description" in the bottom!!
12e. click "OK" to finish the attribute 10e. click "OK" to finish the attribute
# Finishing off the class # Add description and save the class
13. Remember to set the "Description" of the class as well! 11. Remember to set the "Description" of the class as well!
14. When done, click "Close" in the "Oks Class : ..." Window 12. When done, click "Close" in the "Oks Class : ..." Window
15a. In the main window, under "Schema", Right-click-hold on the cs.schema.xml entry, 13a. In the main window, under "Schema", Right-click-hold on the cs.schema.xml entry,
15b. Select Save or similar ("save as" would work just fine as well if you want to save it somewhere else) 13b. Select Save or similar ("save as" would work just fine as well if you want to save it somewhere else)
14. Integrate the new schema into the partition file.
See how to do this in the readme (how to run, 2b )
========
Partition files, used for testing the Information Service (IS) implementation.
========
This includes an OKS Class: CastorScriptState.
Used as to publishing to IS and through it, to Graphana
The IS repository in a partition needs to know about the class,
which in turn only can be done through adding the schema to the used partition.
This takes time, so for development, a need for a test partition has arised.
========
HOW TO RUN:
This repository is named part_hlt_jholm, the data file is cs-part_hlt_jholm.data.xml
Before running:
1. copy this directory to you afs-home public folder (lowercase)
2. IN THE FILE: cs-part_hlt_jholm.data.xml line 7508
a. vim cs-part_hlt_jholm.data.xml +7508
b. change <data val="/afs/.../j/jholm/public/.../CastorScriptState.schema.xml"/>
to the absolute path to where YOUR CastorScriptState.schema.xml file is located
c. save+close
THEN run with:
setup_daq -p part_hlt_jholm -d cs-part_hlt_jholm.data.xml
WHEN running castorscript:
edit partition param in config to, part_hlt_jholm
=======
HOW TO EDIT the OKS Schema
source the release
is_edit_repository.sh cs.schema.xml
======
DEBUGGING the OKS Schema and classes.
# MAKE SURE THAT THE CLASS IN THE SCHEMA INHERITS FROM the "Info" class.
# Check the schema for the following xml tags:
<include>
<file path="is/is.xml"/>
</include>
<superclass name="Info"/>
#ifndef CASTORSCRIPTSTATE_H
#define CASTORSCRIPTSTATE_H
#include <is/info.h>
#include <string>
#include <ostream>
// <<BeginUserCode>>
// <<EndUserCode>>
/**
* CastorScript instance state variables
*
* @author generated by the IS tool
* @version 15/04/19
*/
class CastorScriptState : public ISInfo {
public:
/**
* uptime in seconds, since the CastorScript instance has started.
*/
double uptime_seconds;
static const ISType & type() {
static const ISType type_ = CastorScriptState( ).ISInfo::type();
return type_;
}
virtual std::ostream & print( std::ostream & out ) const {
ISInfo::print( out );
out << std::endl;
out << "uptime_seconds: " << uptime_seconds << "\t// uptime in seconds, since the CastorScript instance has started.";
return out;
}
CastorScriptState( )
: ISInfo( "CastorScriptState" )
{
initialize();
}
~CastorScriptState(){
// <<BeginUserCode>>
// <<EndUserCode>>
}
protected:
CastorScriptState( const std::string & type )
: ISInfo( type )
{
initialize();
}
void publishGuts( ISostream & out ){
out << uptime_seconds;
}
void refreshGuts( ISistream & in ){
in >> uptime_seconds;
}
private:
void initialize()
{
// <<BeginUserCode>>
// <<EndUserCode>>
}
// <<BeginUserCode>>
// <<EndUserCode>>
};
// <<BeginUserCode>>
// <<EndUserCode>>
inline std::ostream & operator<<( std::ostream & out, const CastorScriptState & info ) {
info.print( out );
return out;
}
#endif // CASTORSCRIPTSTATE_H
// <<BeginUserCode>>
// <<EndUserCode>>
/**
* CastorScript instance state variables
*
* @author generated by the IS tool
* @version 15/04/19
*/
public class CastorScriptState extends is.Info {
public static final is.Type type = new is.Type( new CastorScriptState( ) );
/**
* uptime in seconds, since the CastorScript instance has started.
*/
public double uptime_seconds;
public CastorScriptState() {
this( "CastorScriptState" );
}
protected CastorScriptState( String type ) {
super( type );
// <<BeginUserCode>>
// <<EndUserCode>>
}
public void publishGuts( is.Ostream out ) {
super.publishGuts( out );
out.put( uptime_seconds );
}
public void refreshGuts( is.Istream in ) {
super.refreshGuts( in );
uptime_seconds = in.getDouble( );
}
// <<BeginUserCode>>
// <<EndUserCode>>
}
// <<BeginUserCode>>
// <<EndUserCode>>
<?xml version="1.0" encoding="ASCII"?>
<!-- oks-schema version 2.0 -->
<!DOCTYPE oks-schema [
<!ELEMENT oks-schema (info, (include)?, (comments)?, (class)+)>
<!ELEMENT info EMPTY>
<!ATTLIST info
name CDATA #REQUIRED
type CDATA #REQUIRED
num-of-items CDATA #REQUIRED
oks-format CDATA #FIXED "schema"
oks-version CDATA #REQUIRED
created-by CDATA #REQUIRED
created-on CDATA #REQUIRED
creation-time CDATA #REQUIRED
last-modified-by CDATA #REQUIRED
last-modified-on CDATA #REQUIRED
last-modification-time CDATA #REQUIRED
>
<!ELEMENT include (file)+>
<!ELEMENT file EMPTY>
<!ATTLIST file
path CDATA #REQUIRED
>
<!ELEMENT comments (comment)+>
<!ELEMENT comment EMPTY>
<!ATTLIST comment
creation-time CDATA #REQUIRED
created-by CDATA #REQUIRED
created-on CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT class (superclass | attribute | relationship | method)*>
<!ATTLIST class
name CDATA #REQUIRED
description CDATA ""
is-abstract (yes|no) "no"
>
<!ELEMENT superclass EMPTY>
<!ATTLIST superclass name CDATA #REQUIRED>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute
name CDATA #REQUIRED
description CDATA ""
type (bool|s8|u8|s16|u16|s32|u32|s64|u64|float|double|date|time|string|uid|enum|class) #REQUIRED
range CDATA ""
format (dec|hex|oct) "dec"
is-multi-value (yes|no) "no"
init-value CDATA ""
is-not-null (yes|no) "no"
>
<!ELEMENT relationship EMPTY>
<!ATTLIST relationship
name CDATA #REQUIRED
description CDATA ""
class-type CDATA #REQUIRED
low-cc (zero|one) #REQUIRED
high-cc (one|many) #REQUIRED
is-composite (yes|no) #REQUIRED
is-exclusive (yes|no) #REQUIRED
is-dependent (yes|no) #REQUIRED
>
<!ELEMENT method (method-implementation*)>
<!ATTLIST method
name CDATA #REQUIRED
description CDATA ""
>
<!ELEMENT method-implementation EMPTY>
<!ATTLIST method-implementation
language CDATA #REQUIRED
prototype CDATA #REQUIRED
body CDATA ""
>
]>
<oks-schema>
<info name="" type="" num-of-items="26" oks-format="schema" oks-version="oks-07-00-01 built &quot;Apr 15 2019&quot;" created-by="kolos" created-on="pcatd88" creation-time="20020408T170614" last-modified-by="jholm" last-modified-on="pc-tbed-pub-32.cern.ch" last-modification-time="20190415T131626"/>
<class name="Boolean" description="Simple generic class containing one attribute of Boolean type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="bool"/>
</class>
<class name="CastorScriptState" description="Describes relevant state variables for the CastorScript Instances">
<superclass name="Info"/>
<attribute name="uptime_seconds" description="Seconds of uptime since launch." type="double" init-value="0.0"/>
</class>
<class name="Double" description="Simple generic class containing one attribute of double precision type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="double"/>
</class>
<class name="Float" description="Simple generic class containing one attribute of floating point type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="float"/>
</class>
<class name="Info" description="Base class for IS information objects" is-abstract="yes">
</class>
<class name="S16" description="Simple generic class containing one attribute of signed 2-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s16"/>
</class>
<class name="S32" description="Simple generic class containing one attribute of signed 4-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s32"/>
</class>
<class name="S64" description="Simple generic class containing one attribute of signed 8-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s64"/>
</class>
<class name="S8" description="Simple generic class containing one attribute of signed 1-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s8"/>
</class>
<class name="String" description="Simple generic class containing one attribute of character string type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="string"/>
</class>
<class name="U16" description="Simple generic class containing one attribute of unsigned 2-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u16"/>
</class>
<class name="U32" description="Simple generic class containing one attribute of unsigned 4-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u32"/>
</class>
<class name="U64" description="Simple generic class containing one attribute of unsigned 8-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u64"/>
</class>
<class name="U8" description="Simple generic class containing one attribute of unsigned 1-byte type">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u8"/>
</class>
<class name="Vector&lt;Boolean&gt;" description="Simple generic class containing vector of Boolean values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="bool" is-multi-value="yes"/>
</class>
<class name="Vector&lt;Double&gt;" description="Simple generic class containing vector of double precision values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="double" is-multi-value="yes"/>
</class>
<class name="Vector&lt;Float&gt;" description="Simple generic class containing vector of floating point values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="float" is-multi-value="yes"/>
</class>
<class name="Vector&lt;S16&gt;" description="Simple generic class containing vector of signed 2-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s16" is-multi-value="yes"/>
</class>
<class name="Vector&lt;S32&gt;" description="Simple generic class containing vector of signed 4-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s32" is-multi-value="yes"/>
</class>
<class name="Vector&lt;S64&gt;" description="Simple generic class containing vector of signed 8-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s64" is-multi-value="yes"/>
</class>
<class name="Vector&lt;S8&gt;" description="Simple generic class containing vector of signed 1-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="s8" is-multi-value="yes"/>
</class>
<class name="Vector&lt;String&gt;" description="Simple generic class containing vector of character string values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="string" is-multi-value="yes"/>
</class>
<class name="Vector&lt;U16&gt;" description="Simple generic class containing vector of unsigned 2-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u16" is-multi-value="yes"/>
</class>
<class name="Vector&lt;U32&gt;" description="Simple generic class containing vector of unsigned 4-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u32" is-multi-value="yes"/>
</class>
<class name="Vector&lt;U64&gt;" description="Simple generic class containing vector of unsigned 8-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u64" is-multi-value="yes"/>
</class>
<class name="Vector&lt;U8&gt;" description="Simple generic class containing vector of unsigned 1-byte values">
<superclass name="Info"/>
<attribute name="value" description="object value" type="u8" is-multi-value="yes"/>
</class>
</oks-schema>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment