Skip to content
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

Update synchronized_start_timeout to use nanoseconds #273

Merged
merged 1 commit into from
May 2, 2024
Merged
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
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

- Update `synchronized_start_timeout` to send nanoseconds to the Beaker server instead of a string.

## [v1.26.8](https://github.com/allenai/beaker-py/releases/tag/v1.26.8) - 2024-05-01

- Added new fields `JobStatus.ready`, `JobExecution.replica_rank`, and `JobExecution.replica_group_id`.
Expand Down
10 changes: 8 additions & 2 deletions beaker/data_model/experiment_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ class TaskSpec(BaseModel, frozen=False):
Determines if whole experiment should fail if this task failures.
"""

synchronized_start_timeout: Optional[str] = None
synchronized_start_timeout: Optional[int] = None
"""
If set, jobs in the replicated task will wait to start, up to the specified timeout,
until all other jobs are also ready. If the timeout is reached, the job will be canceled.
Must be greater than zero and less than or equal to 48 hours.
Represented using nanoseconds, must be greater than zero and less than or equal to 48 hours.
"""

@classmethod
Expand Down Expand Up @@ -472,6 +472,12 @@ def new(
else:
constraints = Constraints(cluster=[cluster])

# Allow setting the timeout using seconds, rather than nanoseconds.
synchronized_start_timeout_str = kwargs.pop("synchronized_start_timeout", None)
if synchronized_start_timeout_str is not None:
synchronized_start_timeout = int(synchronized_start_timeout_str * 1_000_000_000)
kwargs["synchronized_start_timeout"] = synchronized_start_timeout

return TaskSpec(
name=name,
image=ImageSource(beaker=beaker_image, docker=docker_image),
Expand Down
Loading