Skip to content

Add LAVA runtime job definition getter method #2872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions kernelci/runtime/lava.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
def __init__(self, data):
"""This class can be used to parse LAVA callback data"""
self._data = data
self._meta = None

def get_data(self):
"""Get the raw callback data"""
Expand All @@ -96,11 +95,13 @@
"""Get the ID of the tested device"""
return self._data.get('actual_device_id')

def get_job_definition(self, key):
"""Get the job definition"""
return yaml.safe_load(self._data.get('definition')).get(key)

def get_meta(self, key):
"""Get a metadata value from the job definition"""
if self._meta is None:
self._meta = yaml.safe_load(self._data['definition'])['metadata']
return self._meta.get(key)
return self.get_job_definition('metadata').get(key)

def get_job_status(self):
"""Get the job status"""
Expand Down Expand Up @@ -312,7 +313,7 @@
submitter = node.get('submitter')
if submitter and submitter != 'service:pipeline':
priority = priority + 1
if priority > self.config.priority_max:

Check warning on line 316 in kernelci/runtime/lava.py

View workflow job for this annotation

GitHub Actions / Lint

Consider using 'priority = min(priority, priority_max)' instead of unnecessary if block
priority = self.config.priority_max
return priority

Expand Down