-
Notifications
You must be signed in to change notification settings - Fork 49
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
WIP: Experimental: update flux-pgrep to use RFC 35 constraint syntax #4915
base: master
Are you sure you want to change the base?
Conversation
Problem: The parse_datetime() utility function is statically configured to assume future dates when a term like "Friday" is given. That is, instead of giving the date for the previous Friday, the function will return then next Friday instead. This behavior should be configurable. Add an assumeFuture parameter to the function which defaults to True. If set to False, then parse_datetime() will assume dates in the past instead.
|
||
|
||
class Duration(Comparison): | ||
def convert(self, duration): |
Check failure
Code scanning / CodeQL
Superclass attribute shadows subclass method
|
||
|
||
class Datetime(Comparison): | ||
def convert(self, dt): |
Check failure
Code scanning / CodeQL
Superclass attribute shadows subclass method
Codecov Report
@@ Coverage Diff @@
## master #4915 +/- ##
===========================================
- Coverage 83.40% 59.01% -24.40%
===========================================
Files 423 416 -7
Lines 73806 71705 -2101
===========================================
- Hits 61559 42315 -19244
- Misses 12247 29390 +17143
|
This experimental PR resurrects some of the
flux-pgrep
features from #4849 to allow a compete query interface.There's still quite a bit to do here including settling on the exact syntax of some of the operators and tests, but I thought this might be useful in conjunction with the discussion in #4914, since this gives
flux-pgrep
the ability to generate the kinds of RFC 31 constraints we're discussing there.In this PR, a new
PgrepConstraintParser
class is added as a subclass ofConstraintParser
which can handle some of the specific syntax I'm proposing forflux pgrep
. For instance@expr
is syntactic sugar for "job was running at this time" and@dt1..dt2
translates to running between datetimesdt1
anddt2
.The rest of the operations are handled by the
PgrepConstraint
class, which compiles the RFC 31 specification into an object that can matchJobInfo
objects. The set of supported operations is at the top of the class definition. Any operation derived fromComparison
allows values to be prefixed with<
or-
,>
or+
for greater than/less than and<=
or-=
,>=
or+=
for less than or equal to/greather than or equal to. (the-=/+=
syntax is provided to avoid the need for shell quoting). The range operatormin..max
can be used in a comparison to expand tomin <= value <= max
.The current version has
--debug and --dry-run
options which can help experiment with the syntax, e.g.:etc. The program works by pulling down a list of jobs locally and using the constraint to list only the matching jobs. The default is only to pull down 1000 jobs, so that might give some surprising results by default.