Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reader: fix jgf properties #1149

Merged

Conversation

jameshcorbett
Copy link
Member

@jameshcorbett jameshcorbett commented Mar 4, 2024

Given this vertex in JGF, resource-query reports it has no properties.

      {
        "id": "35",
        "metadata": {
          "type": "node",
          "basename": "node",
          "name": "compute-01",
          "id": 1,
          "uniq_id": 35,
          "rank": 0,
          "exclusive": true,
          "unit": "",
          "size": 1,
          "properties": ["pdebug"],
          "paths": {
            "containment": "/ElCapitan0/rack0/compute-01"
          }
        }
      }
resource-query> g /ElCapitan0/rack0/compute-01
No properties were found for /ElCapitan0/rack0/compute-01 (vtx's uniq_id=35).

Looking at the reader, I found that it expects properties to be given as a mapping with keys the name of the property. When I changed the vertex in JGF to the following, the property was recognized. It looks like the reader had been silently failing on the type.

      {
        "id": "35",
        "metadata": {
          "type": "node",
          "basename": "node",
          "name": "compute-01",
          "id": 1,
          "uniq_id": 35,
          "rank": 0,
          "exclusive": true,
          "unit": "",
          "size": 1,
          "properties": {
            "pdebug": ""
          },
          "paths": {
            "containment": "/ElCapitan0/rack0/compute-01"
          }
        }
      },
resource-query> g /ElCapitan0/rack0/compute-01
pdebug=

Problem: the JGF reader requires each vertex's 'properties' field
to be either null or a JSON object, but doesn't ever check the type.
This leads to silent failures when the type read in is wrong.

Add a check for the type of the properties field if it is not null.
Problem: the Python JGF writer outputs properties as a list by
default, but the reader expects a mapping.

Change the default to a dictionary.
@jameshcorbett
Copy link
Member Author

@milroy this is ready for review whenever.

Copy link
Member

@milroy milroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from a typo in one commit message this PR LGTM!

@@ -45,6 +45,17 @@
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the commit message. I think you mean "there are no tests where the JGF writer handles properties correctly."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! Force-pushed with the correction.

Problem: there are no tests that the JGF writer handles
properties correctly.

Add them.
Problem: t/t8001-util-ion-R.t expects JGF properties to be formatted
as a JSON array, but they are actually given by a mapping.

Fix the expected type.
@jameshcorbett
Copy link
Member Author

Thanks! Setting MWP.

@jameshcorbett jameshcorbett added the merge-when-passing mergify.io - merge PR automatically once CI passes label Apr 5, 2024
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Merging #1149 (f2f2899) into master (68c636a) will increase coverage by 2.8%.
The diff coverage is 53.3%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1149     +/-   ##
========================================
+ Coverage    71.0%   73.9%   +2.8%     
========================================
  Files          96     103      +7     
  Lines       12867   14395   +1528     
========================================
+ Hits         9147   10643   +1496     
- Misses       3720    3752     +32     
Files Coverage Δ
src/python/fluxion/resourcegraph/V1.py 91.9% <77.7%> (+13.9%) ⬆️
resource/readers/resource_reader_jgf.cpp 69.0% <16.6%> (-0.5%) ⬇️

... and 9 files with indirect coverage changes

@mergify mergify bot merged commit d0b9ac3 into flux-framework:master Apr 5, 2024
22 of 23 checks passed
@jameshcorbett jameshcorbett deleted the reader-fix-jgf-properties branch April 5, 2024 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-passing mergify.io - merge PR automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants