Skip to content

Commit

Permalink
remove cleanup param in local init (#10293)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Dec 9, 2023
1 parent 685634d commit 5c60d37
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
6 changes: 0 additions & 6 deletions sdk/python/kfp/local/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __new__(
cls,
runner: SubprocessRunner,
pipeline_root: str,
cleanup: bool,
raise_on_error: bool,
) -> 'LocalExecutionConfig':
# singleton pattern
Expand All @@ -43,20 +42,17 @@ def __init__(
self,
runner: SubprocessRunner,
pipeline_root: str,
cleanup: bool,
raise_on_error: bool,
) -> None:
self.runner = runner
self.pipeline_root = pipeline_root
self.cleanup = cleanup
self.raise_on_error = raise_on_error


def init(
# more runner types will eventually be supported
runner: SubprocessRunner,
pipeline_root: str = './local_outputs',
cleanup: bool = False,
raise_on_error: bool = True,
) -> None:
"""Initializes a local execution session.
Expand All @@ -66,13 +62,11 @@ def init(
Args:
runner: The runner to use. Currently only SubprocessRunner is supported.
pipeline_root: Destination for task outputs.
cleanup: Whether to ensure outputs are cleaned up after execution. If True, the task will be run in a temporary directory, rather than pipeline_root.
raise_on_error: If True, raises an exception when a local task execution fails. If Falls, fails gracefully and does not terminal the current program.
"""
# updates a global config
LocalExecutionConfig(
runner=runner,
pipeline_root=pipeline_root,
cleanup=cleanup,
raise_on_error=raise_on_error,
)
10 changes: 0 additions & 10 deletions sdk/python/kfp/local/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,25 @@ def test_local_runner_config_init(self):
config.LocalExecutionConfig(
pipeline_root='my/local/root',
runner=local.SubprocessRunner(use_venv=True),
cleanup=True,
raise_on_error=True,
)

instance = config.LocalExecutionConfig.instance

self.assertEqual(instance.pipeline_root, 'my/local/root')
self.assertEqual(instance.runner, local.SubprocessRunner(use_venv=True))
self.assertIs(instance.cleanup, True)
self.assertIs(instance.raise_on_error, True)

def test_local_runner_config_is_singleton(self):
"""Test instance attributes with multiple constructor calls."""
config.LocalExecutionConfig(
pipeline_root='my/local/root',
runner=local.SubprocessRunner(),
cleanup=True,
raise_on_error=True,
)
config.LocalExecutionConfig(
pipeline_root='other/local/root',
runner=local.SubprocessRunner(use_venv=False),
cleanup=False,
raise_on_error=False,
)

Expand All @@ -59,7 +55,6 @@ def test_local_runner_config_is_singleton(self):
self.assertEqual(instance.pipeline_root, 'other/local/root')
self.assertEqual(instance.runner,
local.SubprocessRunner(use_venv=False))
self.assertFalse(instance.cleanup, False)
self.assertFalse(instance.raise_on_error, False)


Expand All @@ -73,26 +68,22 @@ def test_init_more_than_once(self):
local.init(
pipeline_root='my/local/root',
runner=local.SubprocessRunner(use_venv=True),
cleanup=True,
)

instance = config.LocalExecutionConfig.instance

self.assertEqual(instance.pipeline_root, 'my/local/root')
self.assertEqual(instance.runner, local.SubprocessRunner(use_venv=True))
self.assertTrue(instance.cleanup, True)

def test_init_more_than_once(self):
"""Test config instance attributes with multiple init() calls."""
local.init(
pipeline_root='my/local/root',
runner=local.SubprocessRunner(),
cleanup=True,
)
local.init(
pipeline_root='other/local/root',
runner=local.SubprocessRunner(use_venv=False),
cleanup=False,
raise_on_error=False,
)

Expand All @@ -101,7 +92,6 @@ def test_init_more_than_once(self):
self.assertEqual(instance.pipeline_root, 'other/local/root')
self.assertEqual(instance.runner,
local.SubprocessRunner(use_venv=False))
self.assertFalse(instance.cleanup, False)
self.assertFalse(instance.raise_on_error, False)


Expand Down

0 comments on commit 5c60d37

Please sign in to comment.