Skip to content

Commit

Permalink
Merge changes from 'hotfix/5.12.4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento committed Apr 24, 2024
2 parents d297852 + 7e1cc73 commit e7cd7ea
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif()
find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild ) # Before project()

# this will generate variables, see ACore/ecflow_version.h.in
project( ecflow LANGUAGES CXX VERSION 5.12.3 )
project( ecflow LANGUAGES CXX VERSION 5.12.4 )

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@


def get_ecflow_version():
version = "5.12.3"
version = "5.12.4"
ecflow_version = version.split(".")
print("Extracted ecflow version '" + str(ecflow_version))
return ecflow_version
Expand Down
16 changes: 16 additions & 0 deletions docs/release_notes/version_5.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ Version 5.12 updates
.. role:: jiraissue
:class: hidden

Version 5.12.4
==============

* `Released <https://confluence.ecmwf.int/display/ECFLOW/Releases>`__\ on 2024-03-23

ecFlow Client
-------------

- **Bug** corrected ecFlow Python3 module linkage (specific for conda-forge) :jiraissue:`ECFLOW-1950`

ecFlow HTTP
-----------

- **Feature** added :code:`id` field to each Node in the :code:`/<path>/tree` endpoint response :jiraissue:`ECFLOW-1952`
- **Improvement** added *flag* attribute to Nodes in the :code:`/<path>/tree` endpoint response :jiraissue:`ECFLOW-1954`
- **Bug** corrected Alias node structure in the :code:`/<path>/tree` endpoint response :jiraissue:`ECFLOW-1953`

Version 5.12.3
==============
Expand Down
7 changes: 5 additions & 2 deletions docs/rest_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ Obtain the tree of all Suites
* - Description
- **Read** a tree with all suites
* - Parameters
- :code:`content`, (optional), possible values: :code:`basic`, :code:`full`
- :code:`content`, (optional), possible values: :code:`basic`, :code:`full`; :code:`with_id`, (optional), possible values: :code:`true`, :code:`false`
* - Payload
- *empty*
* - Response
Expand All @@ -513,13 +513,14 @@ When query parameter :code:`content` is not provided, or query parameter is :cod
}
}
When query parameter :code:`content=full`, the full Suite tree is provided:
When query parameters :code:`content=full&with_id=true`, the full Suite tree is provided:

.. code:: json
{
"some_suite": {
"type": "suite",
"id": "/some_suite",
"state": {
"node": "active",
"default": "complete"
Expand All @@ -535,6 +536,7 @@ When query parameter :code:`content=full`, the full Suite tree is provided:
"children": {
"some_family": {
"type": "family",
"id": "/some_suite/some_family",
"state": {
"node": "active",
"default": "unknown"
Expand All @@ -543,6 +545,7 @@ When query parameter :code:`content=full`, the full Suite tree is provided:
"children": {
"some_task": {
"type": "task",
"id": "/some_suite/some_family/some_task",
"state": {
"node": "active",
"default": "unknown"
Expand Down
2 changes: 1 addition & 1 deletion libs/pyext/ecflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
The ecFlow python module
"""

__version__ = '5.12.3'
__version__ = '5.12.4'

# http://stackoverflow.com/questions/13040646/how-do-i-create-documentation-with-pydoc
8 changes: 7 additions & 1 deletion libs/rest/src/ecflow/http/ApiV1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ static std::string get_tree_content_kind(const httplib::Request& request) {
return request.has_param(content) ? request.get_param_value(content) : "basic";
}

static bool get_tree_content_id_flag(const httplib::Request& request) {
constexpr const char* content = "with_id";
return request.has_param(content) ? (request.get_param_value(content) == "true" ? true : false) : false;
}

} // namespace

namespace v1 {
Expand Down Expand Up @@ -263,7 +268,8 @@ void node_tree_read(const httplib::Request& request, httplib::Response& response
num_cached_requests++;
const std::string path = request.matches[1];
std::string tree_kind = get_tree_content_kind(request);
ojson tree_content = (tree_kind == "full") ? get_full_node_tree(path) : get_basic_node_tree(path);
bool with_id = get_tree_content_id_flag(request);
ojson tree_content = (tree_kind == "full") ? get_full_node_tree(path, with_id) : get_basic_node_tree(path);
ojson j = filter_json(tree_content, request);
response.status = HttpStatusCode::success_ok;
response.set_content(j.dump(), "application/json");
Expand Down
4 changes: 2 additions & 2 deletions libs/rest/src/ecflow/http/ApiV1Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ ojson get_basic_node_tree(const std::string& path) {
return tree.content();
}

ojson get_full_node_tree(const std::string& path) {
FullTree tree;
ojson get_full_node_tree(const std::string& path, bool with_id) {
FullTree tree{with_id};
DefsTreeVisitor(get_defs(), tree).visit_at(path);
return tree.content();
}
Expand Down
2 changes: 1 addition & 1 deletion libs/rest/src/ecflow/http/ApiV1Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace ecf::http {

ojson get_basic_node_tree(const std::string& path);
ojson get_full_node_tree(const std::string& path);
ojson get_full_node_tree(const std::string& path, bool with_id);
ojson get_sparser_node_tree(const std::string& path);

void add_suite(const httplib::Request& request, httplib::Response& response);
Expand Down
23 changes: 19 additions & 4 deletions libs/rest/src/ecflow/http/TreeGeneration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ struct BasicTree

struct FullTree
{
FullTree() : root_(ojson::object({})), stack_{&root_} {}
FullTree(bool with_id) : root_(ojson::object({})), stack_{&root_}, with_id_{with_id} {}

void begin_visit(const Suite& suite) {
ojson& parent_ = *stack_.back();
ojson& current = parent_[suite.name()] = ojson::object({});

current["type"] = "suite";
if (with_id_) {
current["id"] = suite.absNodePath();
}
publish_state(suite, current);
publish_attributes(suite, current);

Expand All @@ -84,6 +87,9 @@ struct FullTree
ojson& current = parent_[family.name()] = ojson::object({});

current["type"] = "family";
if (with_id_) {
current["id"] = family.absNodePath();
}
publish_state(family, current);
publish_attributes(family, current);

Expand All @@ -98,6 +104,9 @@ struct FullTree
ojson& current = parent_[task.name()] = ojson::object({});

current["type"] = "task";
if (with_id_) {
current["id"] = task.absNodePath();
}
publish_state(task, current);
publish_attributes(task, current);

Expand All @@ -113,13 +122,14 @@ struct FullTree
stack_.push_back(&current);

current["type"] = "alias";
if (with_id_) {
current["id"] = alias.absNodePath();
}
publish_state(alias, current);
publish_attributes(alias, current);
}

void end_visit(const Alias& alias [[maybe_unused]]) {
// Nothing to do...
}
void end_visit(const Alias& alias [[maybe_unused]]) { stack_.pop_back(); }

const ojson& content() const { return root_; }

Expand Down Expand Up @@ -225,11 +235,16 @@ struct FullTree
for (const auto& attr : node.generics()) {
array.emplace_back(publish_atribute(attr, "generic"));
}

if (auto flag = node.get_flag(); flag.flag()) {
array.emplace_back(publish_atribute(flag, "flag"));
}
}

private:
ojson root_;
std::vector<ojson*> stack_;
bool with_id_;
};

} // namespace ecf::http
Expand Down

0 comments on commit e7cd7ea

Please sign in to comment.