Argument --local added
ClosedPublic

Authored by lbrabec on Jul 9 2015, 1:45 PM.

Details

Summary

After discussion with @kparal, this diff introduces new argument: --local.
See discussion in D419 and T300.

Test Plan

run taskotron and try this argument

Diff Detail

Repository
rLTRN libtaskotron
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
lbrabec retitled this revision from to Argument --local added.Jul 9 2015, 1:45 PM
lbrabec updated this object.
lbrabec edited the test plan for this revision. (Show Details)
lbrabec added a reviewer: kparal.
lbrabec added a subscriber: kparal.
jskladan added inline comments.
libtaskotron/runner.py
205–206

Why are these lines removed? D419 (mentioned in the description) has these lines, and even touches them.

206–208

Please fix the lint code - the current consesus is that all LINT warnings must be resolved - restructuring the method call, so it fits into 99 chars is quite easy. Even if it's not "your code" you touched the line in the diff ;)

lbrabec added inline comments.Jul 13 2015, 7:46 AM
libtaskotron/runner.py
205–206

At the moment, task executor and task initiator are distinguished by ['environment']['machine']. D419 changes it, so just the 'machine' key gets removed, but the ['environment']['rpm'] stays and it can be checked/installed locally. These lines can be removed since the local/remote decision is based on --local from command line.

206–208

Okie Dokie

jskladan added inline comments.Jul 13 2015, 8:13 AM
libtaskotron/runner.py
205–206

whatevs, I don't really have deep understanding of this part of the code - just wanted to make sure it's not a mistake, especially since one of the deleted lines is changed in a diff, which IIUIC should be applied after this one. Sounds like you know what'cha doin' ;)

In principle, yes, I think we should do it like this. (Once we have the full T408 change in place, we will get rid of the environment-machine hack).

Adding mkrizek and tflink, if anyone has any concerns or suggestions.

Now, please update this diff with some unit tests. Thanks.

libtaskotron/runner.py
221–222

Let's play nicely with the argument parser here and put the option before the argument (even though it is not strictly required with argparse).

266–270

The second sentence might be unclear for people not familiar with the code. Do you think this sounds better?

Make the task run on this particular machine, regardless of the default execution mode 
defined in the configuration file. This also approves any required system-wide changes
to be performed (automatic installation of package dependencies, destructive tasks
allowed, etc).
lbrabec updated this revision to Diff 1140.Jul 13 2015, 12:21 PM
  • code polishing, runner refactor for testability, tests
mkrizek added inline comments.Jul 13 2015, 1:13 PM
testing/test_runner.py
471

You can put those monkeypatches into a setup method so you don't have to do it in each test method separately, like so:

@pytest.mark.usefixtures('setup')
​class Test():	​
​    @pytest.fixture
​    def setup(self, monkeypatch):
         monkeypatch.setattr(...)
489

I guess you can just use some random uuid instead of Dingus (the methods are monkeypatched anyway) if you're not going to do anything with it.

lbrabec updated this revision to Diff 1145.Jul 13 2015, 1:28 PM
  • code polishing

Look good in general. Can you please add docstrings for class+methods? This module has suffered from under-documentation for quite long (and I never remember what the damn task_data, arg_data, env_data and similar stuff are).

libtaskotron/runner.py
304

Would it be more straightforward if we renamed this to Runner and the original Runner we renamed to LocalRunner?

323–326

Please move this to a def run() method, it's much more readable that way.

402–403
# run the task, locally or remotely
testing/test_runner.py
480–482

It would be more fool-proof to count the number of calls on stub_local and stub_remote and assert that there was exactly one call for local stub and exactly zero calls for remote stub. Ditto for other tests.

lbrabec updated this revision to Diff 1157.Jul 14 2015, 11:33 AM
  • code polishing
lbrabec updated this revision to Diff 1159.Jul 14 2015, 11:41 AM
  • comment added
This revision is now accepted and ready to land.Jul 15 2015, 8:16 AM
Closed by commit rLTRN6ba0f19740fb: Argument --local added (authored by Lukas Brabec <lbrabec@redhat.com>). · Explain WhyJul 15 2015, 9:39 AM
This revision was automatically updated to reflect the committed changes.