From 67375590dec22f2e38f81593ea01d84e40e661a8 Mon Sep 17 00:00:00 2001 From: RapidPoseidon Date: Thu, 18 Jun 2026 16:59:46 +0000 Subject: [PATCH] feat(benchmark): add disable/enable and rename to participant Co-Authored-By: Claude Opus 4.8 Co-Authored-By: lino --- docs/mri_advanced.md | 19 ++++++++ .../benchmark/participant/participant.py | 43 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/docs/mri_advanced.md b/docs/mri_advanced.md index ff72a2534..bab2f8fe3 100644 --- a/docs/mri_advanced.md +++ b/docs/mri_advanced.md @@ -173,6 +173,25 @@ elo = participant.get_elo() # None if not computed yet print(f"{participant.name}: {elo}") ``` +### Renaming a Participant + +```python +participant = benchmark.participants[0] +participant.rename("New model name") +``` + +### Disabling Participants + +A disabled participant is excluded from evaluation and the computed standings. Unlike deleting, this is reversible: + +```python +participant = benchmark.participants[0] +participant.disable() + +# Bring it back into the evaluation later +participant.enable() +``` + ### Deleting Participants You can remove a participant — and its uploaded media — from the benchmark. This cannot be undone: diff --git a/src/rapidata/rapidata_client/benchmark/participant/participant.py b/src/rapidata/rapidata_client/benchmark/participant/participant.py index 88cba905b..aff1aa876 100644 --- a/src/rapidata/rapidata_client/benchmark/participant/participant.py +++ b/src/rapidata/rapidata_client/benchmark/participant/participant.py @@ -101,6 +101,49 @@ def run(self) -> None: ) self._status = ParticipantStatus.SUBMITTED + def disable(self) -> None: + """Disables the participant in the benchmark. + + A disabled participant is excluded from evaluation and the computed + standings. Use :meth:`enable` to reverse this. + """ + with tracer.start_as_current_span("BenchmarkParticipant.disable"): + self._openapi_service.leaderboard.participant_api.participant_participant_id_disable_post( + participant_id=self.id + ) + self._status = ParticipantStatus.DISABLED + + def enable(self) -> None: + """Re-enables a previously disabled participant. + + The participant returns to the ``Submitted`` state and is included in + evaluation and standings again. + """ + with tracer.start_as_current_span("BenchmarkParticipant.enable"): + self._openapi_service.leaderboard.participant_api.participant_participant_id_enable_post( + participant_id=self.id + ) + self._status = ParticipantStatus.SUBMITTED + + def rename(self, name: str) -> None: + """Renames the participant. + + Args: + name: The new name of the participant. + """ + from rapidata.api_client.models.update_participant_name_endpoint_input import ( + UpdateParticipantNameEndpointInput, + ) + + with tracer.start_as_current_span("BenchmarkParticipant.rename"): + self._openapi_service.leaderboard.participant_api.participant_participant_id_name_put( + participant_id=self.id, + update_participant_name_endpoint_input=UpdateParticipantNameEndpointInput( + name=name + ), + ) + self.name = name + def __str__(self) -> str: return f"BenchmarkParticipant(name={self.name}, id={self.id}, status={self._status})"