Commit bd34b449 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

plugins/slurm: Add default values for plugin configuration

parent 05a3b6dc
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -27,13 +27,20 @@ find_package(Slurm REQUIRED)

add_library(slurm-plugin SHARED)

target_sources(slurm-plugin PRIVATE slurmadmcli.c)
get_target_property(SCORD_CTL_BIN scord-ctl SCORD_CTL_BINARY)

configure_file(defaults.h.in defaults.h @ONLY)

target_sources(
  slurm-plugin PRIVATE slurmadmcli.c ${CMAKE_CURRENT_BINARY_DIR}/defaults.h
)

target_include_directories(
  slurm-plugin
  PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
)

target_link_libraries(slurm-plugin PUBLIC Slurm::Slurm libscord)

set_target_properties(
+43 −0
Original line number Diff line number Diff line
/******************************************************************************
 * Copyright 2022-2023, Inria, France.
 * Copyright 2023, Barcelona Supercomputing Center (BSC), Spain.
 * All rights reserved.
 *
 * This software was partially supported by the EuroHPC-funded project ADMIRE
 *   (Project ID: 956748, https://www.admire-eurohpc.eu).
 *
 * This file is part of scord.
 *
 * scord is free software: you can redistribute it and/or modify
 * it under the terms of the Lesser GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * scord is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the Lesser GNU General Public License
 * along with scord.  If not, see <https://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 *****************************************************************************/

#ifndef SCORD_SLURM_PLUGIN_DEFAULTS_H
#define SCORD_SLURM_PLUGIN_DEFAULTS_H

// clang-format off

#define SCORD_PORT_DEFAULT     @SCORD_BIND_PORT@
#define SCORD_SERVER_DEFAULT   "@SCORD_TRANSPORT_PROTOCOL@://@SCORD_BIND_ADDRESS@:@SCORD_BIND_PORT@"
#define SCORD_PROTO_DEFAULT    "@SCORD_TRANSPORT_PROTOCOL@"

#define SCORDCTL_PROG_DEFAULT  "@SCORD_CTL_BIN@"
#define SCORDCTL_PROTO_DEFAULT SCORD_PROTO_DEFAULT
#define SCORDCTL_PORT_DEFAULT  @SCORD_CTL_BIND_PORT@
#define SCORDCTL_TMPDIR_DEFAULT "/tmp"

// clang-format on

#endif // SCORD_SLURM_PLUGIN_DEFAULTS_H
+2 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <slurm/spank.h>

#include "admire.h"
#include "defaults.h"

/**
 * Slurm SPANK plugin to handle the ADMIRE adhoc storage CLI. Options are
@@ -17,9 +18,6 @@
 *   characters, including NULL byte
 **/

#define SCORD_SERVER_DEFAULT "ofi+tcp://127.0.0.1:52000"
#define SCORD_PROTO_DEFAULT  "ofi+tcp"
#define SCORDCTL_BIN_DEFAULT  "scord-ctl"
#define ADHOCID_LEN  64
#define INT32_STR_LEN 16  /* 16 chars are enough to fit an int32 in decimal */

@@ -291,7 +289,7 @@ slurm_spank_local_user_init(spank_t sp, int ac, char **av)

	const char *scord_addr = SCORD_SERVER_DEFAULT;
	const char *scord_proto = SCORD_PROTO_DEFAULT;
	const char *scordctl_bin = SCORDCTL_BIN_DEFAULT;
	const char *scordctl_bin = SCORDCTL_PROG_DEFAULT;

	for (int i = 0; i < ac; i++) {
		if (!strncmp ("scord_addr=", av[i], 11)) {
+12 −0
Original line number Diff line number Diff line
@@ -44,4 +44,16 @@ target_link_libraries(
                    libscord_cxx_types fmt::fmt CLI11::CLI11 ryml::ryml
)

set(SCORD_CTL_BIN "${CMAKE_INSTALL_FULL_BINDIR}/scord-ctl")

define_property(
  TARGET PROPERTY SCORD_CTL_BINARY
  BRIEF_DOCS "Path to scord-ctl binary"
  FULL_DOCS "Path to scord-ctl binary"
)

set_target_properties(
  scord-ctl PROPERTIES SCORD_CTL_BINARY ${CMAKE_INSTALL_FULL_BINDIR}/scord-ctl
)

install(TARGETS scord-ctl DESTINATION ${CMAKE_INSTALL_BINDIR})