Skip to content

Commit 605a7c3

Browse files
committed
Add lava runtime job definition getter method
Signed-off-by: Simone Tollardo <tollsimy.dev@protonmail.com>
1 parent 023a470 commit 605a7c3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernelci/runtime/lava.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class Callback:
8686
def __init__(self, data):
8787
"""This class can be used to parse LAVA callback data"""
8888
self._data = data
89-
self._meta = None
9089

9190
def get_data(self):
9291
"""Get the raw callback data"""
@@ -95,12 +94,14 @@ def get_data(self):
9594
def get_device_id(self):
9695
"""Get the ID of the tested device"""
9796
return self._data.get('actual_device_id')
97+
98+
def get_job_definition(self, key):
99+
"""Get the job definition"""
100+
return yaml.safe_load(self._data.get('definition')).get(key)
98101

99102
def get_meta(self, key):
100103
"""Get a metadata value from the job definition"""
101-
if self._meta is None:
102-
self._meta = yaml.safe_load(self._data['definition'])['metadata']
103-
return self._meta.get(key)
104+
return self.get_job_definition('metadata').get(key)
104105

105106
def get_job_status(self):
106107
"""Get the job status"""

0 commit comments

Comments
 (0)