Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyflyte run use config path from arg value #996

Merged
merged 2 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions flytekit/clis/sdk_in_container/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
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
from flytekit.core.context_manager import FlyteContext
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
Expand Down Expand Up @@ -527,9 +529,14 @@ 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)
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)

Expand Down
1 change: 1 addition & 0 deletions flytekit/configuration/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down