-
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.
Merge pull request #2 from flyteorg/add-try-number
add try number to execution name
- Loading branch information
Showing
5 changed files
with
24 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import unittest | ||
from datetime import timedelta | ||
from unittest import mock | ||
|
||
import pytest | ||
|
@@ -15,7 +14,7 @@ | |
class TestFlyteHook(unittest.TestCase): | ||
|
||
flyte_conn_id = "flyte_default" | ||
execution_name = "flyte20220330t133856" | ||
execution_name = "flyt1202203301338565" | ||
conn_type = "flyte" | ||
host = "localhost" | ||
port = "30081" | ||
|
@@ -26,7 +25,6 @@ class TestFlyteHook(unittest.TestCase): | |
kubernetes_service_account = "default" | ||
version = "v1" | ||
inputs = {"name": "hello world"} | ||
timeout = timedelta(seconds=3600) | ||
oauth2_client = {"client_id": "123", "client_secret": "456"} | ||
secrets = [{"group": "secrets", "key": "123"}] | ||
notifications = [{"phases": [1], "email": {"recipients_email": ["[email protected]"]}}] | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
import pytest | ||
from airflow import AirflowException | ||
from airflow.models import Connection | ||
from airflow.models import Connection, TaskInstance | ||
from airflow.models.dagrun import DagRun | ||
|
||
from flyte_provider.operators.flyte import FlyteOperator | ||
|
@@ -25,7 +25,7 @@ class TestFlyteOperator(unittest.TestCase): | |
labels = {"key1": "value1"} | ||
version = "v1" | ||
inputs = {"name": "hello world"} | ||
execution_name = "testf20220330t135508" | ||
execution_name = "test1202203301355087" | ||
oauth2_client = {"client_id": "123", "client_secret": "456"} | ||
secrets = [{"group": "secrets", "key": "123"}] | ||
notifications = [{"phases": [1], "email": {"recipients_email": ["[email protected]"]}}] | ||
|
@@ -64,7 +64,11 @@ def test_execute(self, mock_get_connection, mock_trigger_execution): | |
notifications=self.notifications, | ||
) | ||
result = operator.execute( | ||
{"dag_run": DagRun(run_id=self.run_id), "task": operator} | ||
{ | ||
"dag_run": DagRun(run_id=self.run_id), | ||
"task": operator, | ||
"task_instance": TaskInstance(task=operator), | ||
} | ||
) | ||
|
||
assert result == self.execution_name | ||
|
@@ -107,7 +111,13 @@ def test_on_kill_success( | |
secrets=self.secrets, | ||
notifications=self.notifications, | ||
) | ||
operator.execute({"dag_run": DagRun(run_id=self.run_id), "task": operator}) | ||
operator.execute( | ||
{ | ||
"dag_run": DagRun(run_id=self.run_id), | ||
"task": operator, | ||
"task_instance": TaskInstance(task=operator), | ||
} | ||
) | ||
operator.on_kill() | ||
|
||
mock_get_connection.has_calls([mock.call(self.flyte_conn_id)] * 2) | ||
|
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