Skip to content

Commit

Permalink
readers: make most JGF vertex metadata optional
Browse files Browse the repository at this point in the history
Problem: as described in flux-framework#1255, JGF is too large and unwieldy,
with lots of redundant and repeated data.

To begin to cut back, make most vertex metadata optional.
  • Loading branch information
jameshcorbett committed Sep 5, 2024
1 parent 088f26a commit 15dd057
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions resource/readers/resource_reader_jgf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ int resource_reader_jgf_t::remap_aware_unpack_vtx (fetch_helper_t &f,
return 0;
}


int resource_reader_jgf_t::apply_defaults (fetch_helper_t &f) {

}

int resource_reader_jgf_t::fill_fetcher (json_t *element,
fetch_helper_t &f,
json_t **paths,
Expand All @@ -354,17 +359,17 @@ int resource_reader_jgf_t::fill_fetcher (json_t *element,
errno = EINVAL;
m_err_msg += __FUNCTION__;
m_err_msg += ": JGF vertex id key is not found in a node.\n";
goto done;
return -1;
}
if ((metadata = json_object_get (element, "metadata")) == NULL) {
errno = EINVAL;
m_err_msg += __FUNCTION__;
m_err_msg += ": key (metadata) is not found in an JGF node for ";
m_err_msg += std::string (f.vertex_id) + ".\n";
goto done;
return -1;
}
if ((json_unpack (metadata,
"{ s:s s:s s:s s:I s:I s:I s?:i s:b s:s s:I s:o s?o }",
"{ s:s s?s s?s s?I s?I s?I s?i s?b s?s s?I s?o s?o }",
"type",
&f.type,
"basename",
Expand Down Expand Up @@ -394,16 +399,16 @@ int resource_reader_jgf_t::fill_fetcher (json_t *element,
m_err_msg += __FUNCTION__;
m_err_msg += ": malformed metadata in an JGF node for ";
m_err_msg += std::string (f.vertex_id) + "\n";
goto done;
return -1;
}
if (*properties && !json_is_object (*properties)) {
errno = EINVAL;
m_err_msg += __FUNCTION__;
m_err_msg += ": key (properties) must be an object or null for ";
m_err_msg += std::string (f.vertex_id) + ".\n";
goto done;
return -1;
}
rc = 0;
return apply_defaults (f);
done:
return rc;
}
Expand Down

0 comments on commit 15dd057

Please sign in to comment.