From 59a9403233a5d76c06d99a54b136188bd7966b4c Mon Sep 17 00:00:00 2001 From: Jonas <jonas@holm.tech> Date: Tue, 16 Apr 2019 16:53:50 +0200 Subject: [PATCH] Working test partition --- Script/cs/Threads/InfoServiceThread.py | 2 +- .../CastorScriptState.schema.xml | 7 +- .../cs-part_hlt_jholm.data.xml | 0 .../cs-part_hlt_jholm.schema.xml | 0 TestPartition/guide_custom_partition | 27 +++ TestPartition/guide_oks_schemas | 47 ++++ .../part_hlt_jholm.data.xml | 0 TestPartition/readme | 47 ++++ .../partition_is_tests/CastorScriptState.h | 92 -------- .../partition_is_tests/CastorScriptState.java | 53 ----- copy_me_to_public/partition_is_tests/is.xml | 211 ------------------ is_schema_guide | 43 ---- 12 files changed, 128 insertions(+), 401 deletions(-) rename {copy_me_to_public/partition_is_tests => TestPartition}/CastorScriptState.schema.xml (94%) rename {copy_me_to_public/partition_is_tests => TestPartition}/cs-part_hlt_jholm.data.xml (100%) rename {copy_me_to_public/partition_is_tests => TestPartition}/cs-part_hlt_jholm.schema.xml (100%) create mode 100644 TestPartition/guide_custom_partition create mode 100644 TestPartition/guide_oks_schemas rename {copy_me_to_public/partition_is_tests => TestPartition}/part_hlt_jholm.data.xml (100%) create mode 100644 TestPartition/readme delete mode 100644 copy_me_to_public/partition_is_tests/CastorScriptState.h delete mode 100644 copy_me_to_public/partition_is_tests/CastorScriptState.java delete mode 100644 copy_me_to_public/partition_is_tests/is.xml delete mode 100644 is_schema_guide diff --git a/Script/cs/Threads/InfoServiceThread.py b/Script/cs/Threads/InfoServiceThread.py index f7780c2..a8fe9db 100644 --- a/Script/cs/Threads/InfoServiceThread.py +++ b/Script/cs/Threads/InfoServiceThread.py @@ -86,4 +86,4 @@ class InfoServiceThread(threading.Thread): self.logger.debug("Update sent: %s", str(is_data)) 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)) diff --git a/copy_me_to_public/partition_is_tests/CastorScriptState.schema.xml b/TestPartition/CastorScriptState.schema.xml similarity index 94% rename from copy_me_to_public/partition_is_tests/CastorScriptState.schema.xml rename to TestPartition/CastorScriptState.schema.xml index e096d0c..2b94901 100644 --- a/copy_me_to_public/partition_is_tests/CastorScriptState.schema.xml +++ b/TestPartition/CastorScriptState.schema.xml @@ -78,9 +78,14 @@ <oks-schema> -<info name="" type="" num-of-items="1" oks-format="schema" oks-version="oks-07-00-02 built "Apr 16 2019"" 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 "Apr 16 2019"" 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"> + <superclass name="Info"/> <attribute name="uptime_seconds" description="uptime in seconds, since the CastorScript instance has started." type="double"/> </class> diff --git a/copy_me_to_public/partition_is_tests/cs-part_hlt_jholm.data.xml b/TestPartition/cs-part_hlt_jholm.data.xml similarity index 100% rename from copy_me_to_public/partition_is_tests/cs-part_hlt_jholm.data.xml rename to TestPartition/cs-part_hlt_jholm.data.xml diff --git a/copy_me_to_public/partition_is_tests/cs-part_hlt_jholm.schema.xml b/TestPartition/cs-part_hlt_jholm.schema.xml similarity index 100% rename from copy_me_to_public/partition_is_tests/cs-part_hlt_jholm.schema.xml rename to TestPartition/cs-part_hlt_jholm.schema.xml diff --git a/TestPartition/guide_custom_partition b/TestPartition/guide_custom_partition new file mode 100644 index 0000000..b0fed5f --- /dev/null +++ b/TestPartition/guide_custom_partition @@ -0,0 +1,27 @@ +======== +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 diff --git a/TestPartition/guide_oks_schemas b/TestPartition/guide_oks_schemas new file mode 100644 index 0000000..7fd7e50 --- /dev/null +++ b/TestPartition/guide_oks_schemas @@ -0,0 +1,47 @@ +======= +# HOW TO CREATE OKS Schema's and adding classes to these: + +MAKE a new schema file +1. source the release +2. > is_edit_repository.sh (with no params) +3. "right-click-hold" on the "schema" box + select "new" +4a. new window, at "Select file for new OKS schema": +4b. "Pick a name" for the schema, + format the name like so: "*.schema.xml" + (ie. cs.schema.xml) +4c. press "OK". + + +# If schema is not set as active: +5. "right-click-hold" on the "cs.schema.xml" schema entry, + move mouse cursor down to, "set active", and release. + + +# Add class to schema file +6. "right-click-hold" on the "Classes" box, and "select" the "new" option +7. "Input name" of the new class +# All classes should inherit from the Info class +8. Add required Info SuperClass: + "right-click-hold" on the "All super classes" box + select "add superclass" +9. select "info" by double clicking + + +# Adding attributes to a class +10a. "Right-click-hold" on "All Attributes" Box + select "add attribute" +10b. "pick a name" (remember your code style!) +10c. in new window select "type" (ie string or similar) +10d. remember to set "description" in the bottom!! +10e. click "OK" to finish the attribute + + +# Add description and save the class +11. Remember to set the "Description" of the class as well! +12. When done, click "Close" in the "Oks Class : ..." Window +13a. In the main window, under "Schema", Right-click-hold on the cs.schema.xml entry, +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 ) diff --git a/copy_me_to_public/partition_is_tests/part_hlt_jholm.data.xml b/TestPartition/part_hlt_jholm.data.xml similarity index 100% rename from copy_me_to_public/partition_is_tests/part_hlt_jholm.data.xml rename to TestPartition/part_hlt_jholm.data.xml diff --git a/TestPartition/readme b/TestPartition/readme new file mode 100644 index 0000000..4152e14 --- /dev/null +++ b/TestPartition/readme @@ -0,0 +1,47 @@ +======== +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"/> diff --git a/copy_me_to_public/partition_is_tests/CastorScriptState.h b/copy_me_to_public/partition_is_tests/CastorScriptState.h deleted file mode 100644 index 4a1cb53..0000000 --- a/copy_me_to_public/partition_is_tests/CastorScriptState.h +++ /dev/null @@ -1,92 +0,0 @@ -#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 diff --git a/copy_me_to_public/partition_is_tests/CastorScriptState.java b/copy_me_to_public/partition_is_tests/CastorScriptState.java deleted file mode 100644 index b17539e..0000000 --- a/copy_me_to_public/partition_is_tests/CastorScriptState.java +++ /dev/null @@ -1,53 +0,0 @@ - -// <<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>> - diff --git a/copy_me_to_public/partition_is_tests/is.xml b/copy_me_to_public/partition_is_tests/is.xml deleted file mode 100644 index f70ef1a..0000000 --- a/copy_me_to_public/partition_is_tests/is.xml +++ /dev/null @@ -1,211 +0,0 @@ -<?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 "Apr 15 2019"" 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<Boolean>" 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<Double>" 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<Float>" 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<S16>" 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<S32>" 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<S64>" 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<S8>" 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<String>" 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<U16>" 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<U32>" 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<U64>" 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<U8>" 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> diff --git a/is_schema_guide b/is_schema_guide deleted file mode 100644 index 21fc4a4..0000000 --- a/is_schema_guide +++ /dev/null @@ -1,43 +0,0 @@ -# Guide to creating OKS Schema's and adding classes to these: -# Make a new schema file -1. source the release -2. > is_edit_repository.sh (with no params) -3. "right-click-hold" on the "schema" box - select "new" -4a. new window, at "Select file for new OKS schema": -4b. "Pick a name" for the schema, - format the name like so: "*.schema.xml" - (ie. cs.schema.xml) -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: -7. "right-click-hold" on the "cs.schema.xml" schema entry, - move mouse cursor down to, "set active", and release. - -# Add class to schema file -8. "right-click-hold" on the "Classes" box, and "select" the "new" option -9. "Input name" of the new class -# All classes should inherit from the Info class -10. Add required Info SuperClass: - "right-click-hold" on the "All super classes" box - select "add superclass" -11. select "info" by double clicking - -# Adding attributes to a class -12a. "Right-click-hold" on "All Attributes" Box - select "add attribute" -12b. "pick a name" (remember your code style!) -12c. in new window select "type" (ie string or similar) -12d. remember to set "description" in the bottom!! -12e. click "OK" to finish the attribute - -# Finishing off the class -13. Remember to set the "Description" of the class as well! -14. 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, -15b. Select Save or similar ("save as" would work just fine as well if you want to save it somewhere else) - -- GitLab