Skip to content

Commit

Permalink
Fix Task.replica_rank
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Jul 13, 2024
1 parent 8e86fcc commit e93f710
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use patch releases for compatibility fixes instead.

## Unreleased

### Fixed

- Fixed `Task.replica_rank` to be set to the right value now instead of always `None`.

## [v1.31.0](https://github.com/allenai/beaker-py/releases/tag/v1.31.0) - 2024-07-08

### Added
Expand Down
12 changes: 11 additions & 1 deletion beaker/data_model/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ class Task(BaseModel):
schedulable: bool = False
jobs: Tuple[Job, ...] = Field(default_factory=tuple)
owner: Optional[Account] = None
replica_rank: Optional[int] = None
# replica_rank: Optional[int] = None

@property
def replica_rank(self) -> Optional[int]:
if (
(job := self.latest_job) is not None
and job.execution is not None
and (replica_rank := job.execution.replica_rank) is not None
):
return replica_rank
return None

@property
def display_name(self) -> str:
Expand Down

0 comments on commit e93f710

Please sign in to comment.