flux-framework / flux-sched

Fluxion Graph-based Scheduler
GNU Lesser General Public License v3.0
86 stars 40 forks source link

feature: range request in resource-query (or more general underlying fluxion) #1116

Open vsoch opened 8 months ago

vsoch commented 8 months ago

We would like to have the ability to specify ranges. E.g., right now for my ice cream shop, to create different sizes I have to explicitly define them:

<!-- A small has one scoop -->
<edge id="small-cup" source="cup" target="scoop"></edge>

<!-- A medium has two scoops -->
<edge id="medium-cup" source="cup" target="scoop"></edge>

<!-- A large has three scoops -->
<edge id="large-cup" source="cup" target="scoop"></edge>

Ideally, I could just say that the customer is allowed to get 1-3 scoops.

<!-- A cup can have one, two, or three integer scoops -->
<edge id="cup" source="cup" target="scoop">
    <data key="min">1</data>
    <data key="max">3</data>
</edge>

In more real world use cases, if we are doing some kind of compatibility check we will likely be looking for mins/maxes (and not necessarily a range, but could be). I'm not sure where this translates into flux-sched logic - @grondo we talked about this today, and thought you might be the one to ask! i looked in flux-core and searched for "range" in the issues but didn't find anything that looked like a match.

Pinging @zekemorton @milroy to add more intelligent discussion to this issue than I can offer. :laughing:

grondo commented 8 months ago

Canonical jobspec supports this concept as described in the RFC 14 Resources section (see the description of the count: min, max, operator and operand keys).

However, Jobspec V1 requires count be a single integer value (See RFC 25), so there is no support for min, max, etc in current flux-core.

I don't know about resource-query since it is a fluxion specific tool and thus doesn't apply to the rest of the flux framework projects. I imagine there is a way to specify the min/max for count, though. @trws might know.

vsoch commented 8 months ago

Thanks @grondo!

I don't know about resource-query since it is a fluxion specific tool and thus doesn't apply to the rest of the flux framework projects.

We don't need it specifically for resource-query, but generally using the flux bindings. We chat about it today, and are wanting to just build a basic tool (that doesn't start from resource-query) that uses the fluxion bindings (is that the right way to put it?) to (high level):

  1. instantiate Fluxion
  2. Create the context, pass in the graphml for some domain (specify instead of JGF we are using graphml)
  3. The defaults should work out of the box
  4. Pass in a jobspec (that matches the domain of the graphml)
  5. Perform a satisfiability check rather than a match "can we represent this or not" (yes/no)

And the result should be true/false, etc. In the compatibility use case (software, kernel features, matching noodles to doodles) the library will likely be going through a list of items, sorted by preference, and checking them until there is a match (and passing on that it is chosen to some calling tool or user).

However, Jobspec V1 requires count be a single integer value (See RFC 25), so there is no support for min, max, etc in current flux-core.

So it sounds like we'd need to pass on the new ability for min/max to also be supported (some Jobspec V2)?

grondo commented 8 months ago

I think Fluxion does support some portion of canonical Jobspec beyond V1. I'd check in the testsuite for hints, e.g. t/t3009-resource-minmax.t and t/t3031-resource-minmax2.t look promising.

grondo commented 8 months ago

There's an example jobspec using min/max referenced by those tests here https://github.com/flux-framework/flux-sched/blob/fe872c8dc056934e4073b5fb2932335bb69ca73a/t/data/resource/jobspecs/min_max/test002.yaml#L1-L18

grondo commented 8 months ago

Perform a satisfiability check rather than a match "can we represent this or not" (yes/no)

Flux schedulers may offer a sched.feasibility RPC for doing a "satisfiability" check. Fluxion supports this so you could just send your jobspec to this service if Fluxion is running as a scheduler in a Flux instance, or you can figure out how to call the same functionality by looking at its implementation in the code.