RCDB: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
Boiarino (talk | contribs)
No edit summary
Boiarino (talk | contribs)
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''NOT READY !!!!!!!!!!!!!!!!!!!!!!!!!!!!'''
== RCDB INSTALLATION ==


To use RCDB for online/trigger purposes, do following on clon machines:
To install RCDB, do following on RHEL7 machines:


su
git config --global http.proxy jprox.jlab.org:8081
  cd /usr/local/src
  cd /usr/local/src
  git clone https://github.com/JeffersonLab/rcdb
  git clone https://github.com/JeffersonLab/rcdb
  cd rcdb/
  cd rcdb/
  source environment.csh
  source environment.bash
  scons with-examples=true with-mysql=false
  cd cpp
scons with-examples=true (RHEL8: scons with-examples=true with-sqlite=false)
 
 
'''NOTE1:''' header files for CPP is in $RCDB_HOME/cpp/include/RCDB/
 
'''NOTE2:''' cpp example how to write database: $RCDB_HOME/cpp/examples/write_conditions.cpp
 
 
Include following into $CLON/.setup file:
Include following into $CLON/.setup file:
   
   
  #rcdb setting
  #rcdb setting
  setenv RCDB_HOME /usr/local/src/rcdb
  setenv RCDB_HOME /usr/local/src/rcdb
if (! $?LD_LIBRARY_PATH) then
    setenv LD_LIBRARY_PATH $RCDB_HOME/cpp/lib
else
    setenv LD_LIBRARY_PATH "$RCDB_HOME/cpp/lib":$LD_LIBRARY_PATH
endif
setenv PATH "$RCDB_HOME":"$RCDB_HOME/bin":"$RCDB_HOME/cpp/bin":$PATH
if ( ! $?PYTHONPATH ) then
    setenv PYTHONPATH "$RCDB_HOME/python"
else
    setenv PYTHONPATH "$RCDB_HOME/python":$PYTHONPATH
endif


Also if needed:
appends $PYTHONPATH - with $RCDB_HOME/python
appends $PATH - with rcdb bin folder


Do following in Makefiles:
Do following in Makefiles:


  #rcdb
  #rcdb
  CLON_FLAGS += -I$(RCDB_HOME)/include -I$(RCDB_HOME)/include/SQLite
  CLON_FLAGS += -I$(RCDB_HOME)/cpp/include -I$(RCDB_HOME)/cpp/include/SQLite
  LIBNAMES += $(RCDB_HOME)/lib/librcdb.a
  LIBNAMES += $(RCDB_HOME)/cpp/lib/librcdb.a
  LIBNAMES += $(RCDB_HOME)/tmp/SQLite/librcdb_sqlite.a
  ### LIBNAMES += $(RCDB_HOME)/tmp/SQLite/librcdb_sqlite.a
 
== RCDB CONNECTION ==
 
Reference: https://github.com/JeffersonLab/rcdb/wiki
 
setenv RCDB_CONNECTION mysql://rcdb:<clasrun password>@clondb1/rcdb
 
== RCDB DATABASE UPGRADE ==
 
cd $RCDB_HOME
alembic upgrade head
 
== HOW TO ADD NEW CONDITION TYPE (NEW NAME !!!) ==
 
To print possible options:
 
rcnd --help
 
Example:
rcnd --create run_start_time --type time --description "Run start time"
rcnd --create run_end_time --type time --description "Run end time"
rcnd --create is_valid_run_end --type bool --description "True if a run has valid run-end record. False means the run was aborted/crashed at some point"
rcnd --create json_cnd --type json --description "Basic run info"
 
rcnd --write "value to write" --replace 1000 my_value
 
For example:
rcnd --write "true" --replace 100 is_valid_run_end
 
rcdb --remove ....
 
== WEB BROWSING ==
 
clondaq6:clon> cd $RCDB_HOME
clondaq6:rcdb> setenv RCDB_CONNECTION mysql://rcdb:<clasrun password>@clondb1/rcdb
python start_www.py


And in local browser: http://127.0.0.1:5000/


??? Actual clas12 database will be provided as file 'clas12.sqlite', have to be placed into $CLON_PARMS directory
Global web page suppose to be at http://clasweb.jlab.org/rcdb/

Latest revision as of 14:00, 19 September 2021

RCDB INSTALLATION

To install RCDB, do following on RHEL7 machines:

su
git config --global http.proxy jprox.jlab.org:8081
cd /usr/local/src
git clone https://github.com/JeffersonLab/rcdb
cd rcdb/
source environment.bash
cd cpp
scons with-examples=true (RHEL8: scons with-examples=true with-sqlite=false)


NOTE1: header files for CPP is in $RCDB_HOME/cpp/include/RCDB/

NOTE2: cpp example how to write database: $RCDB_HOME/cpp/examples/write_conditions.cpp


Include following into $CLON/.setup file:

#rcdb setting
setenv RCDB_HOME /usr/local/src/rcdb
if (! $?LD_LIBRARY_PATH) then
   setenv LD_LIBRARY_PATH $RCDB_HOME/cpp/lib
else
   setenv LD_LIBRARY_PATH "$RCDB_HOME/cpp/lib":$LD_LIBRARY_PATH
endif
setenv PATH "$RCDB_HOME":"$RCDB_HOME/bin":"$RCDB_HOME/cpp/bin":$PATH
if ( ! $?PYTHONPATH ) then
   setenv PYTHONPATH "$RCDB_HOME/python"
else
   setenv PYTHONPATH "$RCDB_HOME/python":$PYTHONPATH
endif


Do following in Makefiles:

#rcdb
CLON_FLAGS += -I$(RCDB_HOME)/cpp/include -I$(RCDB_HOME)/cpp/include/SQLite
LIBNAMES += $(RCDB_HOME)/cpp/lib/librcdb.a
### LIBNAMES += $(RCDB_HOME)/tmp/SQLite/librcdb_sqlite.a

RCDB CONNECTION

Reference: https://github.com/JeffersonLab/rcdb/wiki

setenv RCDB_CONNECTION mysql://rcdb:<clasrun password>@clondb1/rcdb

RCDB DATABASE UPGRADE

cd $RCDB_HOME
alembic upgrade head

HOW TO ADD NEW CONDITION TYPE (NEW NAME !!!)

To print possible options:

rcnd --help

Example:

rcnd --create run_start_time --type time --description "Run start time"
rcnd --create run_end_time --type time --description "Run end time"
rcnd --create is_valid_run_end --type bool --description "True if a run has valid run-end record. False means the run was aborted/crashed at some point"
rcnd --create json_cnd --type json --description "Basic run info"
rcnd --write "value to write" --replace 1000 my_value

For example:

rcnd --write "true" --replace 100 is_valid_run_end
rcdb --remove ....

WEB BROWSING

clondaq6:clon> cd $RCDB_HOME
clondaq6:rcdb> setenv RCDB_CONNECTION mysql://rcdb:<clasrun password>@clondb1/rcdb
python start_www.py

And in local browser: http://127.0.0.1:5000/

Global web page suppose to be at http://clasweb.jlab.org/rcdb/