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

Refactor configuration and results information #111

Merged
merged 4 commits into from
Nov 13, 2015

Conversation

snim2
Copy link
Collaborator

@snim2 snim2 commented Nov 13, 2015

This PR:

  • Creates three new objects krun.audit.Audit, krun.config.Config, krun.results.Results
  • Simplifies the 'dump' CLI options considerably.
  • Removes some complex logic from the scheduler, since results from previous executions are loaded directly into krun.results.Results objects from disk.
  • Remove krun.util.audits_same_platform, since krun.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 in krun.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

@snim2 snim2 added this to the camera-ready milestone Nov 13, 2015
Sarah Mount added 3 commits November 13, 2015 10:18
… 'dump' CLI options. Moved functions out of krun.util. Removed some complex logic from the scheduler.
…te class to simplify the '-dump' code. The scheduler now initialises VM definition objects.
@@ -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.')
Copy link
Member

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?

Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Member

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(?).

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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.]

Copy link
Member

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.

@vext01
Copy link
Member

vext01 commented Nov 13, 2015

OK, so this looks good to me and it seems to work on my laptop.

Do you want to do any squashing?

@snim2
Copy link
Collaborator Author

snim2 commented Nov 13, 2015

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.

@vext01
Copy link
Member

vext01 commented Nov 13, 2015

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?

@snim2
Copy link
Collaborator Author

snim2 commented Nov 13, 2015

Agree. I'll add the second point as a new issue.

@ltratt
Copy link
Member

ltratt commented Nov 13, 2015

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.

@vext01
Copy link
Member

vext01 commented Nov 13, 2015

OK, let's go.

vext01 added a commit that referenced this pull request Nov 13, 2015
Refactor configuration and results information
@vext01 vext01 merged commit 76900cc into master Nov 13, 2015
@vext01 vext01 deleted the refactor-config-results branch November 13, 2015 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants