ancient-wolf-19325
07/03/2024, 11:48 AMimport 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"
)
# Answer
No, the code as is will not work due to several issues:
1. Syntax Errors: The -> arrow is incorrectly represented as ->. It should be ->.
2. Missing Imports: FlytePickle is imported but not used.
3. Remote Execution: The remote.execute method is not correctly used for executing a local workflow. It is meant for executing workflows that are already registered in the Flyte backend.
Would you like more detail on how to fix these issues?
Sources:
- https://discuss.flyte.org/t/16059805/hi-everyone-did-anyone-manage-to-get-the-getting-started-gui/
- https://discuss.flyte.org/t/9706518/very-newbie-question-did-anyone-run-into-this-issue-when-run/
Slack Link
https://flyte-org.slack.com/archives/CP2HDHKE1/p1720007275.590869 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.