diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 8abe1f910f..724c44f813 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -85,7 +85,7 @@ jobs: release: nightly - CC: clang CMAKE_BUILD_TYPE: Release - release: 24.04.0-stable + release: 24.05.0-stable steps: - name: mmap rnd_bits workaround # https://github.com/actions/runner/issues/3207#issuecomment-2000066889 @@ -647,6 +647,86 @@ jobs: path: rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}_${{ matrix.benchmark_plugins }}.hists.root if-no-files-found: error + eicrecon-nopayloadclient: + runs-on: ubuntu-latest + needs: + - build + - npsim-gun + strategy: + matrix: + CC: [clang] + particle: [e] + detector_config: [craterlake] + services: + db: + image: postgres + env: + POSTGRES_DB: dbname + POSTGRES_USER: login + POSTGRES_PASSWORD: password + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + nopayloaddb-webapp: + image: ghcr.io/eic/nopayloaddb-webapp:latest + env: + POSTGRES_DB: dbname + POSTGRES_USER: login + POSTGRES_PASSWORD: password + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + ports: + - 8000:8000 + steps: + - name: Checkout .github + uses: actions/checkout@v4 + with: + sparse-checkout: .github + - name: Download install directory + uses: actions/download-artifact@v4 + with: + name: install-${{ matrix.CC }}-eic-shell-Release-${{ env.platform }}-${{ env.release }} + - name: Uncompress install directory + run: tar -xaf install.tar.zst + - uses: actions/download-artifact@v4 + with: + name: sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root + - uses: cvmfs-contrib/github-action-cvmfs@v4 + - name: Run EICrecon + uses: eic/run-cvmfs-osg-eic-shell@main + with: + platform-release: "${{ env.platform }}:${{ env.release }}" + setup: "/opt/detector/epic-${{ env.detector-version }}/setup.sh" + run: | + export NOPAYLOADCLIENT_CONF=$PWD/default.json + cat <<- EOF > $NOPAYLOADCLIENT_CONF + { + "base_url": "localhost:8000", + "api_res": "/api/cdb_rest/", + "write_dir": "/tmp/remote_pl_store/", + "read_dir_list": ["/tmp/remote_pl_store/", "/cvmfs/place/holder/"], + "n_retries": 5, + "retry_sleep_mean": 30, + "cache_life_time": 10, + "cache_max_mb": 1, + "print_time_stamps": false, + "use_fake_backend": false, + "logger": "terminal", + "log_level": "INFO" + } + EOF + cli_npc checkConnection + export DETECTOR_CONFIG=${DETECTOR}_${{ matrix.detector_config }} + export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH + export JANA_PLUGIN_PATH=$PWD/install/lib/EICrecon/plugins:/usr/local/plugins + $PWD/install/bin/eicrecon -Ppodio:output_file=rec_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4eic.root sim_${{ matrix.particle }}_1GeV_20GeV_${{ matrix.detector_config }}.edm4hep.root -Pplugins=dump_flags,janadot,janatop -Pdump_flags:json=${{ matrix.particle }}_${{ matrix.detector_config }}_flags.json -Pjana:warmup_timeout=0 -Pjana:timeout=0 + eicrecon-gun: runs-on: ubuntu-latest needs: diff --git a/cmake/jana_plugin.cmake b/cmake/jana_plugin.cmake index ea5c0b2ffa..2ebbe3317a 100644 --- a/cmake/jana_plugin.cmake +++ b/cmake/jana_plugin.cmake @@ -329,6 +329,24 @@ macro(plugin_add_irt _name) endmacro() +# Adds nopayloadclient for a plugin +macro(plugin_add_nopayloadclient _name) + + if(NOT CURL_FOUND) + find_package(CURL REQUIRED) + endif() + + find_library(npc_lib REQUIRED NAMES nopayloadclient) + find_path(npc_include REQUIRED NAMES nopayloadclient) + + # Add include directories + plugin_include_directories(${PLUGIN_NAME} PUBLIC ${npc_include}) + + # Add libraries + plugin_link_libraries(${PLUGIN_NAME} CURL::libcurl ${npc_lib}) + +endmacro() + # Adds podio, edm4hep, edm4eic for a plugin macro(plugin_add_event_model _name) diff --git a/src/services/CMakeLists.txt b/src/services/CMakeLists.txt index 4587344f41..57b65fd208 100644 --- a/src/services/CMakeLists.txt +++ b/src/services/CMakeLists.txt @@ -5,5 +5,6 @@ add_subdirectory(geometry/acts) add_subdirectory(geometry/richgeo) add_subdirectory(io/podio) add_subdirectory(log) +add_subdirectory(payload) add_subdirectory(rootfile) add_subdirectory(pid_lut) diff --git a/src/services/payload/CMakeLists.txt b/src/services/payload/CMakeLists.txt new file mode 100644 index 0000000000..e02351b0aa --- /dev/null +++ b/src/services/payload/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.16) + +# Automatically set plugin name the same as the directory name Don't forget +# string(REPLACE " " "_" PLUGIN_NAME ${PLUGIN_NAME}) if this dir has spaces in +# its name +get_filename_component(PLUGIN_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) + +# Function creates ${PLUGIN_NAME}_plugin and ${PLUGIN_NAME}_library targets +# Setting default includes, libraries and installation paths +plugin_add(${PLUGIN_NAME} WITH_SHARED_LIBRARY) + +# The macro grabs sources as *.cc *.cpp *.c and headers as *.h *.hh *.hpp Then +# correctly sets sources for ${_name}_plugin and ${_name}_library targets Adds +# headers to the correct installation directory +plugin_glob_all(${PLUGIN_NAME}) + +# Find dependencies +plugin_add_nopayloadclient(${PLUGIN_NAME}) diff --git a/src/services/payload/Payload_service.cc b/src/services/payload/Payload_service.cc new file mode 100644 index 0000000000..0e2ab6fd88 --- /dev/null +++ b/src/services/payload/Payload_service.cc @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Wouter Deconinck + +#include "Payload_service.h" + +#include +#include +#include + +Payload_service::Payload_service(JApplication *app) +: m_client("EICrecon") { + m_application = app; +} diff --git a/src/services/payload/Payload_service.h b/src/services/payload/Payload_service.h new file mode 100644 index 0000000000..4395c4960a --- /dev/null +++ b/src/services/payload/Payload_service.h @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Wouter Deconinck + +#pragma once + +#include +#include +#include +#include +#include + +class Payload_service : public JService +{ +public: + explicit Payload_service(JApplication *app); + ~Payload_service() { }; + +private: + + Payload_service() = default; + + nopayloadclient::NoPayloadClient m_client; + + JApplication* m_application; +}; diff --git a/src/services/payload/payload.cc b/src/services/payload/payload.cc new file mode 100644 index 0000000000..542bfee67f --- /dev/null +++ b/src/services/payload/payload.cc @@ -0,0 +1,16 @@ +// Copyright 2022, David Lawrence +// Subject to the terms in the LICENSE file found in the top-level directory. +// +// + +#include +#include + +#include "services/log/Log_service.h" + +extern "C" { +void InitPlugin(JApplication* app) { + InitJANAPlugin(app); + app->ProvideService(std::make_shared(app)); +} +}