Skip to content
Snippets Groups Projects
Commit 59b756d7 authored by Adrien Blanchet's avatar Adrien Blanchet
Browse files

Merge branch 'feature/currentConfigFetcher' into 'main'

Feature/current config fetcher

See merge request !46
parents 485dc382 0c22d23b
Branches
Tags 1.2.0
1 merge request!46Feature/current config fetcher
Pipeline #10934 passed
.idea
*.DS_Store
outputbash/odb/config.sh
bash/odb/temp/config.sh
......@@ -31,6 +31,7 @@ set_target_properties( lpdevC PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/e
add_definitions( -D __LINUX_BUILD )
add_library( sampic256ch STATIC ${SAMPIC_SRC_FILES} )
target_link_libraries( sampic256ch PRIVATE lpdevC lpdev ftd2xx )
target_compile_options( sampic256ch PRIVATE -Wno-unused-result )
install( TARGETS sampic256ch DESTINATION lib )
......
......@@ -23,6 +23,7 @@ LoggerInit([]{
BOOL equipment_common_overwrite = TRUE;
bool enableMonitoring{false};
std::string currentConfigStr{};
SampicHandler sampicHandle{};
......@@ -31,6 +32,9 @@ INT frontend_init(){
Logger::quietLineJump(); // flushing midas printout...
LogWarning << GenericToolbox::addUpDownBars("Starting " + GenericToolbox::getExecutableName() + "...") << std::endl;
currentConfigStr = GenericToolbox::splitString( GenericToolbox::dumpFileAsVectorString("/root/bash/odb/temp/config.sh", true)[1], "=" )[1];
LogInfo << GET_VAR_NAME_VALUE(currentConfigStr) << std::endl;
// Get database
LogThrowIf(cm_get_experiment_database(&odbHandle, nullptr) != CM_SUCCESS, "Could not get experiment database");
GenericToolbox::Midas::Odb::hDB = odbHandle;
......@@ -117,6 +121,7 @@ INT frontend_loop(){
std::stringstream ssFooter;
std::string dataDir = GenericToolbox::Midas::Odb::read<std::string>("/Logger/Data dir");
ssFooter << "Current config: " << currentConfigStr << std::endl;
ssFooter << "Disk free space: " << GenericToolbox::parseSizeUnits( double( GenericToolbox::getFreeDiskSpace( dataDir ) ) )
<< "B (" << GenericToolbox::getFreeDiskSpacePercent( dataDir ) << "%)" << std::endl;
ssFooter << "CPU usage: " << GenericToolbox::getCpuUsageByProcess() << "%";
......
......@@ -5,6 +5,13 @@ PROJECT_NAME="tof-midas-daq"
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
builtin cd ${THIS_SCRIPT_DIR} || exit 1;
function syncSubmodules(){
echo "Synchronising submodules..."
git submodule sync
echo "Updating submodules..."
git submodule update --init --recursive
};
for arg in "$@"
do
......@@ -19,35 +26,37 @@ do
exit 0;
elif [ $arg == "--fix-submodules" ]; then
echo "Re-initializing submodules..."
git submodule deinit --all
git submodule sync
git submodule update --init --remote --recursive
git submodule deinit --all -f
syncSubmodules
git status
exit 0;
elif [ $arg == "-v" ]; then
shift
if [[ -n $1 ]]; then
echo "Updating to version: $1"
git checkout $1
git submodule sync
git submodule update --init --remote --recursive
syncSubmodules
git status
else
echo "You should provide a version after -v"
echo "You have to provide a version after -v"
fi
exit 0;
elif [ $arg == "-b" ]; then
shift
if [[ -n $1 ]]; then
echo "Updating to branch: $1"
git fetch # fetching new branches from remote
git checkout $1
if [[ "$1" == "remotes/origin/"* ]]; then
# in case of remotes, checkout will be pointing at a commit hash without being attached to a branch.
# Need to checkout the real branch name now:
git checkout "${1#"remotes/origin/"}"
fi
git submodule sync
git submodule update --init --remote --recursive
git pull
syncSubmodules
git status
else
echo "You should provide a version after -b"
echo "You have to provide a version after -b"
fi
exit 0;
elif [ $arg == "--latest" ]; then
......@@ -56,21 +65,21 @@ do
LATEST_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Checking out latest version: $LATEST_VERSION"
git checkout $LATEST_VERSION
git submodule sync
git submodule update --init --remote --recursive
syncSubmodules
git status
exit 0;
elif [ $arg == "--head" ]; then
echo "Checking out main branch..."
git checkout main
git pull origin main # updates repo
git submodule sync
git submodule update --init --remote --recursive
syncSubmodules
git status
exit 0;
elif [ $arg == "--up" ]; then
echo "Updating..."
git pull
git submodule sync
git submodule update --init --remote --recursive
syncSubmodules
git status
exit 0;
fi
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment