Is the following code supposed to work as is? ```...
# flyte-support
m
Is the following code supposed to work as is?
Copy code
import pandas as pd
from sklearn.datasets import load_wine

from flytekit import task, workflow
from flytekit.configuration import ImageConfig, Config
from flytekit.types.pickle import FlytePickle
from flytekit.remote import FlyteRemote

# 🧱 @task decorators define the building blocks of your pipeline
@task
def get_data() -> pd.DataFrame:
    """Get the wine dataset."""
    return load_wine(as_frame=True).frame


# 🔀 @workflows decorators define the flow of data through the tasks
@workflow
def training_workflow(x:int) -> pd.DataFrame:
    """Put all of the steps together into a single workflow."""
    data = get_data()
    return data


# FlyteRemote object is the main entrypoint to API
remote = FlyteRemote(
    config=Config.auto(),
    default_project="flytesnacks",
    default_domain="development",
)

remote.execute(
    training_workflow,
    inputs={'x':0},
    image_config=ImageConfig.auto_default_image(),
    version="v2"
    )
f
Someone can give you an example of pyflyte run
m
I am quite familiar with pyflyte run already. I am only missing working examples of FlyteRemote, with locally defined functions, not fetched remotely.
t
what's the error you're seeing?
m
k8s says complains about the module having no name
So, will remote.execute copy the code inside the container?
t
i don't think so. would you mind (fast) registering first? you can then execute the workflow. https://flyte-org.slack.com/archives/CP2HDHKE1/p1715859849565609?thread_ts=1715770992.831729&cid=CP2HDHKE1
m
Is
remote.fast_package
deprecated?
Tried with register_script instead of fast_package, but I still get the same error.
😞
t
register_script
should work. have you tried
register_workflow
instead? it has a better interface than
register_script
. the example i've shared registers using the
register_workflow
method.
fast_package
isn't deprecated.
register_script
uses
fast_package
under the hood.
m
Ok, now I get it: I am using the sandbox union.ai (the 3hr trial) and there is an outdated package there. Now that I upgraded flytekit, I see fast_package. Let's see if it works now.
Ok, finally I made some progress. This worked.
t
awesome! would you mind letting me know what the outdated packaged was? was it flytekit? how have you upgraded?
m
pip install -U flytekit
👍 1
f
cc @miniature-traffic-86643 just start using union serverless
also cc @high-park-82026 / @white-painting-22485 / @silly-toddler-37820 folks keep using the old version of union sandbox (flyte)