Skip to content

Enable job retry #2927

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 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions kernelci/api/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def receive_event_node(self, sub_id):
continue
if all(self.pubsub_event_filter(sub_id, obj)
for obj in [node, event]):
return node, event.get('is_hierarchy')
return node, event.get('is_hierarchy'), event.get('is_retry')

def _find_container(self, field, node):
"""
Expand Down Expand Up @@ -441,7 +441,7 @@ def _is_job_filtered(self, node):
return False

def create_job_node(self, job_config, input_node,
runtime=None, platform=None):
runtime=None, platform=None, retry_counter=0):
"""Create a new job node based on input and configuration"""
jobfilter = input_node.get('jobfilter')
platform_filter = input_node.get('platform_filter')
Expand All @@ -459,6 +459,7 @@ def create_job_node(self, job_config, input_node,
'data': {
'kernel_revision': input_node['data']['kernel_revision'],
},
'retry_counter': retry_counter,
}
if jobfilter:
job_node['jobfilter'] = jobfilter
Expand Down
4 changes: 4 additions & 0 deletions kernelci/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@
description="Flag to indicate if the node was processed by KCIDB-Bridge",
default=False
)
retry_counter: int = Field(
default=0,
description="Number of times the job has retried"
)

OBJECT_ID_FIELDS: ClassVar[list] = ['parent']
TIMESTAMP_FIELDS: ClassVar[list] = ['created', 'updated', 'timeout', 'holdoff']
Expand Down Expand Up @@ -426,7 +430,7 @@
default='checkout',
description='Type of the object',
)
data: CheckoutData = Field(

Check failure on line 433 in kernelci/api/models.py

View workflow job for this annotation

GitHub Actions / Lint

Incompatible types in assignment (expression has type "CheckoutData", base class "Node" defined the type as "dict[str, Any] | None") [assignment]
description="Checkout details",
default=None
)
Expand Down Expand Up @@ -501,7 +505,7 @@
default='kbuild',
description='Type of the object',
)
data: KbuildData = Field(

Check failure on line 508 in kernelci/api/models.py

View workflow job for this annotation

GitHub Actions / Lint

Incompatible types in assignment (expression has type "KbuildData", base class "Node" defined the type as "dict[str, Any] | None") [assignment]
description="Kbuild details",
default=None
)
Expand Down Expand Up @@ -596,7 +600,7 @@
default='test',
description='Type of the object',
)
data: TestData = Field(

Check failure on line 603 in kernelci/api/models.py

View workflow job for this annotation

GitHub Actions / Lint

Incompatible types in assignment (expression has type "TestData", base class "Node" defined the type as "dict[str, Any] | None") [assignment]
description="Test details",
default=None
)
Expand All @@ -613,7 +617,7 @@
default='job',
description='Type of the object',
)
data: TestData = Field(

Check failure on line 620 in kernelci/api/models.py

View workflow job for this annotation

GitHub Actions / Lint

Incompatible types in assignment (expression has type "TestData", base class "Node" defined the type as "dict[str, Any] | None") [assignment]
description="Test suite details",
default=None
)
Expand Down Expand Up @@ -695,7 +699,7 @@
"FAIL if the regression is still 'active', ie. the test "
"is still failing"),
)
data: RegressionData = Field(

Check failure on line 702 in kernelci/api/models.py

View workflow job for this annotation

GitHub Actions / Lint

Incompatible types in assignment (expression has type "RegressionData", base class "Node" defined the type as "dict[str, Any] | None") [assignment]
description="Regression details",
default=None
)
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_receive_event_node(get_api_config, mock_receive_event,
"op": "created"
},
)
resp, _ = helper.receive_event_node(sub_id=sub_id)
resp, _, _ = helper.receive_event_node(sub_id=sub_id)
assert resp.keys() == {
'id',
'artifacts',
Expand Down