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/Dockerfile b/Dockerfile index 6c21b74..869eaef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,15 +10,22 @@ 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 + +# 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 \ @@ -37,8 +44,21 @@ 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 +# Build psyllid in the deps image +FROM deps AS build + COPY . /tmp_source ## store cmake args because we'll need to run twice (known package_builder issue) @@ -46,17 +66,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 +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 $PSYLLID_BUILD_PREFIX $PSYLLID_BUILD_PREFIX +COPY --from=build /usr/local/lib /usr/local/lib +COPY --from=build $PSYLLID_INSTALL_PREFIX $PSYLLID_INSTALL_PREFIX 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. diff --git a/monarch b/monarch index 2cd6db0..a055076 160000 --- a/monarch +++ b/monarch @@ -1 +1 @@ -Subproject commit 2cd6db07af2b3850f8ddce7887ddc3767f6df629 +Subproject commit a0550765632e7b10e879b8dda78ffb1dbf7a1136 diff --git a/sandfly b/sandfly index abbadfc..0de4a8c 160000 --- a/sandfly +++ b/sandfly @@ -1 +1 @@ -Subproject commit abbadfc91c3ca3c36c2f18ab4d3038d39e833685 +Subproject commit 0de4a8ce599d7f20980c1fbde3625df8f4bc6ace 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 ) ); } } }