Adding fixes for slurm linking and uncommon slurm node attributes

This commit is contained in:
Ian Roddis
2021-09-11 00:00:21 -03:00
parent ff5a75abb0
commit 96c1928daf
3 changed files with 37 additions and 9 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -1,6 +1,9 @@
#include <iostream>
#include <filesystem>
#include <unistd.h>
#include <sys/types.h>
#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
#endif