From 642003ce15c847c8089254f14aa1bb4fe0c6c282 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Wed, 11 May 2022 14:59:13 +0800 Subject: [PATCH 1/2] pyflyte run use config path from arg value Signed-off-by: Kevin Su --- flytekit/clis/sdk_in_container/run.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flytekit/clis/sdk_in_container/run.py b/flytekit/clis/sdk_in_container/run.py index 2d23b11ae4..8f2a29d208 100644 --- a/flytekit/clis/sdk_in_container/run.py +++ b/flytekit/clis/sdk_in_container/run.py @@ -13,6 +13,7 @@ from pytimeparse import parse from flytekit import BlobType, Literal, Scalar +from flytekit.clis.sdk_in_container.constants import CTX_CONFIG_FILE, CTX_DOMAIN, CTX_PROJECT from flytekit.configuration import Config, ImageConfig, SerializationSettings from flytekit.configuration.default_images import DefaultImages from flytekit.core import context_manager, tracker @@ -527,9 +528,9 @@ def get_command(self, ctx, workflow): wf_entity = load_naive_entity(module, workflow) # If this is a remote execution, which we should know at this point, then create the remote object - p = ctx.obj[RUN_LEVEL_PARAMS_KEY].get("project") - d = ctx.obj[RUN_LEVEL_PARAMS_KEY].get("domain") - r = FlyteRemote(Config.auto(), default_project=p, default_domain=d) + p = ctx.obj[RUN_LEVEL_PARAMS_KEY].get(CTX_PROJECT) + d = ctx.obj[RUN_LEVEL_PARAMS_KEY].get(CTX_DOMAIN) + r = FlyteRemote(Config.auto(ctx.obj.get(CTX_CONFIG_FILE)), default_project=p, default_domain=d) ctx.obj[FLYTE_REMOTE_INSTANCE_KEY] = r get_upload_url_fn = functools.partial(r.client.get_upload_signed_url, project=p, domain=d) From 88e045d935748411dfa51810cd21bd4e5a771962 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 11 May 2022 09:46:36 -0700 Subject: [PATCH 2/2] add some logging Signed-off-by: Yee Hing Tong --- flytekit/clis/sdk_in_container/run.py | 8 +++++++- flytekit/configuration/file.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flytekit/clis/sdk_in_container/run.py b/flytekit/clis/sdk_in_container/run.py index 8f2a29d208..81f5cf83f1 100644 --- a/flytekit/clis/sdk_in_container/run.py +++ b/flytekit/clis/sdk_in_container/run.py @@ -21,6 +21,7 @@ from flytekit.core.data_persistence import FileAccessProvider from flytekit.core.type_engine import TypeEngine from flytekit.core.workflow import PythonFunctionWorkflow, WorkflowBase +from flytekit.loggers import cli_logger from flytekit.models import literals from flytekit.models.interface import Variable from flytekit.models.literals import Blob, BlobMetadata, Primitive @@ -530,7 +531,12 @@ def get_command(self, ctx, workflow): # If this is a remote execution, which we should know at this point, then create the remote object p = ctx.obj[RUN_LEVEL_PARAMS_KEY].get(CTX_PROJECT) d = ctx.obj[RUN_LEVEL_PARAMS_KEY].get(CTX_DOMAIN) - r = FlyteRemote(Config.auto(ctx.obj.get(CTX_CONFIG_FILE)), default_project=p, default_domain=d) + cfg_file_location = ctx.obj.get(CTX_CONFIG_FILE) + cfg_obj = Config.auto(cfg_file_location) + cli_logger.info( + f"Run is using config object {cfg_obj}" + (f" with file {cfg_file_location}" if cfg_file_location else "") + ) + r = FlyteRemote(cfg_obj, default_project=p, default_domain=d) ctx.obj[FLYTE_REMOTE_INSTANCE_KEY] = r get_upload_url_fn = functools.partial(r.client.get_upload_signed_url, project=p, domain=d) diff --git a/flytekit/configuration/file.py b/flytekit/configuration/file.py index b9e1c81426..5ba5db91d1 100644 --- a/flytekit/configuration/file.py +++ b/flytekit/configuration/file.py @@ -237,6 +237,7 @@ def get_config_file(c: typing.Union[str, ConfigFile, None]) -> typing.Optional[C # If not, then return None and let caller handle return None if isinstance(c, str): + logger.debug(f"Using specified config file at {c}") return ConfigFile(c) return c