From d1286bb1b4d8d498c580337e3d9e51b3ec9bbad8 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Wed, 8 Jan 2025 16:18:41 -0800 Subject: [PATCH 1/8] Monarch and Sandfly on hotfix branches --- monarch | 2 +- sandfly | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monarch b/monarch index 2cd6db0..e5ac914 160000 --- a/monarch +++ b/monarch @@ -1 +1 @@ -Subproject commit 2cd6db07af2b3850f8ddce7887ddc3767f6df629 +Subproject commit e5ac914599f8b6210883a63dfa0e8f4831bef661 diff --git a/sandfly b/sandfly index abbadfc..2f22e1f 160000 --- a/sandfly +++ b/sandfly @@ -1 +1 @@ -Subproject commit abbadfc91c3ca3c36c2f18ab4d3038d39e833685 +Subproject commit 2f22e1f30727eaf5652e1c7d6a20801f8e855bb3 From 2fe6db14052570b8e8c3a979b5907831ffe5fc51 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Wed, 8 Jan 2025 16:22:03 -0800 Subject: [PATCH 2/8] Updates for upstream changes --- CMakeLists.txt | 2 +- source/applications/CMakeLists.txt | 2 +- source/applications/grab_packet.cc | 3 +++ source/applications/psyllid.cc | 19 +++++++++++-------- source/control/daq_control.cc | 4 ++-- source/control/daq_control.hh | 2 +- source/daq/egg3_reader.cc | 4 ++-- source/daq/packet_receiver_socket.cc | 2 +- 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad55d13..ea70240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ if( UNIX AND NOT APPLE ) set( default__fpa_flag TRUE ) endif( UNIX AND NOT APPLE ) -set( CMAKE_CXX_STANDARD 17 ) +set_to_max( CMAKE_CXX_STANDARD 17 ) option( Psyllid_ENABLE_ITERATOR_TIMING "Flag to enable iterator time profiling" FALSE ) option( Psyllid_ENABLE_FPA "Flag to enable the fast-packet-acquisition interface (requires root)" ${default__fpa_flag} ) diff --git a/source/applications/CMakeLists.txt b/source/applications/CMakeLists.txt index 8d5854a..c6e4764 100644 --- a/source/applications/CMakeLists.txt +++ b/source/applications/CMakeLists.txt @@ -14,7 +14,7 @@ set( psyllid_exe_PROGRAMS ) # Non-psyllid executables set( programs - grab_packet + grab_packet.cc ) pbuilder_executables( diff --git a/source/applications/grab_packet.cc b/source/applications/grab_packet.cc index c294bd2..466d73a 100644 --- a/source/applications/grab_packet.cc +++ b/source/applications/grab_packet.cc @@ -201,12 +201,15 @@ int main( int argc, char** argv ) // Parse CL options and run the application CLI11_PARSE( the_main, argc, argv ); + STOP_LOGGING; + return RETURN_SUCCESS; } catch( std::exception& e ) { LERROR( plog, "Caught an exception: " << e.what() ); } + STOP_LOGGING; return RETURN_ERROR; } diff --git a/source/applications/psyllid.cc b/source/applications/psyllid.cc index 3c715d5..6b14642 100644 --- a/source/applications/psyllid.cc +++ b/source/applications/psyllid.cc @@ -35,6 +35,7 @@ int main( int argc, char** argv ) "\t\t _/ _/ \n" << "\t\t_/ _/_/ \n\n"); + unsigned return_val; try { // The application @@ -51,7 +52,7 @@ int main( int argc, char** argv ) auto t_cwrap = scarab::wrap_cancelable( the_conductor ); t_sig_hand.add_cancelable( t_cwrap ); - the_conductor.execute( the_main.primary_config() ); + the_conductor.execute( the_main.primary_config(), the_main.auth() ); } ); // Command line options @@ -63,34 +64,36 @@ int main( int argc, char** argv ) // Parse CL options and run the application CLI11_PARSE( the_main, argc, argv ); - return the_conductor.get_return(); + return_val = the_conductor.get_return(); } catch( scarab::error& e ) { LERROR( plog, "configuration error: " << e.what() ); - return RETURN_ERROR; + return_val = RETURN_ERROR; } catch( psyllid::error& e ) { LERROR( plog, "psyllid error: " << e.what() ); - return RETURN_ERROR; + return_val = RETURN_ERROR; } catch( sandfly::error& e ) { LERROR( plog, "sandfly error: " << e.what() ); - return RETURN_ERROR; + return_val = RETURN_ERROR; } catch( std::exception& e ) { LERROR( plog, "std::exception caught: " << e.what() ); - return RETURN_ERROR; + return_val = RETURN_ERROR; } catch( ... ) { LERROR( plog, "unknown exception caught" ); - return RETURN_ERROR; + return_val = RETURN_ERROR; } - return RETURN_ERROR; + STOP_LOGGING; + + return return_val; } diff --git a/source/control/daq_control.cc b/source/control/daq_control.cc index e159538..6be2919 100644 --- a/source/control/daq_control.cc +++ b/source/control/daq_control.cc @@ -26,8 +26,8 @@ namespace psyllid { LOGGER( plog, "daq_control" ); - daq_control::daq_control( const param_node& a_primary_config, std::shared_ptr< sandfly::stream_manager > a_mgr ) : - sandfly::run_control( a_primary_config, a_mgr ), + daq_control::daq_control( const param_node& a_primary_config, std::shared_ptr< sandfly::stream_manager > a_mgr, std::shared_ptr< sandfly::message_relayer > a_relay ) : + sandfly::run_control( a_primary_config, a_mgr, a_relay ), f_use_monarch( true ) { set_use_monarch( f_daq_config.get_value( "use-monarch", get_use_monarch() ) ); diff --git a/source/control/daq_control.hh b/source/control/daq_control.hh index a4a6045..311e1b3 100644 --- a/source/control/daq_control.hh +++ b/source/control/daq_control.hh @@ -28,7 +28,7 @@ namespace psyllid { public: - daq_control( const scarab::param_node& a_primary_config, std::shared_ptr< sandfly::stream_manager > a_mgr ); + daq_control( const scarab::param_node& a_primary_config, std::shared_ptr< sandfly::stream_manager > a_mgr, std::shared_ptr< sandfly::message_relayer > a_relay ); virtual ~daq_control(); protected: diff --git a/source/daq/egg3_reader.cc b/source/daq/egg3_reader.cc index 7ee683d..565da87 100644 --- a/source/daq/egg3_reader.cc +++ b/source/daq/egg3_reader.cc @@ -5,14 +5,14 @@ * Author: laroque */ +// ordering note: this is before egg3_reader.hh so that the Monarch operator<<'s are defined before logger.hh is included +#include "M3Monarch.hh" #include "egg3_reader.hh" #include "psyllid_error.hh" #include "time_data.hh" -#include "M3Monarch.hh" - #include "run_control.hh" #include "logger.hh" diff --git a/source/daq/packet_receiver_socket.cc b/source/daq/packet_receiver_socket.cc index 1a197b9..5b0a40e 100644 --- a/source/daq/packet_receiver_socket.cc +++ b/source/daq/packet_receiver_socket.cc @@ -173,7 +173,7 @@ namespace psyllid } else // t_size_received < 0 && f_last_errno != EWOULDBLOCK && f_last_errno != EAGAIN { - LWARN( "Unable to receive; error message: " << strerror( f_last_errno ) ); + LWARN( plog, "Unable to receive; error message: " << strerror( f_last_errno ) ); } } } From a9b4811dea4e3e2be1f4ebb4c262b80760349a8c Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Fri, 10 Jan 2025 11:28:25 -0800 Subject: [PATCH 3/8] Small fix to the api docs --- documentation/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/api.rst b/documentation/api.rst index b5c93b1..48fceda 100644 --- a/documentation/api.rst +++ b/documentation/api.rst @@ -362,6 +362,6 @@ All `command` requests are lockable. Put in its deactivated state, in which it is not immediately ready to take data. Psyllid must be in its activated state before this call. .. toggle-header:: - :header: ``quit-psyllid`` + :header: ``quit`` Instruct the Psyllid executable to exit. From 565ce72a5bae8296471459239babe6b59d5166ea Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Fri, 10 Jan 2025 11:28:54 -0800 Subject: [PATCH 4/8] Updated the Dockerfile to separate the deps and build stages. Added narg option. --- Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c21b74..c17c7fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,15 +10,18 @@ SHELL ["/bin/bash", "-c"] ARG psyllid_tag=beta ARG psyllid_subdir=psyllid ARG build_type=Release +ARG narg=2 + ENV P8_ROOT=/usr/local/p8 ENV PSYLLID_TAG=${psyllid_tag} ENV PSYLLID_INSTALL_PREFIX=${P8_ROOT}/${psyllid_subdir}/${PSYLLID_TAG} +ENV NARG=${narg} ENV PATH="${PATH}:${PSYLLID_INSTALL_PREFIX}" # Build image with dev dependencies -FROM base AS build +FROM base AS deps RUN apt-get update &&\ DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -38,6 +41,10 @@ RUN apt-get update &&\ apt-get clean &&\ rm -rf /var/lib/apt/lists/* &&\ /bin/true + + +# Build psyllid in the deps image +FROM deps AS build COPY . /tmp_source @@ -46,17 +53,16 @@ COPY . /tmp_source ARG extra_cmake_args="" ENV CMAKE_CONFIG_ARGS_LIST="\ -D CMAKE_BUILD_TYPE=$build_type \ - -D CMAKE_INSTALL_PREFIX:PATH=$PSYLLID_BUILD_PREFIX \ + -D CMAKE_INSTALL_PREFIX:PATH=$PSYLLID_INSTALL_PREFIX \ -D Psyllid_ENABLE_FPA=FALSE \ ${extra_cmake_args} \ - ${OS_CMAKE_ARGS} \ " RUN mkdir -p /tmp_source/build &&\ cd /tmp_source/build &&\ cmake ${CMAKE_CONFIG_ARGS_LIST} .. &&\ cmake ${CMAKE_CONFIG_ARGS_LIST} .. &&\ - make install &&\ + make -j${NARG} install &&\ /bin/true # Final production image @@ -80,4 +86,4 @@ RUN apt-get update &&\ /bin/true # for now we must grab the extra dependency content as well as psyllid itself -COPY --from=build $PSYLLID_BUILD_PREFIX $PSYLLID_BUILD_PREFIX +COPY --from=build $PSYLLID_INSTALL_PREFIX $PSYLLID_INSTALL_PREFIX From f0872eb577dc00aa3eb8b8cabddf2c5cc5f20211 Mon Sep 17 00:00:00 2001 From: Paul Kolbeck Date: Fri, 10 Jan 2025 12:51:33 -0800 Subject: [PATCH 5/8] Added quill dependency to Dockerfile. --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Dockerfile b/Dockerfile index c17c7fc..6f14fe0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,6 +42,18 @@ RUN apt-get update &&\ rm -rf /var/lib/apt/lists/* &&\ /bin/true +# use quill_checkout to specify a tag or branch name to checkout +ARG quill_checkout=v7.3.0 +RUN cd /usr/local && \ + git clone https://github.com/odygrd/quill.git && \ + cd quill && \ + git checkout ${quill_checkout} && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make -j${narg} install && \ + cd / && \ + rm -rf /usr/local/quill # Build psyllid in the deps image FROM deps AS build From 6d643eb0e26bc40eb25f52e7a9c66bd079ae329d Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Mon, 13 Jan 2025 16:26:19 -0800 Subject: [PATCH 6/8] Updated Monarch and Sandfly --- monarch | 2 +- sandfly | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monarch b/monarch index e5ac914..a73b224 160000 --- a/monarch +++ b/monarch @@ -1 +1 @@ -Subproject commit e5ac914599f8b6210883a63dfa0e8f4831bef661 +Subproject commit a73b224907fe763e31f4e4bb6adf2b93fbc3c195 diff --git a/sandfly b/sandfly index 2f22e1f..6066c8d 160000 --- a/sandfly +++ b/sandfly @@ -1 +1 @@ -Subproject commit 2f22e1f30727eaf5652e1c7d6a20801f8e855bb3 +Subproject commit 6066c8d625b887fdf31448345aac5ccfc13a75f1 From d489c7542a3154fec5b8b4216e4fab9ff2274656 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Wed, 15 Jan 2025 16:24:08 -0800 Subject: [PATCH 7/8] Merge quill build steps with previous RUN statement and copy build artifacts into the final image --- Dockerfile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f14fe0..869eaef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,10 @@ ENV PATH="${PATH}:${PSYLLID_INSTALL_PREFIX}" # Build image with dev dependencies FROM base AS deps +# use quill_checkout to specify a tag or branch name to checkout +ARG quill_checkout=v7.3.0 +ENV QUILL_CHECKOUT=${quill_checkout} + RUN apt-get update &&\ DEBIAN_FRONTEND=noninteractive apt-get install -y \ build-essential \ @@ -40,20 +44,17 @@ RUN apt-get update &&\ &&\ apt-get clean &&\ rm -rf /var/lib/apt/lists/* &&\ + cd /usr/local &&\ + git clone https://github.com/odygrd/quill.git &&\ + cd quill &&\ + git checkout ${QUILL_CHECKOUT} &&\ + mkdir build &&\ + cd build &&\ + cmake .. &&\ + make -j${narg} install &&\ + cd / &&\ + rm -rf /usr/local/quill &&\ /bin/true - -# use quill_checkout to specify a tag or branch name to checkout -ARG quill_checkout=v7.3.0 -RUN cd /usr/local && \ - git clone https://github.com/odygrd/quill.git && \ - cd quill && \ - git checkout ${quill_checkout} && \ - mkdir build && \ - cd build && \ - cmake .. && \ - make -j${narg} install && \ - cd / && \ - rm -rf /usr/local/quill # Build psyllid in the deps image FROM deps AS build @@ -98,4 +99,5 @@ RUN apt-get update &&\ /bin/true # for now we must grab the extra dependency content as well as psyllid itself +COPY --from=build /usr/local/lib /usr/local/lib COPY --from=build $PSYLLID_INSTALL_PREFIX $PSYLLID_INSTALL_PREFIX From 652e648de748abba5646e693992212992e9e1c38 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Wed, 15 Jan 2025 16:35:20 -0800 Subject: [PATCH 8/8] Updating Monarch to v3.8.4 and updating Sandfly to v0.5.4 --- monarch | 2 +- sandfly | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monarch b/monarch index a73b224..a055076 160000 --- a/monarch +++ b/monarch @@ -1 +1 @@ -Subproject commit a73b224907fe763e31f4e4bb6adf2b93fbc3c195 +Subproject commit a0550765632e7b10e879b8dda78ffb1dbf7a1136 diff --git a/sandfly b/sandfly index 6066c8d..0de4a8c 160000 --- a/sandfly +++ b/sandfly @@ -1 +1 @@ -Subproject commit 6066c8d625b887fdf31448345aac5ccfc13a75f1 +Subproject commit 0de4a8ce599d7f20980c1fbde3625df8f4bc6ace