From ef7ca54dba2ea3b257670c8b16ce2f1af9c28f36 Mon Sep 17 00:00:00 2001 From: taieeuu Date: Sun, 19 Jan 2025 01:37:49 +0800 Subject: [PATCH 1/4] feat: add conditions for executing pyflyte-fast-execute. Signed-off-by: taieeuu --- flytekit/tools/translator.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flytekit/tools/translator.py b/flytekit/tools/translator.py index ee905a4218..347bb2a015 100644 --- a/flytekit/tools/translator.py +++ b/flytekit/tools/translator.py @@ -170,7 +170,15 @@ def get_serializable_task( # ly for certain kinds of tasks. Specifically, # tasks that rely on user code defined in the container. This should be encapsulated by the auto container # parent class - container._args = prefix_with_fast_execute(settings, container.args) + if ( + (not hasattr(entity, "container_image")) + or (not entity.container_image) + or (entity.container_image and not entity.container_image.source_root) + ): + container._args = prefix_with_fast_execute(settings, container.args) + + # elif not entity.container_image.source_root: + # container._args = prefix_with_fast_execute(settings, container.args) # If the pod spec is not None, we have to get it again, because the one we retrieved above will be incorrect. # The reason we have to call get_k8s_pod again, instead of just modifying the command in this file, is because From 1e42eb9712a9ff7f7917ac0c6d6d974c9e11724a Mon Sep 17 00:00:00 2001 From: taieeuu Date: Tue, 28 Jan 2025 10:31:41 +0800 Subject: [PATCH 2/4] opt Signed-off-by: taieeuu --- flytekit/tools/translator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flytekit/tools/translator.py b/flytekit/tools/translator.py index 991b4bc89b..d260ddc396 100644 --- a/flytekit/tools/translator.py +++ b/flytekit/tools/translator.py @@ -172,7 +172,7 @@ def get_serializable_task( # parent class if ( (not hasattr(entity, "container_image")) - or (not entity.container_image) + or (entity.container_image is None) or (entity.container_image and not entity.container_image.source_root) ): container._args = prefix_with_fast_execute(settings, container.args) From 4f31745c5b7ace96028cf18badbc8cb4b5d551aa Mon Sep 17 00:00:00 2001 From: taieeuu Date: Tue, 28 Jan 2025 10:39:08 +0800 Subject: [PATCH 3/4] no msg Signed-off-by: taieeuu --- flytekit/tools/translator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flytekit/tools/translator.py b/flytekit/tools/translator.py index d260ddc396..247032df35 100644 --- a/flytekit/tools/translator.py +++ b/flytekit/tools/translator.py @@ -173,7 +173,7 @@ def get_serializable_task( if ( (not hasattr(entity, "container_image")) or (entity.container_image is None) - or (entity.container_image and not entity.container_image.source_root) + or (isinstance(entity.container_image, ImageSpec) and entity.container_image.source_root is not None) ): container._args = prefix_with_fast_execute(settings, container.args) From cf17684a18f58faf9764f0e434536fa9a699a79d Mon Sep 17 00:00:00 2001 From: taieeuu Date: Tue, 28 Jan 2025 10:42:07 +0800 Subject: [PATCH 4/4] opt Signed-off-by: taieeuu --- flytekit/tools/translator.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/flytekit/tools/translator.py b/flytekit/tools/translator.py index 247032df35..91d158b7f9 100644 --- a/flytekit/tools/translator.py +++ b/flytekit/tools/translator.py @@ -177,9 +177,6 @@ def get_serializable_task( ): container._args = prefix_with_fast_execute(settings, container.args) - # elif not entity.container_image.source_root: - # container._args = prefix_with_fast_execute(settings, container.args) - # If the pod spec is not None, we have to get it again, because the one we retrieved above will be incorrect. # The reason we have to call get_k8s_pod again, instead of just modifying the command in this file, is because # the pod spec is a K8s library object, and we shouldn't be messing around with it in this file.