Skip to content

Commit

Permalink
Fix intergration test
Browse files Browse the repository at this point in the history
Signed-off-by: Mecoli1219 <[email protected]>
  • Loading branch information
Mecoli1219 committed Aug 2, 2024
1 parent f665f4d commit f0196a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions flytekit/remote/init_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def init_remote(
default_domain: typing.Optional[str] = None,
data_upload_location: str = "flyte://my-s3-bucket/",
default_options: typing.Optional[Options] = None,
interactive_mode: bool = ipython_check(),
interactive_mode_enabled: bool = ipython_check(),
**kwargs,
):
"""
Expand All @@ -29,6 +29,7 @@ def init_remote(
:param data_upload_location: this is where all the default data will be uploaded when providing inputs.
The default location - `s3://my-s3-bucket/data` works for sandbox/demo environment. Please override this for non-sandbox cases.
:param default_options: default options to use when executing tasks or workflows remotely.
:param interactive_mode_enabled: If True, the client will be configured to work in interactive mode.
:return:
"""
global REMOTE_ENTRY, REMOTE_DEFAULT_OPTIONS
Expand All @@ -39,7 +40,7 @@ def init_remote(
default_project=default_project,
default_domain=default_domain,
data_upload_location=data_upload_location,
interactive_mode_enabled=interactive_mode,
interactive_mode_enabled=interactive_mode_enabled,
**kwargs,
)
# TODO: This should be merged into the FlyteRemote in the future
Expand Down
16 changes: 9 additions & 7 deletions tests/flytekit/integration/remote/test_jupyter_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def register():
@mock.patch("flytekit.tools.interactive.ipython_check")
def test_jupyter_remote_workflow(mock_ipython_check):
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
with pytest.raises(AssertionError):
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.child_workflow import parent_wf, double

# child_workflow.parent_wf asynchronously register a parent wf1 with child lp from another wf2.
Expand All @@ -69,7 +71,7 @@ def test_execute_jupyter_python_task(register):
"""Test execution of a @task-decorated python function that is already registered."""
with patch("flytekit.tools.interactive.ipython_check") as mock_ipython_check:
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
# init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.basic_workflow import t1

future = t1.remote(a=10, version=VERSION)
Expand All @@ -84,7 +86,7 @@ def test_execute_jupyter_python_workflow(register):
"""Test execution of a @workflow-decorated python function."""
with patch("flytekit.tools.interactive.ipython_check") as mock_ipython_check:
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
# init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.basic_workflow import my_basic_wf

future = my_basic_wf.remote(a=10, b="xyz", version=VERSION)
Expand All @@ -96,7 +98,7 @@ def test_execute_jupyter_python_workflow(register):
@mock.patch("flytekit.tools.interactive.ipython_check")
def test_fetch_execute_task_list_of_floats(mock_ipython_check):
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
# init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.list_float_wf import concat_list

xs: typing.List[float] = [0.1, 0.2, 0.3, 0.4, -99999.7]
Expand All @@ -108,7 +110,7 @@ def test_fetch_execute_task_list_of_floats(mock_ipython_check):
@mock.patch("flytekit.tools.interactive.ipython_check")
def test_fetch_execute_task_convert_dict(mock_ipython_check):
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
# init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.dict_str_wf import convert_to_string

d: typing.Dict[str, str] = {"key1": "value1", "key2": "value2"}
Expand All @@ -121,7 +123,7 @@ def test_fetch_execute_task_convert_dict(mock_ipython_check):
def test_execute_jupyter_python_workflow_dict_of_string_to_string(mock_ipython_check):
"""Test execution of a @workflow-decorated python function."""
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
# init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.dict_str_wf import my_dict_str_wf

d: typing.Dict[str, str] = {"k1": "v1", "k2": "v2"}
Expand All @@ -134,7 +136,7 @@ def test_execute_jupyter_python_workflow_dict_of_string_to_string(mock_ipython_c
def test_execute_jupyter_python_workflow_list_of_floats(mock_ipython_check):
"""Test execution of a @workflow-decorated python function."""
mock_ipython_check.return_value = True
init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
# init_remote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
from .workflows.basic.list_float_wf import my_list_float_wf

xs: typing.List[float] = [42.24, 999.1, 0.0001]
Expand Down

0 comments on commit f0196a1

Please sign in to comment.