Merge ~kissiel/plainbox:only-auto-after-suspend into plainbox:master

Proposed by Maciej Kisielewski
Status: Rejected
Rejected by: Maciej Kisielewski
Proposed branch: ~kissiel/plainbox:only-auto-after-suspend
Merge into: plainbox:master
Diff against target: 140 lines (+3/-78)
3 files modified
docs/manpages/plainbox-job-units.rst (+3/-14)
plainbox/impl/session/state.py (+0/-30)
plainbox/impl/session/test_state.py (+0/-34)
Reviewer Review Type Date Requested Status
Sylvain Pineau Pending
Checkbox Developers Pending
Review via email: mp+316746@code.launchpad.net

Description of the change

remove the also-after-suspend-auto flag

It seems that the only suspend job that we'll run in the foreseeable future is the automated one, so I think it'll be easier to just have one.

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

Unmerged commits

28455ee... by Maciej Kisielewski

remove the also-after-suspend-auto flag

It seems that the only suspend job that we'll run in the foreseeable future is
the automated one, so I think it'll be easier to just have one.

Signed-off-by: Maciej Kisielewski <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/docs/manpages/plainbox-job-units.rst b/docs/manpages/plainbox-job-units.rst
2index dcb022f..eab208a 100644
3--- a/docs/manpages/plainbox-job-units.rst
4+++ b/docs/manpages/plainbox-job-units.rst
5@@ -313,10 +313,6 @@ Following fields may be used by the job unit:
6
7 ``also-after-suspend``: See ``siblings`` below.
8
9-.. _job_flag_also_after_suspend_auto:
10-
11- ``also-after-suspend-auto``: See ``siblings`` below.
12-
13 Additional flags may be present in job definition; they are ignored.
14
15 ``siblings``:
16@@ -357,15 +353,14 @@ Following fields may be used by the job unit:
17 "_summary": "usb stress test_(port 3)"},
18 ]
19
20- For convenience two flags can be set (``also-after-suspend`` and
21- ``also-after-suspend-auto``) to create siblings with predefined settings to
22- add "after suspend" jobs.
23+ For convenience ``also-after-suspend`` flag can be set to create sibling
24+ with predefined setting to add "after suspend" jobs.
25
26 Given the base job::
27
28 id:foo
29 _summary: bar
30- flags: also-after-suspend also-after-suspend-auto
31+ flags: also-after-suspend
32 [...]
33
34 The ``also-after-suspend`` flag is a shortcut to create the following job::
35@@ -374,12 +369,6 @@ Following fields may be used by the job unit:
36 _summary: bar after suspend (S3)
37 depends: 2013.com.canonical.certification::suspend/suspend_advanced
38
39- ``also-after-suspend-auto`` is a shortcut to create the following job::
40-
41- id: after-suspend-auto-foo
42- _summary: bar after suspend (S3)
43- depends: 2013.com.canonical.certification::suspend/suspend_advanced_auto
44-
45 .. warning::
46 The curly braces used in this field have to be escaped when used in a
47 template job (python format, Jinja2 templates do not have this issue).
48diff --git a/plainbox/impl/session/state.py b/plainbox/impl/session/state.py
49index 38a8891..5fc47ac 100644
50--- a/plainbox/impl/session/state.py
51+++ b/plainbox/impl/session/state.py
52@@ -1122,8 +1122,6 @@ class SessionState:
53 if not key.endswith('siblings')
54 }
55 data['flags'] = data['flags'].replace('also-after-suspend', '')
56- data['flags'] = data['flags'].replace(
57- 'also-after-suspend-auto', '')
58 data['id'] = "after-suspend-{}".format(new_job.partial_id)
59 data['_summary'] = "{} after suspend (S3)".format(
60 new_job.summary)
61@@ -1144,34 +1142,6 @@ class SessionState:
62 parameters=new_job.parameters,
63 field_offset_map=new_job.field_offset_map),
64 recompute)
65- if 'also-after-suspend-auto' in new_job.get_flag_set():
66- data = {
67- key: value for key, value in new_job._data.items()
68- if not key.endswith('siblings')
69- }
70- data['flags'] = data['flags'].replace('also-after-suspend', '')
71- data['flags'] = data['flags'].replace(
72- 'also-after-suspend-auto', '')
73- data['id'] = "after-suspend-auto-{}".format(new_job.partial_id)
74- data['_summary'] = "{} after suspend (S3)".format(
75- new_job.summary)
76- provider_id = "2013.com.canonical.certification"
77- suspend_test_id = "suspend/suspend_advanced_auto"
78- if new_job.depends:
79- data['depends'] += " {}::{}".format(provider_id,
80- suspend_test_id)
81- else:
82- data['depends'] = "{}::{}".format(provider_id,
83- suspend_test_id)
84- self._add_job_unit(
85- JobDefinition(
86- data,
87- origin=new_job.origin,
88- provider=new_job.provider,
89- controller=new_job.controller,
90- parameters=new_job.parameters,
91- field_offset_map=new_job.field_offset_map),
92- recompute)
93 return new_job
94 else:
95 # If there is a clash report DependencyDuplicateError only when the
96diff --git a/plainbox/impl/session/test_state.py b/plainbox/impl/session/test_state.py
97index 9483dc0..95d85a3 100644
98--- a/plainbox/impl/session/test_state.py
99+++ b/plainbox/impl/session/test_state.py
100@@ -299,40 +299,6 @@ class SessionStateAPITests(TestCase):
101 session.job_state_map[sibling.id].readiness_inhibitor_list,
102 [UndesiredJobReadinessInhibitor])
103
104- def test_also_after_suspend_auto_flag(self):
105- # Define a job
106- job = make_job("A", summary="foo", flags='also-after-suspend-auto')
107- # Define an empty session
108- session = SessionState([])
109- # Add the job to the session
110- session.add_unit(job)
111- # Both jobs got added to job list
112- self.assertEqual(len(session.job_list), 2)
113- self.assertIn(job, session.job_list)
114- self.assertEqual(session.job_list[1].id, 'after-suspend-auto-A')
115- self.assertEqual(session.job_list[1].summary, 'foo after suspend (S3)')
116- self.assertEqual(
117- session.job_list[1].depends,
118- '2013.com.canonical.certification::suspend/suspend_advanced_auto')
119- sibling = session.job_list[1]
120- self.assertNotIn('also-after-suspend-auto', sibling.get_flag_set())
121- # Both jobs got added to job state map
122- self.assertIs(session.job_state_map[job.id].job, job)
123- self.assertIs(session.job_state_map[sibling.id].job, sibling)
124- # Both jobs are not added to the desired job list
125- self.assertNotIn(job, session.desired_job_list)
126- self.assertNotIn(sibling, session.desired_job_list)
127- # Both jobs are not in the run list
128- self.assertNotIn(job, session.run_list)
129- self.assertNotIn(sibling, session.run_list)
130- # Both jobs are not selected to run
131- self.assertEqual(
132- session.job_state_map[job.id].readiness_inhibitor_list,
133- [UndesiredJobReadinessInhibitor])
134- self.assertEqual(
135- session.job_state_map[sibling.id].readiness_inhibitor_list,
136- [UndesiredJobReadinessInhibitor])
137-
138 def test_get_estimated_duration_auto(self):
139 # Define jobs with an estimated duration
140 one_second = make_job("one_second", plugin="shell",

Subscribers

People subscribed via source and target branches