From a9db15cd748c406c79fadffc1b071328f5f5d395 Mon Sep 17 00:00:00 2001 From: Daniel Milroy Date: Mon, 13 Jan 2025 19:27:40 -0800 Subject: [PATCH] fixup! traverser --- resource/traversers/dfu_impl.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/resource/traversers/dfu_impl.cpp b/resource/traversers/dfu_impl.cpp index ee4e294c8..9fae27831 100644 --- a/resource/traversers/dfu_impl.cpp +++ b/resource/traversers/dfu_impl.cpp @@ -1229,6 +1229,7 @@ int dfu_impl_t::find (std::shared_ptr &writers, const std::stri vtx_predicates_override_t p_overridden; bool agfilter = false; uint64_t jobid = 0; + std::vector> predicates; if (!m_match || !m_graph || !m_graph_db || !writers) { errno = EINVAL; @@ -1246,11 +1247,30 @@ int dfu_impl_t::find (std::shared_ptr &writers, const std::stri m_err_msg += ": invalid criteria: " + criteria + ".\n"; goto done; } - if ((rc = m_expr_eval.extract (criteria, target, jobid, agfilter)) < 0) { + if ((rc = m_expr_eval.extract (criteria, target, predicates)) < 0) { m_err_msg += __FUNCTION__; m_err_msg += ": failed extraction.\n"; goto done; } + for (auto const &p : predicates) { + if (p.first == "jobid-alloc" || p.first == "jobid-span" || p.first == "jobid-tag" || p.first == "jobid-reserved") { + try { + jobid = std::stoul (p.second); + } catch (std::invalid_argument) { + errno = EINVAL; + goto done; + } catch (std::out_of_range) { + errno = EINVAL; + goto done; + } + } else if (p.first == "agfilter") { + if (p.second == "true" || p.second == "t") { + agfilter = true; + } else { + agfilter = false; + } + } + } tick ();