-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
196 additions
and
18 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,3 +1,3 @@ | ||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence. | ||
* @wild-endeavor @kumare3 @eapolinario @pingsutw | ||
* @wild-endeavor @kumare3 @eapolinario @pingsutw @cosmicBboy |
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from flyteidl.admin.signal_pb2 import Signal, SignalList | ||
from mock import MagicMock | ||
|
||
from flytekit.configuration import Config | ||
from flytekit.core.context_manager import FlyteContextManager | ||
from flytekit.core.type_engine import TypeEngine | ||
from flytekit.models.core.identifier import SignalIdentifier, WorkflowExecutionIdentifier | ||
from flytekit.remote.remote import FlyteRemote | ||
|
||
|
||
def test_remote_list_signals(): | ||
ctx = FlyteContextManager.current_context() | ||
wfeid = WorkflowExecutionIdentifier("p", "d", "execid") | ||
signal_id = SignalIdentifier(signal_id="sigid", execution_id=wfeid).to_flyte_idl() | ||
lt = TypeEngine.to_literal_type(int) | ||
signal = Signal( | ||
id=signal_id, | ||
type=lt.to_flyte_idl(), | ||
value=TypeEngine.to_literal(ctx, 3, int, lt).to_flyte_idl(), | ||
) | ||
|
||
mock_client = MagicMock() | ||
mock_client.list_signals.return_value = SignalList(signals=[signal], token="") | ||
|
||
remote = FlyteRemote(config=Config.auto(), default_project="p1", default_domain="d1") | ||
remote._client = mock_client | ||
res = remote.list_signals("execid", "p", "d", limit=10) | ||
assert len(res) == 1 | ||
|
||
|
||
def test_remote_set_signal(): | ||
mock_client = MagicMock() | ||
|
||
def checker(request): | ||
assert request.id.signal_id == "sigid" | ||
assert request.value.scalar.primitive.integer == 3 | ||
|
||
mock_client.set_signal.side_effect = checker | ||
|
||
remote = FlyteRemote(config=Config.auto(), default_project="p1", default_domain="d1") | ||
remote._client = mock_client | ||
remote.set_signal("sigid", "execid", 3) |