forked from wandb/wandb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(launch): Support template variables when queueing launch runs (w…
- Loading branch information
1 parent
57d16d8
commit 5528355
Showing
9 changed files
with
459 additions
and
149 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
49 changes: 49 additions & 0 deletions
49
tests/pytest_tests/system_tests/tests_launch/test_public_api.py
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import pytest | ||
import wandb | ||
import wandb.apis.public | ||
import wandb.util | ||
from wandb import Api | ||
from wandb.sdk.internal.internal_api import UnsupportedError | ||
|
||
|
||
def test_create_run_queue_template_variables_not_supported(runner, user, monkeypatch): | ||
queue_name = "tvqueue" | ||
queue_config = {"e": ["{{var1}}"]} | ||
queue_template_variables = { | ||
"var1": {"schema": {"type": "string", "enum": ["a", "b"]}} | ||
} | ||
|
||
def patched_push_to_run_queue_introspection(*args, **kwargs): | ||
args[0].server_supports_template_varaibles = False | ||
return False | ||
|
||
monkeypatch.setattr( | ||
wandb.sdk.internal.internal_api.Api, | ||
"push_to_run_queue_introspection", | ||
patched_push_to_run_queue_introspection, | ||
) | ||
with runner.isolated_filesystem(): | ||
api = Api(api_key=user) | ||
with pytest.raises(UnsupportedError): | ||
api.create_run_queue( | ||
entity=user, | ||
name=queue_name, | ||
type="local-container", | ||
config=queue_config, | ||
template_variables=queue_template_variables, | ||
) | ||
|
||
|
||
def test_run_queue(user): | ||
api = Api() | ||
queue = api.create_run_queue( | ||
name="test-queue", | ||
entity=user, | ||
type="local-container", | ||
) | ||
try: | ||
assert queue.name == "test-queue" | ||
assert queue.access == "PROJECT" | ||
assert queue.type == "local-container" | ||
finally: | ||
queue.delete() |
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
Oops, something went wrong.