Merge lp:~zyga/checkbox/autocomplete-support into lp:checkbox

Proposed by Zygmunt Krynicki
Status: Work in progress
Proposed branch: lp:~zyga/checkbox/autocomplete-support
Merge into: lp:checkbox
Diff against target: 89 lines (+39/-6)
4 files modified
plainbox/plainbox/impl/commands/checkbox.py (+36/-3)
plainbox/plainbox/impl/commands/run.py (+1/-1)
plainbox/requirements/pip-optional.txt (+1/-1)
support/external-tarballs-revision.txt (+1/-1)
To merge this branch: bzr merge lp:~zyga/checkbox/autocomplete-support
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Needs Information
Maciej Kisielewski Approve
Review via email: mp+230096@code.launchpad.net

Description of the change

Something I digged out out of my sprint branch:

63eecf5 support: update external taraballs revision to latest
e6b3ebc plainbox:requirements: re-enable argcomplete installation
77f29bb plainbox: add crude autocompletion support to plainbox run

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

+1

review: Approve
Revision history for this message
Daniel Manrique (roadmr) wrote :
Download full text (11.4 KiB)

The attempt to merge lp:~zkrynicki/checkbox/autocomplete-support into lp:checkbox failed. Below is the output from the failed tests.

[precise] starting container
[precise] (timing) 0.06user 0.02system 0:04.22elapsed 2%CPU (0avgtext+0avgdata 7864maxresident)k
[precise] (timing) 0inputs+32outputs (0major+5772minor)pagefaults 0swaps
[precise] provisioning container
[precise] (timing) 38.30user 11.79system 1:18.06elapsed 64%CPU (0avgtext+0avgdata 51204maxresident)k
[precise] (timing) 0inputs+16344outputs (0major+4289042minor)pagefaults 0swaps
[precise-testing] Starting tests...
Found a test script: ./checkbox-gui/requirements/container-tests-checkbox-gui-build
[precise-testing] container-tests-checkbox-gui-build: PASS
[precise-testing] (timing) 33.92user 2.47system 0:36.90elapsed 98%CPU (0avgtext+0avgdata 116364maxresident)k
[precise-testing] (timing) 0inputs+4240outputs (0major+477933minor)pagefaults 0swaps
Found a test script: ./checkbox-ng/requirements/container-tests-checkbox-ng-unit
[precise-testing] container-tests-checkbox-ng-unit: FAIL
[precise-testing] stdout: http://paste.ubuntu.com/7988784/
[precise-testing] stderr: http://paste.ubuntu.com/7988785/
[precise-testing] (timing) Command exited with non-zero status 1
[precise-testing] (timing) 0.58user 0.14system 0:00.77elapsed 95%CPU (0avgtext+0avgdata 37084maxresident)k
[precise-testing] (timing) 0inputs+2968outputs (0major+19112minor)pagefaults 0swaps
Found a test script: ./checkbox-support/requirements/container-tests-checkbox-support
[precise-testing] container-tests-checkbox-support: PASS
[precise-testing] (timing) 17.64user 0.17system 0:17.97elapsed 99%CPU (0avgtext+0avgdata 82440maxresident)k
[precise-testing] (timing) 0inputs+976outputs (0major+30676minor)pagefaults 0swaps
Found a test script: ./plainbox/requirements/001-container-tests-plainbox-egg-info
[precise-testing] 001-container-tests-plainbox-egg-info: PASS
[precise-testing] (timing) 0.16user 0.03system 0:00.21elapsed 90%CPU (0avgtext+0avgdata 10396maxresident)k
[precise-testing] (timing) 0inputs+80outputs (0major+4950minor)pagefaults 0swaps
Found a test script: ./plainbox/requirements/container-tests-plainbox
[precise-testing] container-tests-plainbox: FAIL
[precise-testing] stdout: http://paste.ubuntu.com/7988788/
[precise-testing] stderr: http://paste.ubuntu.com/7988789/
[precise-testing] (timing) Command exited with non-zero status 1
[precise-testing] (timing) 4.73user 0.27system 0:05.05elapsed 99%CPU (0avgtext+0avgdata 64444maxresident)k
[precise-testing] (timing) 0inputs+2456outputs (0major+48764minor)pagefaults 0swaps
Found a test script: ./plainbox/requirements/container-tests-plainbox-documentation
[precise-testing] container-tests-plainbox-documentation: FAIL
[precise-testing] stdout: http://paste.ubuntu.com/7988791/
[precise-testing] stderr: http://paste.ubuntu.com/7988792/
[precise-testing] (timing) Command exited with non-zero status 1
[precise-testing] (timing) 1.20user 0.10system 0:01.35elapsed 96%CPU (0avgtext+0avgdata 39088maxresident)k
[precise-testing] (timing) 0inputs+1944outputs (0major+16598minor)pagefaults 0swaps
Foun...

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Damn,

  File "/usr/local/lib/python3.2/dist-packages/argcomplete/__init__.py",
line 185

Argcomplete doesn't support python3.2

On Fri, Aug 8, 2014 at 3:28 PM, Daniel Manrique
<email address hidden> wrote:
> The proposal to merge lp:~zkrynicki/checkbox/autocomplete-support into lp:checkbox has been updated.
>
> Status: Approved => Needs review
>
> For more details, see:
> https://code.launchpad.net/~zkrynicki/checkbox/autocomplete-support/+merge/230096
> --
> https://code.launchpad.net/~zkrynicki/checkbox/autocomplete-support/+merge/230096
> You are the owner of lp:~zkrynicki/checkbox/autocomplete-support.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Anything we can fix?

review: Needs Information
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Unfortunately nothing we can fix in our own project. Upstream developers dropposed support for python3.2 (in favour of simplier 2.7+ support granted by python's 3.3 'u' feature)

Unmerged revisions

3176. By Zygmunt Krynicki

plainbox: add crude autocompletion support to plainbox run

This patch adds autocomplete support to 'plainbox run -i' and 'plainbox
run -x'. Both complete providers namespaces and then job definition
identifiers.

The crudeness is related to the fact that this operation is very slow
today. It feels quite painful to operate (but works well otherwise).
Still, with this enabled we can easily observe impact of any app-startup
optimizations and the performance of provider cache that is in the
works.

Signed-off-by: Zygmunt Krynicki <email address hidden>

3175. By Zygmunt Krynicki

plainbox:requirements: re-enable argcomplete installation

Signed-off-by: Zygmunt Krynicki <email address hidden>

3174. By Zygmunt Krynicki

support: update external taraballs revision to latest

Signed-off-by: Zygmunt Krynicki <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plainbox/plainbox/impl/commands/checkbox.py'
2--- plainbox/plainbox/impl/commands/checkbox.py 2014-03-27 21:58:41 +0000
3+++ plainbox/plainbox/impl/commands/checkbox.py 2014-08-08 12:19:52 +0000
4@@ -138,21 +138,29 @@
5 jobs
6 """
7
8- def enhance_parser(self, parser):
9+ def enhance_parser(self, parser, provider_list=None):
10 """
11 Add common options for job selection to an existing parser
12 """
13+ if provider_list is not None:
14+ id_completer = JobIdCompleter(provider_list)
15+ else:
16+ id_completer = None
17 group = parser.add_argument_group(title=_("job definition options"))
18- group.add_argument(
19+ action = group.add_argument(
20 '-i', '--include-pattern', action="append",
21 metavar=_('PATTERN'), default=[], dest='include_pattern_list',
22 # TRANSLATORS: this is in imperative form
23 help=_("include jobs matching the given regular expression"))
24- group.add_argument(
25+ if id_completer is not None:
26+ action.completer = id_completer
27+ action = group.add_argument(
28 '-x', '--exclude-pattern', action="append",
29 metavar=_("PATTERN"), default=[], dest='exclude_pattern_list',
30 # TRANSLATORS: this is in imperative form
31 help=_("exclude jobs matching the given regular expression"))
32+ if id_completer is not None:
33+ action.completer = id_completer
34 # TODO: Find a way to handle the encoding of the file
35 group.add_argument(
36 '-w', '--whitelist',
37@@ -162,3 +170,28 @@
38 type=FileType("rt"),
39 # TRANSLATORS: this is in imperative form
40 help=_("load whitelist containing run patterns"))
41+
42+
43+class JobIdCompleter:
44+ """
45+ An completer that compiles and provides a list of job definition
46+ identifiers
47+ """
48+
49+ def __init__(self, provider_list):
50+ # TODO: add preview API that just contains job IDs
51+ id_hints = set()
52+ ns_hints = set()
53+ for provider in provider_list:
54+ for job in provider.load_all_jobs()[0]:
55+ id_hints.add(job.id)
56+ ns_hints.add(job.provider.namespace)
57+ self.id_hints = id_hints
58+ self.ns_hints = ns_hints
59+
60+ def __call__(self, prefix, **kwargs):
61+ prefix = prefix.replace('\\:', ':')
62+ if "::" in prefix:
63+ return sorted(c for c in self.id_hints if c.startswith(prefix))
64+ else:
65+ return sorted(c + '::' for c in self.ns_hints if c.startswith(prefix))
66
67=== modified file 'plainbox/plainbox/impl/commands/run.py'
68--- plainbox/plainbox/impl/commands/run.py 2014-08-04 16:51:44 +0000
69+++ plainbox/plainbox/impl/commands/run.py 2014-08-08 12:19:52 +0000
70@@ -1020,4 +1020,4 @@
71 help=_('comma-separated list of key-value options (k=v) to '
72 'be passed to the transport'))
73 # Call enhance_parser from CheckBoxCommandMixIn
74- self.enhance_parser(parser)
75+ self.enhance_parser(parser, self.provider_list)
76
77=== modified file 'plainbox/requirements/pip-optional.txt'
78--- plainbox/requirements/pip-optional.txt 2014-01-30 09:12:57 +0000
79+++ plainbox/requirements/pip-optional.txt 2014-08-08 12:19:52 +0000
80@@ -1,1 +1,1 @@
81-# argcomplete==0.5.4
82+argcomplete==0.8.1
83
84=== modified file 'support/external-tarballs-revision.txt'
85--- support/external-tarballs-revision.txt 2014-04-04 16:31:35 +0000
86+++ support/external-tarballs-revision.txt 2014-08-08 12:19:52 +0000
87@@ -1,1 +1,1 @@
88-e73394e83aff317c77e003cf9b33ac8aa3372297
89+94eb2109d47da28d32915d523a6081ebf9bdcf02

Subscribers

People subscribed via source and target branches