From 546f53cb1baad16a0afc10d0a8a7768b9935609d Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Sun, 8 Oct 2023 00:11:27 +0200 Subject: [PATCH] #2183: Use env variables for LDMS inputs instead of hardcoded values --- ci/docker/ubuntu-gnu-cpp.dockerfile | 4 ++++ src/vt/vrt/collection/balance/node_lb_data.cc | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ci/docker/ubuntu-gnu-cpp.dockerfile b/ci/docker/ubuntu-gnu-cpp.dockerfile index 5b15325ea6..04bb9be4f2 100644 --- a/ci/docker/ubuntu-gnu-cpp.dockerfile +++ b/ci/docker/ubuntu-gnu-cpp.dockerfile @@ -94,6 +94,10 @@ RUN if test ${zoltan_enabled} -eq 1; then \ ENV VT_LDMS_INCLUDES_DIR="/ovis/LDMS_install/include" ENV VT_LDMS_LIBS_DIR="/ovis/LDMS_install/lib" +ENV VT_LDMS_XPTR="sock" +ENV VT_LDMS_AUTH="none" +ENV VT_LDMS_HOSTNAME="localhost" +ENV VT_LDMS_PORT="10444" COPY ./ci/deps/ldms.sh ldms.sh RUN if test ${ldms_enabled} -eq 1; then \ diff --git a/src/vt/vrt/collection/balance/node_lb_data.cc b/src/vt/vrt/collection/balance/node_lb_data.cc index afd230d6d5..32218e7221 100644 --- a/src/vt/vrt/collection/balance/node_lb_data.cc +++ b/src/vt/vrt/collection/balance/node_lb_data.cc @@ -156,10 +156,14 @@ void NodeLBData::initialize() { #endif #if vt_check_enabled(ldms) - ldms_ = ldms_xprt_new_with_auth("sock", "none", NULL); + const auto xPtr = getenv("VT_LDMS_XPTR"); + const auto auth = getenv("VT_LDMS_AUTH"); + ldms_ = ldms_xprt_new_with_auth(xPtr, auth, NULL); vtWarnIf(ldms_, "ldms_xprt_new_with_auth failed!"); - const auto returnCode = ldms_xprt_connect_by_name(ldms_, "localhost", "10444", NULL, NULL); + const auto hostname = getenv("VT_LDMS_HOSTNAME"); + const auto port = getenv("VT_LDMS_PORT"); + const auto returnCode = ldms_xprt_connect_by_name(ldms_, hostname, port, NULL, NULL); vtWarnIf(returnCode == 0, fmt::format("ldms_xprt_connect_by_name failed with code {} \n", returnCode)); #endif }