Skip to content

Commit c85df75

Browse files
[utasks] Delete unused code (#3627)
We're not filtering queue tasks.
1 parent a4f62b5 commit c85df75

File tree

3 files changed

+1
-80
lines changed

3 files changed

+1
-80
lines changed

src/clusterfuzz/_internal/base/tasks.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@
8080
TASK_PAYLOAD_KEY = 'task_payload'
8181
TASK_END_TIME_KEY = 'task_end_time'
8282

83-
FILTERS_AND = ' AND '
84-
FILTERS_OR = ' OR '
85-
8683
POSTPROCESS_QUEUE = 'postprocess'
8784

8885
# See https://github.com/google/clusterfuzz/issues/3347 for usage
@@ -210,42 +207,6 @@ def get_regular_task(queue=None):
210207
return task
211208

212209

213-
# TODO(metzman): Use this function so that linux bots can execute preprocess and
214-
# postprocess of every utask.
215-
def get_utask_filters(is_chromium, is_linux):
216-
"""Returns a string containing filters for pubsub commands. If |is_chromium|
217-
and |is_linux| the filters filter out all commands that are not the trusted
218-
portions (preprocess and postprocess of utasks). The filter should be used to
219-
read from non-linux queues so linux bots can do the trusted preprocess step of
220-
non-linux utasks. Otherwise the filters should be used when reading from the
221-
bot's "normal" queue to filter out these preprocess/postprocess steps."""
222-
if not is_chromium:
223-
# Execute all tasks on one machine outside of chrome for now.
224-
return None
225-
226-
# Import here to avoid import errors on webapp.
227-
from clusterfuzz._internal.bot.tasks import task_types
228-
229-
# See https://cloud.google.com/pubsub/docs/subscription-message-filter for
230-
# syntax.
231-
utask_trusted_portions = task_types.get_utask_trusted_portions()
232-
if is_linux:
233-
pubsub_filters = [
234-
f'attribute.name = {task}' for task in utask_trusted_portions
235-
]
236-
else:
237-
pubsub_filters = [
238-
f'-attribute.name = {task}' for task in utask_trusted_portions
239-
]
240-
pubsub_filter = FILTERS_AND.join(pubsub_filters)
241-
return pubsub_filter
242-
243-
244-
def get_ttask_commands_queues():
245-
"""Get queues tworkers should be querying for ttask commands. (i.e. tworkers
246-
on Linux will need to know about the Windows and Mac queues)."""
247-
248-
249210
def get_machine_template_for_queue(queue_name):
250211
"""Gets the machine template for the instance used to execute a task from
251212
|queue_name|. This will be used by tworkers to schedule the appropriate

src/clusterfuzz/_internal/google_cloud_utils/pubsub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def modify_ack_deadline(self, subscription, ack_ids, seconds):
123123
"""Modify acknowledgement deadline of messages."""
124124
body = {
125125
'ackIds': ack_ids,
126-
'ackDeadlineSeconds': int(seconds), # since time.time() is float.
126+
'ackDeadlineSeconds': int(seconds), # Since time.time() is float.
127127
}
128128

129129
request = self._api_client().projects().subscriptions().modifyAckDeadline(

src/clusterfuzz/_internal/tests/core/base/tasks_test.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -78,46 +78,6 @@ def test_initialize_untrusted_task(self):
7878
self.assertEqual(task.job, 'none')
7979

8080

81-
class GetUtaskFiltersTest(unittest.TestCase):
82-
"""Tests for get_utask_filters."""
83-
84-
# TODO(metzman): Restore tests when feature is used.
85-
# def test_chromium_linux(self):
86-
# """Tests that the get_utask_filters only has linux bots in chrome
87-
# clusterfuzz executing preprocess. This test is temporary and
88-
# will be removed when the migration is complete."""
89-
# # TOOD(metzman): Delete this test when it is no longer needed.
90-
# filters = tasks.get_utask_filters(is_chromium=True, is_linux=True)
91-
# self.assertEqual(
92-
# filters,
93-
# 'attribute.name = analyze AND attribute.name = postprocess AND attribute.name = variant'
94-
# )
95-
96-
# def test_chromium_nonlinux(self):
97-
# """Tests that the get_utask_filters only has linux bots in chrome
98-
# clusterfuzz executing preprocess and postprocess. This test is temporary and
99-
# will be removed when the migration is complete."""
100-
# # TOOD(metzman): Delete this test when it is no longer needed.
101-
# filters = tasks.get_utask_filters(is_chromium=True, is_linux=False)
102-
# # Analyze will be begun only on Linux bots.
103-
# self.assertEqual(
104-
# filters,
105-
# '-attribute.name = analyze AND -attribute.name = postprocess AND -attribute.name = variant'
106-
# )
107-
108-
def test_external_linux(self):
109-
"""Tests that the get_utask_filters only has linux bots in chrome
110-
clusterfuzz executing preprocess and postprocess."""
111-
filters = tasks.get_utask_filters(is_chromium=False, is_linux=True)
112-
self.assertIsNone(filters)
113-
114-
def test_external_nonlinux(self):
115-
"""Tests that the get_utask_filters only has linux bots in chrome
116-
clusterfuzz executing preprocess and postprocess."""
117-
filters = tasks.get_utask_filters(is_chromium=False, is_linux=False)
118-
self.assertIsNone(filters)
119-
120-
12181
class GetMachineTemplateForQueueTests(unittest.TestCase):
12282
"""Tests that we know the specs of an instance to launch a batch task on."""
12383

0 commit comments

Comments
 (0)