Commit 2ecc30b8 authored by Ramon Nou's avatar Ramon Nou
Browse files

added mtime parameter

parent 2859ca28
Loading
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ struct cargo_config {
    std::string address;
    std::uint64_t blocksize;
    std::string REGEX_file;
    int mtime_threshold;
};

cargo_config
@@ -84,6 +85,13 @@ parse_command_line(int argc, char* argv[]) {
            ->option_text("BLOCKSIZE")
            ->default_val(512);

    app.add_option("-T,--mtime-threshold", cfg.mtime_threshold,
                   "Minimum age (in seconds) of a file's modification time "
                   "to be considered for transfer. Defaults to 1 second.")
            ->option_text("SECONDS")
            ->default_val(1)
            ->check(CLI::NonNegativeNumber); // Ensure it's not negative

    app.add_flag_function(
            "-v,--version",
            [&](auto /*count*/) {
@@ -127,7 +135,7 @@ main(int argc, char* argv[]) {
        if(const auto rank = world.rank(); rank == 0) {
            cargo::master_server srv{cfg.progname,  cfg.address,
                                     cfg.daemonize, fs::current_path(),
                                     cfg.blocksize, cfg.REGEX_file};
                                     cfg.blocksize, cfg.REGEX_file, cfg.mtime_threshold};

            if(cfg.output_file) {
                srv.configure_logger(logger::logger_type::file,
+6 −5
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ namespace cargo {
master_server::master_server(std::string name, std::string address,
                             bool daemonize, std::filesystem::path rundir,
                             std::uint64_t block_size, std::string regex_file,
                             int mtime_threshold,
                             std::optional<std::filesystem::path> pidfile)
    : server(std::move(name), std::move(address), daemonize, std::move(rundir),
             std::move(block_size), std::move(pidfile)),
@@ -110,12 +111,12 @@ master_server::master_server(std::string name, std::string address,
              [this]() { mpi_listener_ult(); })),
      m_ftio_listener_ess(thallium::xstream::create()),
      m_ftio_listener_ult(m_ftio_listener_ess->make_thread(
              [this]() { ftio_scheduling_ult(); }))
              [this]() { ftio_scheduling_ult(); })),
              m_block_size(block_size), 
              REGEX_file(std::move(regex_file)), 
              m_mtime_threshold(mtime_threshold)

{
    m_block_size = block_size;
    REGEX_file = regex_file;


#define EXPAND(rpc_name) #rpc_name##s, &master_server::rpc_name
    provider::define(EXPAND(ping));
@@ -383,7 +384,7 @@ master_server::transfer_dataset_internal(pending_transfer& pt) {
    std::vector<cargo::dataset> v_d_new;
    std::vector<std::size_t> v_size_new;
    time_t now = time(0);
    now = now - 1; // Threshold for mtime
    now = now - m_mtime_threshold; // Threshold for mtime
    for(auto i = 0u; i < pt.m_sources.size(); ++i) {

        const auto& s = pt.m_sources[i];
+3 −1
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@ class master_server : public network::server,
                      public network::provider<master_server> {
public:
    master_server(std::string name, std::string address, bool daemonize,
                  std::filesystem::path rundir, std::uint64_t block_size, std::string regex_file,
                  std::filesystem::path rundir, std::uint64_t block_size,
                  std::string regex_file, int mtime_threshold,
                  std::optional<std::filesystem::path> pidfile = {});

    ~master_server();
@@ -121,6 +122,7 @@ private:
    // Request manager
    request_manager m_request_manager;
    std::string REGEX_file;
    int m_mtime_threshold;
};

} // namespace cargo