From ea57e4cda696e5499672c8b33ee5387a98ecdbc6 Mon Sep 17 00:00:00 2001 From: ggydush-fn Date: Tue, 15 Feb 2022 11:21:23 -0800 Subject: [PATCH 1/2] Add local execute to pod task Signed-off-by: ggydush-fn --- plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py b/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py index a4872bb321..2649ab3f73 100644 --- a/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py +++ b/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py @@ -7,6 +7,7 @@ from flytekit import FlyteContext, PythonFunctionTask from flytekit.exceptions import user as _user_exceptions from flytekit.extend import Promise, SerializationSettings, TaskPlugins +from flytekit.loggers import logger from flytekit.models import task as _task_models _PRIMARY_CONTAINER_NAME_FIELD = "primary_container_name" @@ -120,7 +121,10 @@ def get_config(self, settings: SerializationSettings) -> Dict[str, str]: return {_PRIMARY_CONTAINER_NAME_FIELD: self.task_config.primary_container_name} def local_execute(self, ctx: FlyteContext, **kwargs) -> Union[Tuple[Promise], Promise, None]: - raise _user_exceptions.FlyteUserException("Local execute is not currently supported for pod tasks") + logger.warning( + "Running pod task locally. Local environment may not match pod environment which may cause issues." + ) + return super().local_execute(**kwargs) TaskPlugins.register_pythontask_plugin(Pod, PodFunctionTask) From 290600ddc5a793def547b09883b1b84592115136 Mon Sep 17 00:00:00 2001 From: ggydush-fn Date: Tue, 15 Feb 2022 11:29:15 -0800 Subject: [PATCH 2/2] Pass in context Signed-off-by: ggydush-fn --- plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py b/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py index 2649ab3f73..e9d7c93d95 100644 --- a/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py +++ b/plugins/flytekit-k8s-pod/flytekitplugins/pod/task.py @@ -124,7 +124,7 @@ def local_execute(self, ctx: FlyteContext, **kwargs) -> Union[Tuple[Promise], Pr logger.warning( "Running pod task locally. Local environment may not match pod environment which may cause issues." ) - return super().local_execute(**kwargs) + return super().local_execute(ctx=ctx, **kwargs) TaskPlugins.register_pythontask_plugin(Pod, PodFunctionTask)