generated from allenai/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Beaker.experiment.rename()
method (#58)
- Loading branch information
Showing
4 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,38 @@ | ||
from beaker import Beaker, CurrentJobStatus | ||
from beaker import ( | ||
Beaker, | ||
CurrentJobStatus, | ||
ExperimentSpec, | ||
ImageSource, | ||
ResultSpec, | ||
TaskContext, | ||
TaskSpec, | ||
) | ||
|
||
|
||
def test_experiment_get(client: Beaker, hello_world_experiment_id): | ||
def test_experiment_get(client: Beaker, hello_world_experiment_id: str): | ||
exp = client.experiment.get(hello_world_experiment_id) | ||
assert exp.id == hello_world_experiment_id | ||
assert exp.jobs | ||
assert exp.jobs[0].status.current == CurrentJobStatus.finalized | ||
|
||
|
||
def test_experiment_create_await_rename( | ||
client: Beaker, experiment_name: str, alternate_experiment_name: str, beaker_cluster_name: str | ||
): | ||
spec = ExperimentSpec( | ||
tasks=[ | ||
TaskSpec( | ||
name="main", | ||
image=ImageSource(docker="hello-world"), | ||
context=TaskContext(cluster=beaker_cluster_name), | ||
result=ResultSpec(path="/unused"), # required even if the task produces no output. | ||
), | ||
], | ||
) | ||
experiment = client.experiment.create(experiment_name, spec) | ||
experiment = client.experiment.await_all(experiment, timeout=60 * 3) | ||
logs = "".join([line.decode() for line in client.experiment.logs(experiment)]) | ||
assert logs | ||
|
||
experiment = client.experiment.rename(experiment, alternate_experiment_name) | ||
assert experiment.name == alternate_experiment_name |