-
Notifications
You must be signed in to change notification settings - Fork 10
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
Refactor configuration and results information #111
Conversation
… 'dump' CLI options. Moved functions out of krun.util. Removed some complex logic from the scheduler.
…t for EntryPoint.__eq__.
…te class to simplify the '-dump' code. The scheduler now initialises VM definition objects.
4337f2e
to
b1e154d
Compare
@@ -101,109 +103,90 @@ def sanity_check_user_change(platform): | |||
def create_arg_parser(): | |||
"""Create a parser to process command-line options. | |||
""" | |||
parser = argparse.ArgumentParser(description='Benchmark, running many fresh processes.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the changes to this block are quote substitutions? Which rules are you using to decide which to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah i see, you store a string of which dump.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I wrote the argument parsing code I used single quotes throughout, then I looked a bit further and realised that you had used double-quotes throughout. I thought I'd already changed all these to be consistent with your code, but apparently not.
Were you following some more complicated convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't currently have any rule in place. I actually had to search to see what the convention is.
There's no difference between '
and "
in python, but it seems people use '
to express the notion of a string which is constant and "
for format strings, which are conceptually expanded.
E.g.:
'hello'
"hello %s" % name
We could adopt such a notion if you like(?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, up to you, but maybe we should change code as we come to it rather than a big bang. Let me know if you want me to change the strings in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's please not use arbitrary rules for ""
and ''
-- we'll never remember it, no-one will know why we did it, and so usage will quickly drift. Please just pick one and use it consistently in a file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean Laurie. Do you mean use only "
or '
in any given file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. [And preferably be consistent in a project; but at least be consistent in a file.]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. We may find that we can't be this black and white, for example when nesting quotes. But we can try if you really feel strongly.
Not sure I want to impose any rules TBH.
OK, so this looks good to me and it seems to work on my laptop. Do you want to do any squashing? |
efb1f6e
to
e89e9a9
Compare
OK, I have squashed. There are only two small things I am not entirely happy with. One is that comparing two audits ignores the packages. This needs to be fixed as part of #103 The other thing is that the scheduler now sets the platform of the VM objects. Should anyone use Krun as a library, this is still rather opaque, but I couldn't think of a better place to put that code. |
I don't think these should block your merge. Overall this PR improves the quality of the code and those nits can be addressed later. Agree? |
Agree. I'll add the second point as a new issue. |
I really don't think we should bother with package checks and the like. It's too much effort for no real gain. Let's please drop it. |
OK, let's go. |
Refactor configuration and results information
This PR:
krun.audit.Audit
,krun.config.Config
,krun.results.Results
krun.results.Results
objects from disk.krun.util.audits_same_platform
, sincekrun.audit.Audit
objects can now be compared directly with==
.unicode(Audit(...))
is correctly formatted for--dump-audit
.ExecutionScheduler
objects now initialise VM definition objects, simplifying the logic inkrun.py
and making it less likely that clients of the library will forget to correctly initialise the objects.krun.results.Results
objects can serialise themselves on disk,krun.config.Config
objects can read from config files on disk or from a string.Fixes #75