Skip to content

Commit 7843daf

Browse files
committed
(scheduler) Implement architecture filter
If checkout node has architecture filter (restriction by architectures), we need to allow only listed arches to kbuild. Signed-off-by: Denys Fedoryshchenko <[email protected]>
1 parent 9a58368 commit 7843daf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/scheduler.py

+15
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@ def _verify_frequency(self, job, node, platform):
288288
return False
289289
return True
290290

291+
def _verify_architecture_filter(self, job, node):
292+
"""Verify if the job can be run, if node has architecture filter
293+
"""
294+
if job.kind == 'kbuild' and 'architecture_filter' in node['data'] and \
295+
node['data']['architecture_filter'] and \
296+
job.params['arch'] not in node['data']['architecture_filter']:
297+
msg = f"Node {node['id']} has architecture filter "
298+
msg += f"{node['data']['architecture_filter']} "
299+
msg += f"job {job.name} is kbuild and arch {job.params['arch']}"
300+
print(msg)
301+
return False
302+
return True
303+
291304
def _run(self, sub_id):
292305
self.log.info("Listening for available checkout events")
293306
self.log.info("Press Ctrl-C to stop.")
@@ -304,6 +317,8 @@ def _run(self, sub_id):
304317
if job.params.get('frequency', None):
305318
if not self._verify_frequency(job, input_node, platform):
306319
continue
320+
if not self._verify_architecture_filter(job, input_node):
321+
continue
307322
if self._api_helper.should_create_node(rules, input_node):
308323
self._run_job(job, runtime, platform, input_node)
309324

0 commit comments

Comments
 (0)