From f0196a13bfde491936955028f622a129a1bd95f3 Mon Sep 17 00:00:00 2001 From: Mecoli1219 Date: Fri, 2 Aug 2024 12:50:32 +0800 Subject: [PATCH] Fix intergration test Signed-off-by: Mecoli1219 --- flytekit/remote/init_remote.py | 5 +++-- .../integration/remote/test_jupyter_remote.py | 16 +++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/flytekit/remote/init_remote.py b/flytekit/remote/init_remote.py index 493a31f5338..009c863a10d 100644 --- a/flytekit/remote/init_remote.py +++ b/flytekit/remote/init_remote.py @@ -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, ): """ @@ -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 @@ -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 diff --git a/tests/flytekit/integration/remote/test_jupyter_remote.py b/tests/flytekit/integration/remote/test_jupyter_remote.py index 82612f5e905..12799f262cc 100644 --- a/tests/flytekit/integration/remote/test_jupyter_remote.py +++ b/tests/flytekit/integration/remote/test_jupyter_remote.py @@ -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. @@ -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) @@ -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) @@ -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] @@ -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"} @@ -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"} @@ -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]