Merge lp:~zyga/checkbox/story-1063 into lp:checkbox

Proposed by Zygmunt Krynicki
Status: Merged
Approved by: Daniel Manrique
Approved revision: 3164
Merged at revision: 3174
Proposed branch: lp:~zyga/checkbox/story-1063
Merge into: lp:checkbox
Diff against target: 153 lines (+6/-43)
5 files modified
plainbox/plainbox/impl/commands/analyze.py (+2/-2)
plainbox/plainbox/impl/commands/run.py (+2/-2)
plainbox/plainbox/impl/ctrl.py (+1/-4)
plainbox/plainbox/impl/secure/qualifiers.py (+0/-3)
plainbox/plainbox/impl/session/state.py (+1/-32)
To merge this branch: bzr merge lp:~zyga/checkbox/story-1063
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+230098@code.launchpad.net

Description of the change

9d63656 Revert "plainbox: crazy-hack, add hacky template dependencies"

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

ohh and I really liked the crazy hack :/

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

I'll come back as a full feature but for now it has to go (release time soon)

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plainbox/plainbox/impl/commands/analyze.py'
2--- plainbox/plainbox/impl/commands/analyze.py 2014-08-04 16:51:36 +0000
3+++ plainbox/plainbox/impl/commands/analyze.py 2014-08-08 12:25:36 +0000
4@@ -56,7 +56,7 @@
5 p.get_units()[0] for p in provider_list]))
6 self.session = SessionState(self.unit_list)
7 self.desired_job_list = self._get_matching_job_list(
8- ns, self.session.job_list + self.session.get_fake_job_list())
9+ ns, self.session.job_list)
10 self.problem_list = self.session.update_desired_job_list(
11 self.desired_job_list)
12
13@@ -126,7 +126,7 @@
14 result = runner.run_job(job, self.config)
15 self.session.update_job_result(job, result)
16 new_desired_job_list = self._get_matching_job_list(
17- self.ns, self.session.job_list + self.session.get_fake_job_list())
18+ self.ns, self.session.job_list)
19 new_problem_list = self.session.update_desired_job_list(
20 new_desired_job_list)
21 if new_problem_list:
22
23=== modified file 'plainbox/plainbox/impl/commands/run.py'
24--- plainbox/plainbox/impl/commands/run.py 2014-08-04 16:51:44 +0000
25+++ plainbox/plainbox/impl/commands/run.py 2014-08-08 12:25:36 +0000
26@@ -685,7 +685,7 @@
27 # Compute the desired job list, this can give us notification about
28 # problems in the selected jobs. Currently we just display each problem
29 desired_job_list = self._get_matching_job_list(
30- self.ns, self.state.job_list + self.state.get_fake_job_list())
31+ self.ns, self.state.job_list)
32 print(self.C.header(_("Analyzing Jobs")))
33 self._update_desired_job_list(desired_job_list)
34
35@@ -956,7 +956,7 @@
36 _run_all_selected_jobs()
37 """
38 new_matching_job_list = self._get_matching_job_list(
39- self.ns, self.state.job_list + self.state.get_fake_job_list())
40+ self.ns, self.state.job_list)
41 self._update_desired_job_list(new_matching_job_list)
42 self._backtrack_and_run_missing = True
43
44
45=== modified file 'plainbox/plainbox/impl/ctrl.py'
46--- plainbox/plainbox/impl/ctrl.py 2014-08-04 16:51:36 +0000
47+++ plainbox/plainbox/impl/ctrl.py 2014-08-08 12:25:36 +0000
48@@ -115,12 +115,9 @@
49 """
50 direct = DependencyMissingError.DEP_TYPE_DIRECT
51 resource = DependencyMissingError.DEP_TYPE_RESOURCE
52- result = set(itertools.chain(
53+ return set(itertools.chain(
54 zip(itertools.repeat(direct), job.get_direct_dependencies()),
55 zip(itertools.repeat(resource), job.get_resource_dependencies())))
56- if hasattr(job, 'template_resource_id'):
57- result.add((resource, job.template_resource_id))
58- return result
59
60 def get_inhibitor_list(self, session_state, job):
61 """
62
63=== modified file 'plainbox/plainbox/impl/secure/qualifiers.py'
64--- plainbox/plainbox/impl/secure/qualifiers.py 2014-08-04 16:51:36 +0000
65+++ plainbox/plainbox/impl/secure/qualifiers.py 2014-08-08 12:25:36 +0000
66@@ -129,9 +129,6 @@
67 This method should not be called directly, it is an implementation
68 detail of SimpleQualifier class.
69 """
70- if getattr(job, 'is_fake', False):
71- should_match = re.match(job.id, self.pattern_text[1:-1]) is not None
72- return should_match
73 return self._pattern.match(job.id) is not None
74
75 @property
76
77=== modified file 'plainbox/plainbox/impl/session/state.py'
78--- plainbox/plainbox/impl/session/state.py 2014-08-04 16:51:36 +0000
79+++ plainbox/plainbox/impl/session/state.py 2014-08-08 12:25:36 +0000
80@@ -21,7 +21,6 @@
81 :mod:`plainbox.impl.session.state` -- session state handling
82 ============================================================
83 """
84-import itertools
85 import logging
86
87 from plainbox.i18n import gettext as _
88@@ -29,7 +28,6 @@
89 from plainbox.impl.depmgr import DependencyDuplicateError
90 from plainbox.impl.depmgr import DependencyError
91 from plainbox.impl.depmgr import DependencySolver
92-from plainbox.impl.resource import Resource
93 from plainbox.impl.session.jobs import JobState
94 from plainbox.impl.session.jobs import UndesiredJobReadinessInhibitor
95 from plainbox.impl.signal import Signal
96@@ -431,16 +429,13 @@
97 # to remove a problematic job and re-try. The loop provides a stop
98 # condition as we will eventually run out of jobs.
99 problems = []
100- # Get additional fake jobs that might be generated if we instantiate
101- # templates later on, from resources we don't yet have.
102- fake_job_list = self.get_fake_job_list()
103 while self._desired_job_list:
104 # XXX: it might be more efficient to incorporate this 'recovery
105 # mode' right into the solver, this way we'd probably save some
106 # resources or runtime complexity.
107 try:
108 self._run_list = DependencySolver.resolve_dependencies(
109- self._job_list + fake_job_list, self._desired_job_list)
110+ self._job_list, self._desired_job_list)
111 except DependencyError as exc:
112 # When a dependency error is detected remove the affected job
113 # form _desired_job_list and try again.
114@@ -451,10 +446,6 @@
115 else:
116 # Don't iterate the loop if there was no exception
117 break
118- # Filter-out fake jobs before we try to show them
119- self._run_list = [
120- job for job in self._run_list
121- if getattr(job, 'is_fake', False) is False]
122 # Update all job readiness state
123 self._recompute_job_readiness()
124 # Return all dependency problems to the caller
125@@ -645,28 +636,6 @@
126 """
127 return self._job_list
128
129- def get_fake_job_list(self):
130- fake_job_list = []
131- for unit in self.unit_list:
132- if unit.unit != 'template':
133- continue
134- resource_id = unit.resource_id
135- state = self.job_state_map.get(resource_id)
136- if state is not None and state.result.outcome is None:
137- fake_params = Resource({
138- key: '.*'
139- for key in set(
140- itertools.chain(
141- *unit.get_accessed_parameters(
142- force=True).values()))
143- })
144- fake_job = unit.instantiate_one(fake_params)
145- fake_job.is_fake = True
146- fake_job.template_resource_id = resource_id
147- logger.debug("Adding fake job: %s", fake_job.id)
148- fake_job_list.append(fake_job)
149- return fake_job_list
150-
151 @property
152 def unit_list(self):
153 """

Subscribers

People subscribed via source and target branches