Skip to content

Commit

Permalink
Add deprecation note to pyflyte serialize (#2716)
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor authored Sep 3, 2024
1 parent d97090d commit 952a17a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/source/design/clis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,23 @@ Both the commands have their own place in a production Flyte setting.
.. note ::
Neither ``pyflyte register`` nor ``pyflyte run`` commands work on Python namespace packages since both the tools traverse the filesystem to find the first folder that doesn't have an __init__.py file, which is interpreted as the root of the project. Both the commands use this root as the basis to name the Flyte entities.
How to move away from the ``pyflyte serialize`` command?
========================================================

The ``serialize`` command is deprecated around the end of Q3 2024. Users should move to the ``package`` command instead as the two commands provide nearly identical functionality.

Migrate
-------
To use the ``package`` command, make the following changes:
* The ``--local-source-root`` option should be changed to ``--source``
* If the already ``--in-container-virtualenv-root`` option was specified, then move to the ``--python-interpreter`` option in ``package``. The default Python interpreter for serialize was based on this deprecated flag, and if not specified, ``sys.executable``. The default for ``package`` is ``/opt/venv/bin/python3``. If that is not where the Python interpreter is located in the task container, then you'll need to now specify ``--python-interpreter``. Note that this was only used for Spark tasks.
* The ``--in-container-config-path`` option should be removed as this was not actually being used by the ``serialize`` command.


Functional Changes
------------------
Beyond the options, the ``package`` command differs in that
* Whether or not to use fast register should be specified by the ``--copy auto`` or ``--copy all`` flags, rather than ``fast`` being a subcommand.
* The serialized file output by default is in a .tgz file, rather than being separate files. This means that any subsequent ``flytectl register`` command will need to be updated with the ``--archive`` flag.
7 changes: 7 additions & 0 deletions flytekit/clis/sdk_in_container/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import typing
from enum import Enum

import rich
import rich_click as click

from flytekit.clis.sdk_in_container import constants
Expand Down Expand Up @@ -136,6 +137,12 @@ def serialize(
ctx.obj[CTX_IMAGE] = image_config
ctx.obj[CTX_LOCAL_SRC_ROOT] = local_source_root
ctx.obj[CTX_ENV] = env
rich.print(
"[bold bright_green on black][Deprecation notice]\nThis 'serialize' command is being deprecated,"
" please move to using 'package' instead."
" See [link=https://docs.flyte.org/en/latest/api/flytekit/design/clis.html#pyflyte]docs[/link]"
" for more information.[/]\n"
)
click.echo(f"Serializing Flyte elements with image {image_config}")

if in_container_virtualenv_root:
Expand Down

0 comments on commit 952a17a

Please sign in to comment.