Skip to content

Commit 80bfe41

Browse files
authored
Merge pull request #215 from AlmaLinux/pf-168-runner-cost-classmethod
PF-168: use classmethod for runner queue cost determination
2 parents 9493a79 + 9f4dd01 commit 80bfe41

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

alts/scheduler/scheduling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def schedule_test_task(self, payload: TaskRequestPayload):
124124
repo_counter += 1
125125
repositories.append({'url': repository.baseurl, 'name': repo_name})
126126

127-
queue_name = f'{runner_type}-{queue_arch}-{runner_class.COST}'
127+
queue_name = f'{runner_type}-{queue_arch}-{runner_class.get_cost(payload.release_build)}'
128128
task_id = str(uuid.uuid4())
129129
task_params = payload.model_dump()
130130
task_params['task_id'] = task_id

alts/worker/runners/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class BaseRunner(object):
189189
s390x=['s390x'],
190190
)
191191
COST = 0
192+
193+
@classmethod
194+
def get_cost(cls, release_build: bool = False) -> int:
195+
return cls.COST
196+
192197
TF_VARIABLES_FILE = None
193198
TF_MAIN_FILE = None
194199
TF_VERSIONS_FILE = 'versions.tf'

alts/worker/runners/opennebula.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ class OpennebulaRunner(GenericVMRunner):
3535
"""Opennebula environment runner for testing tasks."""
3636

3737
TYPE = 'opennebula'
38+
COST_STANDARD = 1
39+
COST_RELEASE_BUILD = 2
40+
41+
@classmethod
42+
def get_cost(cls, release_build: bool = False) -> int:
43+
return cls.COST_RELEASE_BUILD if release_build else cls.COST_STANDARD
44+
3845
TEMPFILE_PREFIX = 'opennebula_test_runner_'
3946
TF_VARIABLES_FILE = 'opennebula.tfvars'
4047
TF_MAIN_FILE = 'opennebula.tf'

0 commit comments

Comments
 (0)