Commit b5b4680e authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch 'rnou/cargo_scheduler' into 'main'

Transfer Manager to store scheduling info

Solves partially #143 
Also updates spdlog and fmt, to reduce issues with newer compilers.

See merge request !104
parents 4c72718e 924e62f1
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building {fmt}")
FetchContent_Declare(
  fmt
  GIT_REPOSITORY https://github.com/fmtlib/fmt
  GIT_TAG d141cdbeb0fb422a3fb7173b285fd38e0d1772dc # v8.0.1
  GIT_TAG a33701196adfad74917046096bf5a2aa0ab0bb50 # v9.1.0
  GIT_SHALLOW ON
  GIT_PROGRESS ON
)
@@ -226,7 +226,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building spdlog")
FetchContent_Declare(
  spdlog
  GIT_REPOSITORY https://github.com/gabime/spdlog
  GIT_TAG eb3220622e73a4889eee355ffa37972b3cac3df5 # v1.9.2
  GIT_TAG 7e635fca68d014934b4af8a1cf874f63989352b7 # v1.12.0
  GIT_SHALLOW ON
  GIT_PROGRESS ON
)
@@ -280,7 +280,7 @@ if (SCORD_BUILD_TESTS)
  FetchContent_Declare(
    Catch2
    GIT_REPOSITORY https://github.com/catchorg/Catch2.git
    GIT_TAG 605a34765aa5d5ecbf476b4598a862ada971b0cc # v3.0.1
    GIT_TAG 6e79e682b726f524310d55dec8ddac4e9c52fb5f # v3.4.0
    GIT_SHALLOW ON
    GIT_PROGRESS ON
  )
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ RPC_NAMES = {
    'ADM_remove_pfs_storage',
    'ADM_transfer_datasets', 'ADM_get_transfer_priority',
    'ADM_set_transfer_priority', 'ADM_cancel_transfer',
    'ADM_get_pending_transfers',
    'ADM_get_pending_transfers', 'ADM_transfer_update',
    'ADM_set_qos_constraints', 'ADM_get_qos_constraints',
    'ADM_define_data_operation', 'ADM_connect_data_operation',
    'ADM_finalize_data_operation',
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ list(APPEND c_examples_without_controller

add_library(c_examples_common STATIC)
target_sources(c_examples_common PUBLIC common.h PRIVATE common.c)
target_link_libraries(c_examples_common libscord_c_types)
target_link_libraries(c_examples_common libscord_c_types spdlog::spdlog fmt::fmt)

foreach(example IN LISTS c_examples_with_controller c_examples_without_controller)
  add_executable(${example}_c)
+95 −0
Original line number Diff line number Diff line
/******************************************************************************
 * Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain
 *
 * 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 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 GNU General Public License
 * along with scord.  If not, see <https://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *****************************************************************************/

#include <fmt/format.h>
#include <scord/scord.hpp>
#include "common.hpp"

#define NJOB_NODES   50
#define NADHOC_NODES 25
#define NINPUTS      10
#define NOUTPUTS     5
#define NSOURCES     5
#define NTARGETS     5
#define NLIMITS      4

int
main(int argc, char* argv[]) {

    test_info test_info{
            .name = TESTNAME,
            .requires_server = true,
            .requires_controller = true,
            .requires_data_stager = true,
    };

    const auto cli_args = process_args(argc, argv, test_info);

    scord::server server{"tcp", cli_args.server_address};

    const auto job_nodes = prepare_nodes(NJOB_NODES);
    const auto adhoc_nodes = prepare_nodes(NADHOC_NODES);
    const auto inputs = prepare_routes("{}-input-dataset-{}", NINPUTS);
    const auto outputs = prepare_routes("{}-output-dataset-{}", NOUTPUTS);
    const auto expected_outputs =
            prepare_routes("{}-exp-output-dataset-{}", NEXPOUTPUTS);

    const auto sources = prepare_datasets("source-dataset-{}", NSOURCES);
    const auto targets = prepare_datasets("target-dataset-{}", NTARGETS);
    const auto qos_limits = prepare_qos_limits(NLIMITS);
    const auto mapping = scord::transfer::mapping::n_to_n;

    std::string name = "adhoc_storage_42";
    const auto adhoc_storage_ctx = scord::adhoc_storage::ctx{
            cli_args.controller_address,
            cli_args.data_stager_address,
            scord::adhoc_storage::execution_mode::separate_new,
            scord::adhoc_storage::access_type::read_write,
            100,
            false};
    const auto adhoc_resources = scord::adhoc_storage::resources{adhoc_nodes};

    try {
        const auto adhoc_storage = scord::register_adhoc_storage(
                server, name, scord::adhoc_storage::type::gekkofs,
                adhoc_storage_ctx, adhoc_resources);

        scord::job::requirements reqs(inputs, outputs, expected_outputs,
                                      adhoc_storage);

        const auto job = scord::register_job(
                server, scord::job::resources{job_nodes}, reqs, 0);
        const auto transfer = scord::transfer_datasets(
                server, job, sources, targets, qos_limits, mapping);

        scord::transfer_update(server, transfer.id(), 10.0f);
        fmt::print(stdout, "ADM_transfer_update() remote procedure completed "
                           "successfully\n");
        exit(EXIT_SUCCESS);
    } catch(const std::exception& e) {
        fmt::print(stderr, "FATAL: ADM_transfer_update() failed: {}\n",
                   e.what());
        exit(EXIT_FAILURE);
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ list(APPEND cxx_examples_with_controller
  ADM_deploy_adhoc_storage ADM_terminate_adhoc_storage
  # transfers
  ADM_transfer_datasets ADM_get_transfer_priority ADM_set_transfer_priority
  ADM_cancel_transfer ADM_get_pending_transfers
  ADM_cancel_transfer ADM_get_pending_transfers ADM_transfer_update
  # qos
  ADM_set_qos_constraints ADM_get_qos_constraints
  # data operations
@@ -56,7 +56,7 @@ foreach(example IN LISTS cxx_examples_with_controller cxx_examples_without_contr
  add_executable(${example}_cxx)
  target_sources(${example}_cxx PRIVATE ${example}.cpp)
  target_link_libraries(${example}_cxx
    PUBLIC fmt::fmt libscord cxx_examples_common)
    PUBLIC fmt::fmt spdlog::spdlog libscord cxx_examples_common)
  set_target_properties(${example}_cxx PROPERTIES OUTPUT_NAME ${example})
endforeach()

Loading