From d0645f6b695c831f81029c359468414a8e4a947b Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Sat, 18 Feb 2023 21:14:36 +0100 Subject: [PATCH 1/4] Add job::requirements class --- src/lib/scord/types.hpp | 420 ++++++++++++++++++++++------------------ src/lib/types.cpp | 47 +++++ 2 files changed, 274 insertions(+), 193 deletions(-) diff --git a/src/lib/scord/types.hpp b/src/lib/scord/types.hpp index 86aa6f19..ae49d782 100644 --- a/src/lib/scord/types.hpp +++ b/src/lib/scord/types.hpp @@ -168,6 +168,200 @@ private: }; struct job_requirements; +struct dataset; + +struct adhoc_storage { + + enum class type : std::underlying_type::type { + gekkofs = ADM_ADHOC_STORAGE_GEKKOFS, + dataclay = ADM_ADHOC_STORAGE_DATACLAY, + expand = ADM_ADHOC_STORAGE_EXPAND, + hercules = ADM_ADHOC_STORAGE_HERCULES, + }; + + enum class execution_mode : std::underlying_type::type { + in_job_shared = ADM_ADHOC_MODE_IN_JOB_SHARED, + in_job_dedicated = ADM_ADHOC_MODE_IN_JOB_DEDICATED, + separate_new = ADM_ADHOC_MODE_SEPARATE_NEW, + separate_existing = ADM_ADHOC_MODE_SEPARATE_EXISTING + }; + + enum class access_type : std::underlying_type::type { + read_only = ADM_ADHOC_ACCESS_RDONLY, + write_only = ADM_ADHOC_ACCESS_WRONLY, + read_write = ADM_ADHOC_ACCESS_RDWR, + }; + + struct resources { + resources() = default; + explicit resources(std::vector nodes); + explicit resources(ADM_adhoc_resources_t res); + explicit operator ADM_adhoc_resources_t() const; + + std::vector + nodes() const; + + template + void + serialize(Archive&& ar) { + ar& m_nodes; + } + + private: + std::vector m_nodes; + }; + + struct ctx { + + ctx() = default; + + ctx(execution_mode exec_mode, access_type access_type, + adhoc_storage::resources resources, std::uint32_t walltime, + bool should_flush); + + explicit ctx(ADM_adhoc_context_t ctx); + explicit operator ADM_adhoc_context_t() const; + + execution_mode + exec_mode() const; + enum access_type + access_type() const; + adhoc_storage::resources + resources() const; + std::uint32_t + walltime() const; + bool + should_flush() const; + + template + void + serialize(Archive&& ar) { + ar& m_exec_mode; + ar& m_access_type; + ar& m_resources; + ar& m_walltime; + ar& m_should_flush; + } + + private: + execution_mode m_exec_mode; + enum access_type m_access_type; + adhoc_storage::resources m_resources; + std::uint32_t m_walltime; + bool m_should_flush; + }; + + adhoc_storage(); + adhoc_storage(enum adhoc_storage::type type, std::string name, + std::uint64_t id, execution_mode exec_mode, + access_type access_type, adhoc_storage::resources res, + std::uint32_t walltime, bool should_flush); + explicit adhoc_storage(ADM_adhoc_storage_t storage); + explicit operator ADM_adhoc_storage_t() const; + adhoc_storage(enum adhoc_storage::type type, std::string name, + std::uint64_t id, const scord::adhoc_storage::ctx& ctx); + + adhoc_storage(const adhoc_storage& other) noexcept; + adhoc_storage(adhoc_storage&&) noexcept; + adhoc_storage& + operator=(const adhoc_storage&) noexcept; + adhoc_storage& + operator=(adhoc_storage&&) noexcept; + ~adhoc_storage(); + + std::string + name() const; + type + type() const; + std::uint64_t + id() const; + adhoc_storage::ctx + context() const; + + void + update(scord::adhoc_storage::ctx new_ctx); + + // The implementation for this must be deferred until + // after the declaration of the PIMPL class + template + void + serialize(Archive& ar); + +private: + class impl; + std::unique_ptr m_pimpl; +}; + +struct pfs_storage { + + enum class type : std::underlying_type::type { + lustre = ADM_PFS_STORAGE_LUSTRE, + gpfs = ADM_PFS_STORAGE_GPFS + }; + + struct ctx { + + ctx() = default; + + explicit ctx(std::filesystem::path mount_point); + + explicit ctx(ADM_pfs_context_t ctx); + explicit operator ADM_pfs_context_t() const; + + std::filesystem::path + mount_point() const; + + template + void + serialize(Archive&& ar) { + ar& m_mount_point; + } + + private: + std::filesystem::path m_mount_point; + }; + + pfs_storage(); + + pfs_storage(enum pfs_storage::type type, std::string name, std::uint64_t id, + std::filesystem::path mount_point); + + pfs_storage(enum pfs_storage::type type, std::string name, std::uint64_t id, + const pfs_storage::ctx& pfs_ctx); + + explicit pfs_storage(ADM_pfs_storage_t storage); + explicit operator ADM_pfs_storage_t() const; + + pfs_storage(const pfs_storage& other) noexcept; + pfs_storage(pfs_storage&&) noexcept; + pfs_storage& + operator=(const pfs_storage& other) noexcept; + pfs_storage& + operator=(pfs_storage&&) noexcept; + ~pfs_storage(); + + std::string + name() const; + type + type() const; + std::uint64_t + id() const; + pfs_storage::ctx + context() const; + + void + update(scord::pfs_storage::ctx new_ctx); + + // The implementation for this must be deferred until + // after the declaration of the PIMPL class + template + void + serialize(Archive& ar); + +private: + class impl; + std::unique_ptr m_pimpl; +}; struct job { @@ -189,6 +383,39 @@ struct job { std::vector m_nodes; }; + struct requirements { + + requirements(); + requirements(std::vector inputs, + std::vector outputs); + requirements(std::vector inputs, + std::vector outputs, + scord::adhoc_storage adhoc_storage); + explicit requirements(ADM_job_requirements_t reqs); + + std::vector + inputs() const; + std::vector + outputs() const; + std::optional + adhoc_storage() const; + + // The implementation for this must be deferred until + // after the declaration of the PIMPL class + template + void + serialize(Archive& ar) { + ar& m_inputs; + ar& m_outputs; + ar& m_adhoc_storage; + } + + private: + std::vector m_inputs; + std::vector m_outputs; + std::optional m_adhoc_storage; + }; + job(); job(job_id id, slurm_job_id slurm_id); explicit job(ADM_job_t job); @@ -367,199 +594,6 @@ private: std::unique_ptr m_pimpl; }; -struct adhoc_storage { - - enum class type : std::underlying_type::type { - gekkofs = ADM_ADHOC_STORAGE_GEKKOFS, - dataclay = ADM_ADHOC_STORAGE_DATACLAY, - expand = ADM_ADHOC_STORAGE_EXPAND, - hercules = ADM_ADHOC_STORAGE_HERCULES, - }; - - enum class execution_mode : std::underlying_type::type { - in_job_shared = ADM_ADHOC_MODE_IN_JOB_SHARED, - in_job_dedicated = ADM_ADHOC_MODE_IN_JOB_DEDICATED, - separate_new = ADM_ADHOC_MODE_SEPARATE_NEW, - separate_existing = ADM_ADHOC_MODE_SEPARATE_EXISTING - }; - - enum class access_type : std::underlying_type::type { - read_only = ADM_ADHOC_ACCESS_RDONLY, - write_only = ADM_ADHOC_ACCESS_WRONLY, - read_write = ADM_ADHOC_ACCESS_RDWR, - }; - - struct resources { - resources() = default; - explicit resources(std::vector nodes); - explicit resources(ADM_adhoc_resources_t res); - explicit operator ADM_adhoc_resources_t() const; - - std::vector - nodes() const; - - template - void - serialize(Archive&& ar) { - ar& m_nodes; - } - - private: - std::vector m_nodes; - }; - - struct ctx { - - ctx() = default; - - ctx(execution_mode exec_mode, access_type access_type, - adhoc_storage::resources resources, std::uint32_t walltime, - bool should_flush); - - explicit ctx(ADM_adhoc_context_t ctx); - explicit operator ADM_adhoc_context_t() const; - - execution_mode - exec_mode() const; - enum access_type - access_type() const; - adhoc_storage::resources - resources() const; - std::uint32_t - walltime() const; - bool - should_flush() const; - - template - void - serialize(Archive&& ar) { - ar& m_exec_mode; - ar& m_access_type; - ar& m_resources; - ar& m_walltime; - ar& m_should_flush; - } - - private: - execution_mode m_exec_mode; - enum access_type m_access_type; - adhoc_storage::resources m_resources; - std::uint32_t m_walltime; - bool m_should_flush; - }; - - adhoc_storage(); - adhoc_storage(enum adhoc_storage::type type, std::string name, - std::uint64_t id, execution_mode exec_mode, - access_type access_type, adhoc_storage::resources res, - std::uint32_t walltime, bool should_flush); - explicit adhoc_storage(ADM_adhoc_storage_t storage); - explicit operator ADM_adhoc_storage_t() const; - adhoc_storage(enum adhoc_storage::type type, std::string name, - std::uint64_t id, const scord::adhoc_storage::ctx& ctx); - - adhoc_storage(const adhoc_storage& other) noexcept; - adhoc_storage(adhoc_storage&&) noexcept; - adhoc_storage& - operator=(const adhoc_storage&) noexcept; - adhoc_storage& - operator=(adhoc_storage&&) noexcept; - ~adhoc_storage(); - - std::string - name() const; - type - type() const; - std::uint64_t - id() const; - adhoc_storage::ctx - context() const; - - void - update(scord::adhoc_storage::ctx new_ctx); - - // The implementation for this must be deferred until - // after the declaration of the PIMPL class - template - void - serialize(Archive& ar); - -private: - class impl; - std::unique_ptr m_pimpl; -}; - -struct pfs_storage { - - enum class type : std::underlying_type::type { - lustre = ADM_PFS_STORAGE_LUSTRE, - gpfs = ADM_PFS_STORAGE_GPFS - }; - - struct ctx { - - ctx() = default; - - explicit ctx(std::filesystem::path mount_point); - - explicit ctx(ADM_pfs_context_t ctx); - explicit operator ADM_pfs_context_t() const; - - std::filesystem::path - mount_point() const; - - template - void - serialize(Archive&& ar) { - ar& m_mount_point; - } - - private: - std::filesystem::path m_mount_point; - }; - - pfs_storage(); - - pfs_storage(enum pfs_storage::type type, std::string name, std::uint64_t id, - std::filesystem::path mount_point); - - pfs_storage(enum pfs_storage::type type, std::string name, std::uint64_t id, - const pfs_storage::ctx& pfs_ctx); - - explicit pfs_storage(ADM_pfs_storage_t storage); - explicit operator ADM_pfs_storage_t() const; - - pfs_storage(const pfs_storage& other) noexcept; - pfs_storage(pfs_storage&&) noexcept; - pfs_storage& - operator=(const pfs_storage& other) noexcept; - pfs_storage& - operator=(pfs_storage&&) noexcept; - ~pfs_storage(); - - std::string - name() const; - type - type() const; - std::uint64_t - id() const; - pfs_storage::ctx - context() const; - - void - update(scord::pfs_storage::ctx new_ctx); - - // The implementation for this must be deferred until - // after the declaration of the PIMPL class - template - void - serialize(Archive& ar); - -private: - class impl; - std::unique_ptr m_pimpl; -}; - struct job_requirements { job_requirements(); diff --git a/src/lib/types.cpp b/src/lib/types.cpp index abbd67bf..f546259d 100644 --- a/src/lib/types.cpp +++ b/src/lib/types.cpp @@ -215,6 +215,53 @@ private: slurm_job_id m_slurm_job_id; }; +job::requirements::requirements() = default; + +job::requirements::requirements(std::vector inputs, + std::vector outputs) + : m_inputs(std::move(inputs)), m_outputs(std::move(outputs)) {} + +job::requirements::requirements(std::vector inputs, + std::vector outputs, + scord::adhoc_storage adhoc_storage) + : m_inputs(std::move(inputs)), m_outputs(std::move(outputs)), + m_adhoc_storage(std::move(adhoc_storage)) {} + +job::requirements::requirements(ADM_job_requirements_t reqs) { + + m_inputs.reserve(reqs->r_inputs->l_length); + + for(size_t i = 0; i < reqs->r_inputs->l_length; ++i) { + m_inputs.emplace_back(reqs->r_inputs->l_datasets[i].d_id); + } + + m_outputs.reserve(reqs->r_outputs->l_length); + + for(size_t i = 0; i < reqs->r_outputs->l_length; ++i) { + m_outputs.emplace_back(reqs->r_outputs->l_datasets[i].d_id); + } + + if(reqs->r_adhoc_storage) { + m_adhoc_storage = scord::adhoc_storage(reqs->r_adhoc_storage); + } +} + +std::vector +job::requirements::inputs() const { + return m_inputs; +} + +std::vector +job::requirements::outputs() const { + return m_outputs; +} + +std::optional +job::requirements::adhoc_storage() const { + return m_adhoc_storage; +} + + job::resources::resources() = default; job::resources::resources(std::vector nodes) -- GitLab From 6d7691123b4bf263781c8fb7edd01b6b97a4e471 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Sat, 18 Feb 2023 21:16:38 +0100 Subject: [PATCH 2/4] Remove old job_requirements class --- src/lib/scord/types.hpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/lib/scord/types.hpp b/src/lib/scord/types.hpp index ae49d782..dffc21dc 100644 --- a/src/lib/scord/types.hpp +++ b/src/lib/scord/types.hpp @@ -167,7 +167,6 @@ private: std::unique_ptr m_pimpl; }; -struct job_requirements; struct dataset; struct adhoc_storage { @@ -594,46 +593,6 @@ private: std::unique_ptr m_pimpl; }; -struct job_requirements { - - job_requirements(); - - job_requirements(std::vector inputs, - std::vector outputs); - - job_requirements(std::vector inputs, - std::vector outputs, - scord::adhoc_storage adhoc_storage); - - explicit job_requirements(ADM_job_requirements_t reqs); - - job_requirements(const job_requirements&) noexcept; - job_requirements(job_requirements&&) noexcept; - job_requirements& - operator=(const job_requirements&) noexcept; - job_requirements& - operator=(job_requirements&&) noexcept; - - ~job_requirements(); - - std::vector - inputs() const; - std::vector - outputs() const; - std::optional - adhoc_storage() const; - - // The implementation for this must be deferred until - // after the declaration of the PIMPL class - template - void - serialize(Archive& ar); - -private: - class impl; - std::unique_ptr m_pimpl; -}; - } // namespace scord -- GitLab From d7a8fdd50ac2755460e5357e33cf74cc98258c22 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Sat, 18 Feb 2023 21:19:51 +0100 Subject: [PATCH 3/4] Replace usages of job_requirements with job::requirements --- examples/cxx/ADM_register_job.cpp | 2 +- examples/cxx/ADM_remove_job.cpp | 2 +- examples/cxx/ADM_transfer_datasets.cpp | 2 +- examples/cxx/ADM_update_job.cpp | 2 +- src/lib/c_wrapper.cpp | 2 +- src/lib/detail/impl.cpp | 2 +- src/lib/detail/impl.hpp | 2 +- src/lib/libscord.cpp | 6 +- src/lib/scord/scord.hpp | 3 +- src/lib/scord/types.hpp | 4 +- src/lib/types.cpp | 150 ------------------------- src/scord/internal_types.hpp | 6 +- src/scord/job_manager.hpp | 2 +- src/scord/rpc_handlers.cpp | 2 +- src/scord/rpc_handlers.hpp | 2 +- 15 files changed, 21 insertions(+), 168 deletions(-) diff --git a/examples/cxx/ADM_register_job.cpp b/examples/cxx/ADM_register_job.cpp index b9621752..634ed2ba 100644 --- a/examples/cxx/ADM_register_job.cpp +++ b/examples/cxx/ADM_register_job.cpp @@ -59,7 +59,7 @@ main(int argc, char* argv[]) { server, name, scord::adhoc_storage::type::gekkofs, adhoc_storage_ctx); - scord::job_requirements reqs(inputs, outputs, adhoc_storage); + scord::job::requirements reqs(inputs, outputs, adhoc_storage); [[maybe_unused]] const auto job = scord::register_job( server, scord::job::resources{job_nodes}, reqs, 0); diff --git a/examples/cxx/ADM_remove_job.cpp b/examples/cxx/ADM_remove_job.cpp index f4f4100f..ca3975f6 100644 --- a/examples/cxx/ADM_remove_job.cpp +++ b/examples/cxx/ADM_remove_job.cpp @@ -59,7 +59,7 @@ main(int argc, char* argv[]) { server, name, scord::adhoc_storage::type::gekkofs, adhoc_storage_ctx); - scord::job_requirements reqs(inputs, outputs, adhoc_storage); + scord::job::requirements reqs(inputs, outputs, adhoc_storage); [[maybe_unused]] const auto job = scord::register_job( server, scord::job::resources{job_nodes}, reqs, 0); diff --git a/examples/cxx/ADM_transfer_datasets.cpp b/examples/cxx/ADM_transfer_datasets.cpp index 393c3e39..56b5a24c 100644 --- a/examples/cxx/ADM_transfer_datasets.cpp +++ b/examples/cxx/ADM_transfer_datasets.cpp @@ -66,7 +66,7 @@ main(int argc, char* argv[]) { server, name, scord::adhoc_storage::type::gekkofs, adhoc_storage_ctx); - scord::job_requirements reqs(inputs, outputs, adhoc_storage); + scord::job::requirements reqs(inputs, outputs, adhoc_storage); const auto job = scord::register_job( server, scord::job::resources{job_nodes}, reqs, 0); diff --git a/examples/cxx/ADM_update_job.cpp b/examples/cxx/ADM_update_job.cpp index cf837e2b..581029cc 100644 --- a/examples/cxx/ADM_update_job.cpp +++ b/examples/cxx/ADM_update_job.cpp @@ -55,7 +55,7 @@ main(int argc, char* argv[]) { scord::adhoc_storage::access_type::read_write, scord::adhoc_storage::resources{adhoc_nodes}, 100, false}); - scord::job_requirements reqs{inputs, outputs, gkfs_storage}; + scord::job::requirements reqs{inputs, outputs, gkfs_storage}; const auto new_inputs = prepare_datasets("input-new-dataset-{}", NINPUTS); const auto new_outputs = diff --git a/src/lib/c_wrapper.cpp b/src/lib/c_wrapper.cpp index 8e9cd12a..c00d09f3 100644 --- a/src/lib/c_wrapper.cpp +++ b/src/lib/c_wrapper.cpp @@ -78,7 +78,7 @@ ADM_register_job(ADM_server_t server, ADM_job_resources_t res, const scord::server srv{server}; const auto rv = scord::detail::register_job(srv, scord::job::resources{res}, - scord::job_requirements{reqs}, + scord::job::requirements{reqs}, slurm_id); if(!rv) { diff --git a/src/lib/detail/impl.cpp b/src/lib/detail/impl.cpp index 2eaf848f..d197fb41 100644 --- a/src/lib/detail/impl.cpp +++ b/src/lib/detail/impl.cpp @@ -84,7 +84,7 @@ ping(const server& srv) { tl::expected register_job(const server& srv, const job::resources& job_resources, - const job_requirements& job_requirements, + const job::requirements& job_requirements, scord::slurm_job_id slurm_id) { scord::network::client rpc_client{srv.protocol()}; diff --git a/src/lib/detail/impl.hpp b/src/lib/detail/impl.hpp index 369b0836..d437b944 100644 --- a/src/lib/detail/impl.hpp +++ b/src/lib/detail/impl.hpp @@ -36,7 +36,7 @@ ping(const server& srv); tl::expected register_job(const server& srv, const job::resources& job_resources, - const job_requirements& job_requirements, + const job::requirements& job_requirements, scord::slurm_job_id slurm_id); scord::error_code diff --git a/src/lib/libscord.cpp b/src/lib/libscord.cpp index 3d80dd30..39e00510 100644 --- a/src/lib/libscord.cpp +++ b/src/lib/libscord.cpp @@ -210,9 +210,11 @@ ping(const server& srv) { scord::job register_job(const server& srv, const job::resources& resources, - const job_requirements& reqs, scord::slurm_job_id slurm_job_id) { + const job::requirements& job_requirements, + scord::slurm_job_id slurm_job_id) { - const auto rv = detail::register_job(srv, resources, reqs, slurm_job_id); + const auto rv = detail::register_job(srv, resources, job_requirements, + slurm_job_id); if(!rv) { throw std::runtime_error(fmt::format("ADM_register_job() error: {}", diff --git a/src/lib/scord/scord.hpp b/src/lib/scord/scord.hpp index 5a48f62f..d3642e28 100644 --- a/src/lib/scord/scord.hpp +++ b/src/lib/scord/scord.hpp @@ -48,7 +48,8 @@ ping(const server& srv); scord::job register_job(const server& srv, const job::resources& job_resources, - const job_requirements& reqs, scord::slurm_job_id slurm_id); + const job::requirements& job_requirements, + scord::slurm_job_id slurm_id); void update_job(const server& srv, const job&, const job::resources& job_resources); diff --git a/src/lib/scord/types.hpp b/src/lib/scord/types.hpp index dffc21dc..7978a1cd 100644 --- a/src/lib/scord/types.hpp +++ b/src/lib/scord/types.hpp @@ -851,11 +851,11 @@ struct fmt::formatter : formatter { }; template <> -struct fmt::formatter : formatter { +struct fmt::formatter : formatter { // parse is inherited from formatter. template auto - format(const scord::job_requirements& r, FormatContext& ctx) const { + format(const scord::job::requirements& r, FormatContext& ctx) const { return formatter::format( fmt::format("{{inputs: {}, outputs: {}, adhoc_storage: {}}}", r.inputs(), r.outputs(), r.adhoc_storage()), diff --git a/src/lib/types.cpp b/src/lib/types.cpp index f546259d..ca343013 100644 --- a/src/lib/types.cpp +++ b/src/lib/types.cpp @@ -923,156 +923,6 @@ template void pfs_storage::serialize( scord::network::serialization::input_archive&); -class job_requirements::impl { - -public: - impl() = default; - impl(std::vector inputs, - std::vector outputs) - : m_inputs(std::move(inputs)), m_outputs(std::move(outputs)) {} - - impl(std::vector inputs, - std::vector outputs, - scord::adhoc_storage adhoc_storage) - : m_inputs(std::move(inputs)), m_outputs(std::move(outputs)), - m_adhoc_storage(std::move(adhoc_storage)) {} - - - explicit impl(ADM_job_requirements_t reqs) { - m_inputs.reserve(reqs->r_inputs->l_length); - - for(size_t i = 0; i < reqs->r_inputs->l_length; ++i) { - m_inputs.emplace_back(reqs->r_inputs->l_datasets[i].d_id); - } - - m_outputs.reserve(reqs->r_outputs->l_length); - - for(size_t i = 0; i < reqs->r_outputs->l_length; ++i) { - m_outputs.emplace_back(reqs->r_outputs->l_datasets[i].d_id); - } - - if(reqs->r_adhoc_storage) { - m_adhoc_storage = scord::adhoc_storage(reqs->r_adhoc_storage); - } - } - - impl(const impl& rhs) = default; - impl(impl&& rhs) = default; - impl& - operator=(const impl& other) noexcept = default; - impl& - operator=(impl&&) noexcept = default; - - std::vector - inputs() const { - return m_inputs; - } - - std::vector - outputs() const { - return m_outputs; - } - - std::optional - adhoc_storage() const { - return m_adhoc_storage; - } - - template - void - load(Archive& ar) { - ar(SCORD_SERIALIZATION_NVP(m_inputs)); - ar(SCORD_SERIALIZATION_NVP(m_outputs)); - ar(SCORD_SERIALIZATION_NVP(m_adhoc_storage)); - } - - template - void - save(Archive& ar) const { - ar(SCORD_SERIALIZATION_NVP(m_inputs)); - ar(SCORD_SERIALIZATION_NVP(m_outputs)); - ar(SCORD_SERIALIZATION_NVP(m_adhoc_storage)); - } - -private: - std::vector m_inputs; - std::vector m_outputs; - std::optional m_adhoc_storage; -}; - - -job_requirements::job_requirements() = default; - -job_requirements::job_requirements(std::vector inputs, - std::vector outputs) - : m_pimpl(std::make_unique(std::move(inputs), std::move(outputs))) {} - -job_requirements::job_requirements(std::vector inputs, - std::vector outputs, - scord::adhoc_storage adhoc_storage) - : m_pimpl(std::make_unique(std::move(inputs), std::move(outputs), - std::move(adhoc_storage))) {} - -job_requirements::job_requirements(ADM_job_requirements_t reqs) - : m_pimpl(std::make_unique(reqs)) {} - -job_requirements::job_requirements(const job_requirements& other) noexcept - : m_pimpl(std::make_unique(*other.m_pimpl)) {} - -job_requirements::job_requirements(job_requirements&&) noexcept = default; - -job_requirements& -job_requirements::operator=(const job_requirements& other) noexcept { - this->m_pimpl = std::make_unique(*other.m_pimpl); - return *this; -} - -job_requirements& -job_requirements::operator=(job_requirements&&) noexcept = default; - -job_requirements::~job_requirements() = default; - -std::vector -job_requirements::inputs() const { - return m_pimpl->inputs(); -} - -std::vector -job_requirements::outputs() const { - return m_pimpl->outputs(); -} - -std::optional -job_requirements::adhoc_storage() const { - return m_pimpl->adhoc_storage(); -} - -// since the PIMPL class is fully defined at this point, we can now -// define the serialization function -template -inline void -job_requirements::serialize(Archive& ar) { - ar(SCORD_SERIALIZATION_NVP(m_pimpl)); -} - -// we must also explicitly instantiate our template functions for -// serialization in the desired archives -template void -job_requirements::impl::save( - scord::network::serialization::output_archive&) const; - -template void -job_requirements::impl::load( - scord::network::serialization::input_archive&); - -template void -job_requirements::serialize( - scord::network::serialization::output_archive&); - -template void -job_requirements::serialize( - scord::network::serialization::input_archive&); - namespace qos { class entity::impl { diff --git a/src/scord/internal_types.hpp b/src/scord/internal_types.hpp index 8d41f34b..f8064945 100644 --- a/src/scord/internal_types.hpp +++ b/src/scord/internal_types.hpp @@ -34,7 +34,7 @@ struct job_info { explicit job_info(scord::job job) : m_job(std::move(job)) {} job_info(scord::job job, scord::job::resources resources, - scord::job_requirements requirements) + scord::job::requirements requirements) : m_job(std::move(job)), m_resources(std::move(resources)), m_requirements(std::move(requirements)) {} @@ -48,7 +48,7 @@ struct job_info { return m_resources; } - std::optional + std::optional requirements() const { return m_requirements; } @@ -60,7 +60,7 @@ struct job_info { scord::job m_job; std::optional m_resources; - std::optional m_requirements; + std::optional m_requirements; }; struct adhoc_storage_info { diff --git a/src/scord/job_manager.hpp b/src/scord/job_manager.hpp index fa30b02b..cf9da9c2 100644 --- a/src/scord/job_manager.hpp +++ b/src/scord/job_manager.hpp @@ -42,7 +42,7 @@ struct job_manager : scord::utils::singleton { tl::expected, scord::error_code> create(scord::slurm_job_id slurm_id, scord::job::resources job_resources, - scord::job_requirements job_requirements) { + scord::job::requirements job_requirements) { static std::atomic_uint64_t current_id; scord::job_id id = current_id++; diff --git a/src/scord/rpc_handlers.cpp b/src/scord/rpc_handlers.cpp index 9ffe0646..0f4909fa 100644 --- a/src/scord/rpc_handlers.cpp +++ b/src/scord/rpc_handlers.cpp @@ -71,7 +71,7 @@ ping(const scord::network::request& req) { void register_job(const scord::network::request& req, const scord::job::resources& job_resources, - const scord::job_requirements& job_requirements, + const scord::job::requirements& job_requirements, scord::slurm_job_id slurm_id) { using scord::network::get_address; diff --git a/src/scord/rpc_handlers.hpp b/src/scord/rpc_handlers.hpp index 285bb962..94d84aeb 100644 --- a/src/scord/rpc_handlers.hpp +++ b/src/scord/rpc_handlers.hpp @@ -37,7 +37,7 @@ ping(const scord::network::request& req); void register_job(const scord::network::request& req, const scord::job::resources& job_resources, - const scord::job_requirements& job_requirements, + const scord::job::requirements& job_requirements, scord::slurm_job_id slurm_id); void -- GitLab From bfbebe5e8dcb89dcd8e3f58fa46b359990401624 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Sun, 19 Feb 2023 07:46:18 +0100 Subject: [PATCH 4/4] Update version of genopts --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07ea2346..48cfdfb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,7 +237,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building genopts") FetchContent_Declare( genopts GIT_REPOSITORY https://storage.bsc.es/gitlab/utils/genopts - GIT_TAG 1dcef400f8fbc6e1969c856ca844707b730c3002 # v0.1.0-pre + GIT_TAG c456c2d8ec92f26d9074b123446261103e5c847c # v0.1.0-pre GIT_SHALLOW ON GIT_PROGRESS ON ) -- GitLab