Skip to content

Commit 06131cb

Browse files
committed
Fix rerun when reusing exisitng launch_uuid
1 parent c70cd9b commit 06131cb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

reportportal_client/client.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ class RPClient(RP):
401401
_skip_analytics: str
402402
_item_stack: LifoQueue
403403
_log_batcher: LogBatcher[RPRequestLog]
404+
is_rerun: bool
404405

405406
@property
406407
def launch_uuid(self) -> Optional[str]:
@@ -523,6 +524,7 @@ def __init__(
523524
self.launch_uuid_print = launch_uuid_print
524525
self.print_output = print_output
525526
self.truncate_attributes = truncate_attributes
527+
self.is_rerun = False # will be updated in start_launch
526528

527529
self.api_key = api_key
528530
if not self.api_key:
@@ -567,7 +569,8 @@ def start_launch(
567569
'rerun' option.
568570
:return: Launch UUID if successfully started or None.
569571
"""
570-
if not self.use_own_launch:
572+
self.is_rerun = rerun
573+
if not self.use_own_launch and not self.is_rerun:
571574
return self.launch_uuid
572575
url = uri_join(self.base_url_v2, "launch")
573576
request_payload = LaunchStartRequest(
@@ -576,6 +579,7 @@ def start_launch(
576579
attributes=verify_value_length(attributes) if self.truncate_attributes else attributes,
577580
description=description,
578581
mode=self.mode,
582+
uuid=self.launch_uuid,
579583
rerun=rerun,
580584
rerun_of=rerun_of,
581585
).payload
@@ -745,7 +749,7 @@ def finish_launch(
745749
PASSED, FAILED, STOPPED, SKIPPED, CANCELLED
746750
:param attributes: Launch attributes
747751
"""
748-
if self.use_own_launch:
752+
if self.use_own_launch or self.is_rerun:
749753
if self.launch_uuid is NOT_FOUND or not self.launch_uuid:
750754
logger.warning("Attempt to finish non-existent launch")
751755
return

0 commit comments

Comments
 (0)