From 96c1928dafcb87a33d2d8a15bd60f817d2645207 Mon Sep 17 00:00:00 2001 From: Ian Roddis Date: Sat, 11 Sep 2021 00:00:21 -0300 Subject: [PATCH] Adding fixes for slurm linking and uncommon slurm node attributes --- CMakeLists.txt | 21 ++++++++++++++++++--- tests/CMakeLists.txt | 16 +++++++++++++--- tests/unit_executor_slurmexecutor.cpp | 9 ++++++--- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9f785e..59c282a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,14 +17,15 @@ include(cmake/Catch2.cmake) option(DAGGY_ENABLE_SLURM "add support for SLURM executor" ON) if (DAGGY_ENABLE_SLURM) - find_library(SLURM_LIB libslurm.a slurm REQUIRED) + find_library(SLURM_LIB libslurm.so libslurm.a slurm REQUIRED) find_path(SLURM_INCLUDE_DIR "slurm/slurm.h" REQUIRED) if (SLURM_LIB MATCHES ".*\.a") add_library(slurm STATIC IMPORTED) - else() + SET_TARGET_PROPERTIES(slurm PROPERTIES INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/") + else () add_library(slurm SHARED IMPORTED) - endif() + endif () set_target_properties(slurm PROPERTIES IMPORTED_LOCATION ${SLURM_LIB}) target_include_directories(slurm INTERFACE ${SLURM_INCLUDE_DIR}) @@ -32,6 +33,20 @@ if (DAGGY_ENABLE_SLURM) target_link_libraries(slurm INTERFACE dl resolv) endif () + +# use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + add_subdirectory(daggy) add_subdirectory(tests) add_subdirectory(utils) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4b1a0f0..d011de8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,15 @@ project(tests) -file(GLOB UNIT_TESTS unit_*.cpp) -file(GLOB INTEGRATION_TESTS int_*.cpp) -add_executable(tests main.cpp ${UNIT_TESTS} ${INTEGRATION_TESTS}) +add_executable(tests main.cpp + # unit tests + unit_dag.cpp + unit_dagrun_loggers.cpp + unit_executor_forkingexecutor.cpp + unit_executor_slurmexecutor.cpp + unit_serialization.cpp + unit_server.cpp + unit_threadpool.cpp + unit_utilities.cpp + # integration tests + int_basic.cpp + ) target_link_libraries(tests libdaggy stdc++fs Catch2::Catch2) \ No newline at end of file diff --git a/tests/unit_executor_slurmexecutor.cpp b/tests/unit_executor_slurmexecutor.cpp index 9bcade1..c74f617 100644 --- a/tests/unit_executor_slurmexecutor.cpp +++ b/tests/unit_executor_slurmexecutor.cpp @@ -1,6 +1,9 @@ #include #include +#include +#include + #include "daggy/executors/task/SlurmTaskExecutor.hpp" #include "daggy/Serialization.hpp" #include "daggy/Utilities.hpp" @@ -17,10 +20,10 @@ TEST_CASE("slurm_execution", "[slurm_executor]") { daggy::ConfigValues defaultJobValues{ {"minCPUs", "1"}, {"minMemoryMB", "100"}, - {"minTmpDiskMB", "10"}, + {"minTmpDiskMB", "0"}, {"priority", "1"}, {"timeLimitSeconds", "200"}, - {"userID", "1002"}, + {"userID", std::to_string(getuid())}, {"workDir", fs::current_path().string()}, {"tmpDir", fs::current_path().string()} }; @@ -102,4 +105,4 @@ TEST_CASE("slurm_execution", "[slurm_executor]") { REQUIRE(tasks.size() == 4); } } -#endif \ No newline at end of file +#endif