From a1369b03d1faf61347b4377c066d759ada1ce7e7 Mon Sep 17 00:00:00 2001 From: Bhumika Goel Date: Thu, 9 May 2024 08:58:53 -0500 Subject: [PATCH 1/3] check feature flag for codegen --- src/snowflake/cli/plugins/nativeapp/manager.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/snowflake/cli/plugins/nativeapp/manager.py b/src/snowflake/cli/plugins/nativeapp/manager.py index 3c5ac0649d..50910ba80d 100644 --- a/src/snowflake/cli/plugins/nativeapp/manager.py +++ b/src/snowflake/cli/plugins/nativeapp/manager.py @@ -31,6 +31,9 @@ source_path_to_deploy_path, translate_artifact, ) +from snowflake.cli.plugins.nativeapp.codegen.compiler import ( + _find_and_execute_processors, +) from snowflake.cli.plugins.nativeapp.constants import ( ALLOWED_SPECIAL_COMMENTS, COMMENT_COL, @@ -47,6 +50,7 @@ MissingPackageScriptError, UnexpectedOwnerError, ) +from snowflake.cli.plugins.nativeapp.feature_flags import FeatureFlag from snowflake.cli.plugins.nativeapp.utils import verify_exists, verify_no_directories from snowflake.cli.plugins.stage.diff import ( DiffResult, @@ -309,7 +313,14 @@ def build_bundle(self) -> ArtifactDeploymentMap: """ Populates the local deploy root from artifact sources. """ - return build_bundle(self.project_root, self.deploy_root, self.artifacts) + mapped_files = build_bundle(self.project_root, self.deploy_root, self.artifacts) + if FeatureFlag.ENABLE_SETUP_SCRIPT_GENERATION.is_enabled(): + _find_and_execute_processors( + project_definition=self._project_definition, + project_root=self.project_root, + deploy_root=self.deploy_root, + ) + return mapped_files def sync_deploy_root_with_stage( self, From be3b982d10547496c9b6d11a7ffcfa5f896c32db Mon Sep 17 00:00:00 2001 From: Bhumika Goel Date: Thu, 9 May 2024 09:06:01 -0500 Subject: [PATCH 2/3] add print for collected entities --- .../cli/plugins/nativeapp/codegen/snowpark/python_processor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py b/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py index d0661cf45f..0d7892f4f3 100644 --- a/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py +++ b/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py @@ -195,6 +195,9 @@ def process( collected_entities = None src_py_file_to_collected_entities[dest_file] = collected_entities + cc.message(f"This is the file path in deploy root: {dest_file}\n") + cc.message("This is the list of collected entities:") + cc.message(collected_entities) if collected_entities is None: continue From 05140deed8a2867d584541d60d5a17fbfc6ddc1d Mon Sep 17 00:00:00 2001 From: Bhumika Goel Date: Thu, 9 May 2024 09:39:25 -0500 Subject: [PATCH 3/3] conditional check on printing nonetype --- .../nativeapp/codegen/snowpark/python_processor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py b/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py index 0d7892f4f3..0fda9b8a4f 100644 --- a/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py +++ b/src/snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py @@ -195,13 +195,15 @@ def process( collected_entities = None src_py_file_to_collected_entities[dest_file] = collected_entities - cc.message(f"This is the file path in deploy root: {dest_file}\n") - cc.message("This is the list of collected entities:") - cc.message(collected_entities) if collected_entities is None: + cc.message("No entities could be collected from the file path.") continue + cc.message(f"This is the file path in deploy root: {dest_file}\n") + cc.message("This is the list of collected entities:") + cc.message(collected_entities) + # 4. Enrich entities by setting additional properties for entity in collected_entities: _enrich_entity(