Loading .gitlab-ci.yml +1 −1 Original line number Diff line number Diff line # Compilation of scord and execution of tests image: bscstorage/scord:0.3.0 image: bscstorage/scord:0.4.0-wip stages: - build Loading CMakeLists.txt +11 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,12 @@ set(SCORD_CTL_BIND_PORT ) message(STATUS "[${PROJECT_NAME}] server bind port: ${SCORD_CTL_BIND_PORT}") set(CARGO_PORT "62000" CACHE STRING "Define the port through wich we should commmunicate with Cargo" ) option(SCORD_BUILD_EXAMPLES "Build examples (disabled by default)" OFF) option(SCORD_BUILD_TESTS "Build tests (disabled by default)" OFF) Loading Loading @@ -299,6 +305,10 @@ mark_variables_as_advanced(REGEX "^(FETCHCONTENT|fmt|FMT|spdlog|SPDLOG)_.*$") message(STATUS "[${PROJECT_NAME}] Checking for Redis Plus Plus") find_package(RedisPlusPlus 1.3.3 REQUIRED) ### Cargo: required for transferring datasets between storage tiers message(STATUS "[${PROJECT_NAME}] Checking for Cargo") find_package(Cargo 0.2.0 REQUIRED) # ############################################################################## # Process subdirectories Loading @@ -309,6 +319,7 @@ add_compile_options("-Wall" "-Wextra" "-Werror" "$<$<CONFIG:RELEASE>:-O3>") add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:SCORD_DEBUG_BUILD>") add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:LOGGER_ENABLE_DEBUG>") add_subdirectory(cli) add_subdirectory(etc) add_subdirectory(src) add_subdirectory(plugins) Loading README.md +4 −4 Original line number Diff line number Diff line Loading @@ -295,12 +295,12 @@ Which should produce output similar to the following: [2021-11-19 10:30:30.066151] [scord] [131119] [info] [2021-11-19 10:30:30.066161] [scord] [131119] [info] [[ Start up successful, awaiting requests... ]] ``` Now we can use one of the example programs to send a `ping` RPC to Scord: ```bash Now we can use the `scord_ping` CLI program packaged with the service to send a `ping` RPC to Scord: cd $HOME/scord/build/examples ./ADM_ping ofi+tcp://192.168.0.111:52000 ```bash scord_ping ofi+tcp://192.168.0.111:52000 ``` And the server logs should update with an entry similar the following one: Loading cli/CMakeLists.txt 0 → 100644 +58 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021-2023, 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 # ################################################################################ # scord_ping: ping a remote scord server add_executable(scord_ping) target_sources(scord_ping PRIVATE scord_ping.cpp ) target_link_libraries(scord_ping PUBLIC fmt::fmt CLI11::CLI11 libscord) install(TARGETS scord_ping RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) # scord_query: query a remote scord server add_executable(scord_query) target_sources(scord_query PRIVATE scord_query.cpp ) target_link_libraries(scord_query PUBLIC fmt::fmt CLI11::CLI11 libscord) install(TARGETS scord_query RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) set_target_properties( scord_query PROPERTIES __INSTALLED_PATH ${CMAKE_INSTALL_FULL_BINDIR}/scord_query ) cli/scord_ping.cpp 0 → 100644 +83 −0 Original line number Diff line number Diff line /****************************************************************************** * Copyright 2021-2023, 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 <filesystem> #include <CLI/CLI.hpp> #include <scord/scord.hpp> struct ping_config { std::string progname; std::string server_address; }; ping_config parse_command_line(int argc, char* argv[]) { ping_config cfg; cfg.progname = std::filesystem::path{argv[0]}.filename().string(); CLI::App app{"Scord ping client", cfg.progname}; app.add_option("-s,--server", cfg.server_address, "Server address") ->option_text("ADDRESS") ->required(); try { app.parse(argc, argv); return cfg; } catch(const CLI::ParseError& ex) { std::exit(app.exit(ex)); } } auto parse_address(const std::string& address) { const auto pos = address.find("://"); if(pos == std::string::npos) { throw std::runtime_error(fmt::format("Invalid address: {}", address)); } const auto protocol = address.substr(0, pos); return std::make_pair(protocol, address); } int main(int argc, char* argv[]) { using namespace std::chrono_literals; ping_config cfg = parse_command_line(argc, argv); try { const auto [protocol, address] = parse_address(cfg.server_address); ping(scord::server{protocol, address}); fmt::print("Ping succeeded!\n"); } catch(const std::exception& ex) { fmt::print(stderr, "Ping failed: {}\n", ex.what()); return EXIT_FAILURE; } } Loading
.gitlab-ci.yml +1 −1 Original line number Diff line number Diff line # Compilation of scord and execution of tests image: bscstorage/scord:0.3.0 image: bscstorage/scord:0.4.0-wip stages: - build Loading
CMakeLists.txt +11 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,12 @@ set(SCORD_CTL_BIND_PORT ) message(STATUS "[${PROJECT_NAME}] server bind port: ${SCORD_CTL_BIND_PORT}") set(CARGO_PORT "62000" CACHE STRING "Define the port through wich we should commmunicate with Cargo" ) option(SCORD_BUILD_EXAMPLES "Build examples (disabled by default)" OFF) option(SCORD_BUILD_TESTS "Build tests (disabled by default)" OFF) Loading Loading @@ -299,6 +305,10 @@ mark_variables_as_advanced(REGEX "^(FETCHCONTENT|fmt|FMT|spdlog|SPDLOG)_.*$") message(STATUS "[${PROJECT_NAME}] Checking for Redis Plus Plus") find_package(RedisPlusPlus 1.3.3 REQUIRED) ### Cargo: required for transferring datasets between storage tiers message(STATUS "[${PROJECT_NAME}] Checking for Cargo") find_package(Cargo 0.2.0 REQUIRED) # ############################################################################## # Process subdirectories Loading @@ -309,6 +319,7 @@ add_compile_options("-Wall" "-Wextra" "-Werror" "$<$<CONFIG:RELEASE>:-O3>") add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:SCORD_DEBUG_BUILD>") add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:LOGGER_ENABLE_DEBUG>") add_subdirectory(cli) add_subdirectory(etc) add_subdirectory(src) add_subdirectory(plugins) Loading
README.md +4 −4 Original line number Diff line number Diff line Loading @@ -295,12 +295,12 @@ Which should produce output similar to the following: [2021-11-19 10:30:30.066151] [scord] [131119] [info] [2021-11-19 10:30:30.066161] [scord] [131119] [info] [[ Start up successful, awaiting requests... ]] ``` Now we can use one of the example programs to send a `ping` RPC to Scord: ```bash Now we can use the `scord_ping` CLI program packaged with the service to send a `ping` RPC to Scord: cd $HOME/scord/build/examples ./ADM_ping ofi+tcp://192.168.0.111:52000 ```bash scord_ping ofi+tcp://192.168.0.111:52000 ``` And the server logs should update with an entry similar the following one: Loading
cli/CMakeLists.txt 0 → 100644 +58 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021-2023, 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 # ################################################################################ # scord_ping: ping a remote scord server add_executable(scord_ping) target_sources(scord_ping PRIVATE scord_ping.cpp ) target_link_libraries(scord_ping PUBLIC fmt::fmt CLI11::CLI11 libscord) install(TARGETS scord_ping RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) # scord_query: query a remote scord server add_executable(scord_query) target_sources(scord_query PRIVATE scord_query.cpp ) target_link_libraries(scord_query PUBLIC fmt::fmt CLI11::CLI11 libscord) install(TARGETS scord_query RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) set_target_properties( scord_query PROPERTIES __INSTALLED_PATH ${CMAKE_INSTALL_FULL_BINDIR}/scord_query )
cli/scord_ping.cpp 0 → 100644 +83 −0 Original line number Diff line number Diff line /****************************************************************************** * Copyright 2021-2023, 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 <filesystem> #include <CLI/CLI.hpp> #include <scord/scord.hpp> struct ping_config { std::string progname; std::string server_address; }; ping_config parse_command_line(int argc, char* argv[]) { ping_config cfg; cfg.progname = std::filesystem::path{argv[0]}.filename().string(); CLI::App app{"Scord ping client", cfg.progname}; app.add_option("-s,--server", cfg.server_address, "Server address") ->option_text("ADDRESS") ->required(); try { app.parse(argc, argv); return cfg; } catch(const CLI::ParseError& ex) { std::exit(app.exit(ex)); } } auto parse_address(const std::string& address) { const auto pos = address.find("://"); if(pos == std::string::npos) { throw std::runtime_error(fmt::format("Invalid address: {}", address)); } const auto protocol = address.substr(0, pos); return std::make_pair(protocol, address); } int main(int argc, char* argv[]) { using namespace std::chrono_literals; ping_config cfg = parse_command_line(argc, argv); try { const auto [protocol, address] = parse_address(cfg.server_address); ping(scord::server{protocol, address}); fmt::print("Ping succeeded!\n"); } catch(const std::exception& ex) { fmt::print(stderr, "Ping failed: {}\n", ex.what()); return EXIT_FAILURE; } }