Project

General

Profile

Feature #21799

Allow sending metrics and/or TRACEs from python or Node.js

Added by Eric Flumerfelt over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Start date:
01/30/2019
Due date:
% Done:

0%

Estimated time:
Experiment:
-
Co-Assignees:
Duration:

Description

There should be a facility for external programs/scripts (such as DAQInterface) to sent TRACE messages or log metrics to the metric subsystem.

This issue has two parts:
  1. Create CMake configurations for generating both Python and Node.js modules
  2. Create a class which includes artdaq/DAQdata/Globals.hh and has methods which expose metric-sending and TRACEing functionality

The first part is implemented in artdaq-utilities/feature/PythonAddonCMakeModule (Also in artdaq_ganglia_plugin)
The second part is implemented in artdaq/feature/SWIGBindingsForMetricsAndTRACEMessages


Related issues

Related to artdaq Utilities - Feature #23784: DAQInterface should be able to send messages to MessageViewerReviewed12/19/2019

Associated revisions

Revision 29221a08 (diff)
Added by John Freeman 7 months ago

JCF: Issue #21799: add qualifier info for SWIG and NodeJs to product_deps and bump the version of SWIG from v3_0_12c to v3_0_12d since there's an e19 build available for it

Revision e1642658 (diff)
Added by John Freeman 7 months ago

JCF: Issue #21799: add -Wno-error=register -Wno-error=stringop-truncation flags

By default, declaring a variable with the deprecated "register" keyword or copying
characters with strncpy such that a null-terminator gets overwritten are treated as
errors. However, I find that if I don't demote these to warnings, the following happens:

/cvmfs/fermilab.opensciencegrid.org/products/artdaq/python/v2_7_15a/Linux64bit+3.10-2.17/include/python2.7/stringobject.h:175:26:
error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register]

/home/jcfree/artdaq-demo_issue22979/build_slf7.x86_64/artdaq/tools/CMakeFiles/_python_artdaq.dir/swig_artdaq_pythonPYTHON_wrap.cxx:5160:22:
error: ‘char* strncpy(char*, const char*, size_t)’ output truncated
before terminating nul copying 10 bytes from a string of the same
length [-Werror=stringop-truncation]

Revision 096b1e72 (diff)
Added by John Freeman 7 months ago

JCF: Issue #21799: eliminated a compilation error due to "AccumulateAndRate" not being an enum value of MetricMode

On the current head of artdaq-utilities' develop branch, commit
0118a40d5bb01af9fa3057dfc35df4228a77a796, the MetricMode enum defined
in MetricData.hh has a "Rate" value but not an "AccumulateAndRate"
value; changing it allows compilation of artdaq to proceed.

History

#1 Updated by John Freeman 7 months ago

  • Related to Feature #23784: DAQInterface should be able to send messages to MessageViewer added

#2 Updated by John Freeman 6 months ago

An update on the review:

1) It took me a couple of commits in order to get artdaq's feature/SWIGBindingsForMetricsAndTRACEMessages branch to compile properly in my mu2edaq01:/home/jcfree/artdaq-demo_issue21799 installation area; I've pushed those commits to the central repository.

2) If I launch MessageViewer via the DAQInterface boot transition, and then in another terminal source /home/jcfree/artdaq-demo_issue21799/setupARTDAQDEMO, set ARTDAQ_LOG_FHICL to the DAQInterface-generated /tmp/messagefacility_partition1_jcfree.fcl and add /home/jcfree/artdaq-demo_issue21799/localProducts_artdaq_demo_v3_07_01a_e19_s89_prof/artdaq/v3_07_01a/slf7.x86_64.e19.s89.prof/python to PYTHONPATH, the following python snippet successfully sends a message to MessageViewer:

import python_artdaq
from python_artdaq import swig_artdaq
myobj = swig_artdaq("destinations:{console:{threshold:\"INFO\" type:\"cout\"} udp : { type : \"UDP\" threshold : \"DEBUG\"  port: 11005 host : \"mu2edaq13\" } }")
myobj.write_info("John", "This is a test")

3) I'm running into an issue with my Node.js test, however. If I perform the same steps as in (2) excepting the PYTHONPATH modification, then the following JavaScript snippet doesn't work:

var node_artdaq = require('/home/jcfree/artdaq-demo_issue21799/build_slf7.x86_64/artdaq/lib/node_artdaq.node')
node_artdaq.swig_artdaq("destinations:{console:{threshold:\"INFO\" type:\"cout\"} udp : { type : \"UDP\" threshold : \"DEBUG\"  port: 11005 host : \"mu2edaq13\" } }")

...in that I see the following:

terminate called after throwing an instance of 'cet::coded_exception<fhicl::error, &fhicl::detail::translate[abi:cxx11]>'
  what():  ---- Type mismatch BEGIN

  Unsuccessful attempt to convert FHiCL parameter 'debugModules[0]' to type 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'.

  [Specific error:]
  bad any_cast

---- Type mismatch END

Aborted

Not sure whether I'm missing something or if this underscores a legitimate issue with the current implementation of node_artdaq.node

#3 Updated by Eric Flumerfelt 6 months ago

On artdaq-utilities:feature/21799_FixCompileFlagsForAddons, I have updated the compile flags used by the NodeJSAddon.cmake and PythonAddon.cmake scripts. This allows us to fix the compile flags for just the addons, without potentially hiding issues elsewhere.

I have also pushed a commit to artdaq:feature/SWIGBindingForMetricsAndTRACEMEssages which removes the compile flags from the top-level CMakeLists.txt.

#4 Updated by John Freeman 5 months ago

  • Status changed from Resolved to Reviewed

Marking this issue reviewed because:

-With Eric's changes, I was still able to recreate my successful python_artdaq test as described in point 1 of my 12/30/2019 comment
-As discussed in today's artdaq meeting, the failure of the Node.js is not a concern unless someone requests this functionality in the future

#5 Updated by Eric Flumerfelt 5 months ago

  • Target version set to artdaq v3_07_02
  • Status changed from Reviewed to Closed


Also available in: Atom PDF