Loading src/scord/job_manager.hpp +14 −8 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ namespace scord { struct job_manager : scord::utils::singleton<job_manager> { tl::expected<admire::internal::job_info, admire::error_code> tl::expected<std::shared_ptr<admire::internal::job_info>, admire::error_code> create(admire::slurm_job_id slurm_id, admire::job::resources job_resources, admire::job_requirements job_requirements) { Loading @@ -52,9 +53,9 @@ struct job_manager : scord::utils::singleton<job_manager> { if(const auto it = m_jobs.find(id); it == m_jobs.end()) { const auto& [it_job, inserted] = m_jobs.emplace( id, admire::internal::job_info{admire::job{id, slurm_id}, std::move(job_resources), std::move(job_requirements)}); std::make_shared<admire::internal::job_info>( admire::job{id, slurm_id}, std::move(job_resources), std::move(job_requirements))); if(!inserted) { LOGGER_ERROR("{}: Emplace failed", __FUNCTION__); Loading @@ -77,9 +78,11 @@ struct job_manager : scord::utils::singleton<job_manager> { if(const auto it = m_jobs.find(id); it != m_jobs.end()) { const auto& current_job_info = it->second; it->second = admire::internal::job_info{ current_job_info.job(), std::move(job_resources), const auto new_job_info = admire::internal::job_info{ current_job_info->job(), std::move(job_resources), std::move(job_requirements)}; *it->second = new_job_info; return ADM_SUCCESS; } Loading @@ -87,7 +90,8 @@ struct job_manager : scord::utils::singleton<job_manager> { return ADM_ENOENT; } tl::expected<admire::internal::job_info, admire::error_code> tl::expected<std::shared_ptr<admire::internal::job_info>, admire::error_code> find(admire::job_id id) { abt::shared_lock lock(m_jobs_mutex); Loading Loading @@ -120,7 +124,9 @@ private: job_manager() = default; mutable abt::shared_mutex m_jobs_mutex; std::unordered_map<admire::job_id, admire::internal::job_info> m_jobs; std::unordered_map<admire::job_id, std::shared_ptr<admire::internal::job_info>> m_jobs; }; } // namespace scord Loading src/scord/rpc_handlers.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ ADM_register_job(hg_handle_t h) { const auto rv = jm.create(slurm_id, job_resources, reqs); if(rv) { const auto& job = rv->job(); const auto& job = rv.value()->job(); out.op_id = rpc_id; out.retval = ec; out.job = admire::api::convert(job).release(); Loading @@ -119,7 +119,7 @@ ADM_register_job(hg_handle_t h) { LOGGER_INFO("rpc id: {} name: {} to: {} <= " "body: {{retval: {}, job: {}}}", rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)), ec, rv ? fmt::format("{}", rv->job()) : "none"); ec, rv ? fmt::format("{}", rv.value()->job()) : "none"); ret = margo_respond(h, &out); assert(ret == HG_SUCCESS); Loading Loading
src/scord/job_manager.hpp +14 −8 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ namespace scord { struct job_manager : scord::utils::singleton<job_manager> { tl::expected<admire::internal::job_info, admire::error_code> tl::expected<std::shared_ptr<admire::internal::job_info>, admire::error_code> create(admire::slurm_job_id slurm_id, admire::job::resources job_resources, admire::job_requirements job_requirements) { Loading @@ -52,9 +53,9 @@ struct job_manager : scord::utils::singleton<job_manager> { if(const auto it = m_jobs.find(id); it == m_jobs.end()) { const auto& [it_job, inserted] = m_jobs.emplace( id, admire::internal::job_info{admire::job{id, slurm_id}, std::move(job_resources), std::move(job_requirements)}); std::make_shared<admire::internal::job_info>( admire::job{id, slurm_id}, std::move(job_resources), std::move(job_requirements))); if(!inserted) { LOGGER_ERROR("{}: Emplace failed", __FUNCTION__); Loading @@ -77,9 +78,11 @@ struct job_manager : scord::utils::singleton<job_manager> { if(const auto it = m_jobs.find(id); it != m_jobs.end()) { const auto& current_job_info = it->second; it->second = admire::internal::job_info{ current_job_info.job(), std::move(job_resources), const auto new_job_info = admire::internal::job_info{ current_job_info->job(), std::move(job_resources), std::move(job_requirements)}; *it->second = new_job_info; return ADM_SUCCESS; } Loading @@ -87,7 +90,8 @@ struct job_manager : scord::utils::singleton<job_manager> { return ADM_ENOENT; } tl::expected<admire::internal::job_info, admire::error_code> tl::expected<std::shared_ptr<admire::internal::job_info>, admire::error_code> find(admire::job_id id) { abt::shared_lock lock(m_jobs_mutex); Loading Loading @@ -120,7 +124,9 @@ private: job_manager() = default; mutable abt::shared_mutex m_jobs_mutex; std::unordered_map<admire::job_id, admire::internal::job_info> m_jobs; std::unordered_map<admire::job_id, std::shared_ptr<admire::internal::job_info>> m_jobs; }; } // namespace scord Loading
src/scord/rpc_handlers.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ ADM_register_job(hg_handle_t h) { const auto rv = jm.create(slurm_id, job_resources, reqs); if(rv) { const auto& job = rv->job(); const auto& job = rv.value()->job(); out.op_id = rpc_id; out.retval = ec; out.job = admire::api::convert(job).release(); Loading @@ -119,7 +119,7 @@ ADM_register_job(hg_handle_t h) { LOGGER_INFO("rpc id: {} name: {} to: {} <= " "body: {{retval: {}, job: {}}}", rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)), ec, rv ? fmt::format("{}", rv->job()) : "none"); ec, rv ? fmt::format("{}", rv.value()->job()) : "none"); ret = margo_respond(h, &out); assert(ret == HG_SUCCESS); Loading