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

Add back attempt to use existing serialization settings when running #1529

Merged
merged 2 commits into from
Mar 1, 2023
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
4 changes: 2 additions & 2 deletions flytekit/bin/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def setup_execution(
if compressed_serialization_settings:
ss = SerializationSettings.from_transport(compressed_serialization_settings)
ssb = ss.new_builder()
ssb.project = exe_project
ssb.domain = exe_domain
ssb.project = ssb.project or exe_project
ssb.domain = ssb.domain or exe_domain
ssb.version = tk_version
if dynamic_addl_distro:
ssb.fast_serialization_settings = FastSerializationSettings(
Expand Down
17 changes: 17 additions & 0 deletions tests/flytekit/unit/bin/test_python_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from flyteidl.core.errors_pb2 import ErrorDocument

from flytekit.bin.entrypoint import _dispatch_execute, normalize_inputs, setup_execution
from flytekit.configuration import Image, ImageConfig, SerializationSettings
from flytekit.core import context_manager
from flytekit.core.base_task import IgnoreOutputs
from flytekit.core.data_persistence import DiskPersistence
Expand Down Expand Up @@ -310,6 +311,22 @@ def test_dispatch_execute_system_error(mock_write_to_file, mock_upload_dir, mock
assert ed.error.origin == execution_models.ExecutionError.ErrorKind.SYSTEM


def test_persist_ss():
default_img = Image(name="default", fqn="test", tag="tag")
ss = SerializationSettings(
project="proj1",
domain="dom",
version="version123",
env=None,
image_config=ImageConfig(default_image=default_img, images=[default_img]),
)
ss_txt = ss.serialized_context
os.environ["_F_SS_C"] = ss_txt
with setup_execution("s3://", checkpoint_path=None, prev_checkpoint=None) as ctx:
assert ctx.serialization_settings.project == "proj1"
assert ctx.serialization_settings.domain == "dom"


def test_setup_disk_prefix():
with setup_execution("qwerty") as ctx:
assert isinstance(ctx.file_access._default_remote, DiskPersistence)
Expand Down