acoustic-carpenter-78188
10/30/2023, 7:35 AM@vscode decorator, which users can put within @task and user function.
In summary, @vscode decorator modifies a container to run a VSCode server:
1. Overrides the user function with a VSCode setup function.
2. Download vscode server from remote to local.
3. Launches and monitors the VSCode server.
4. Terminates after user specified duration.
End to end test
1. Build the image with Dockerfile.dev docker build --push . -f Dockerfile.dev -t localhost:30000/flytekit:dev --build-arg PYTHON_VERSION=3.8
2. Write a task with @vscode decorator and run the workflow on remote pyflyte run --remote --image localhost:30000/flytekit:dev vscode_task.py wf --a 30 --b 10
vscode_task.py:
from flytekit import task, workflow
from flytekitplugins.vscode import vscode
@task
@vscode
def t(a: int, b: int) -> int:
return a + b
@workflow
def wf(a: int, b: int) -> int:
out = t(a=a, b=b)
return out
3. forward a local port to the pod kubectl port-forward -n flytesnacks-development fd314dee47a304bffa75-n0-0 8080:8080
4. access the server by opening a web browser and navigating to localhost:8080
Screenshot:
e2e▾
launch.json which not only runs the task but also uploads the results and terminates the pod so that the workflow can then continue with the subsequent tasks.
flyteorg/flytekit
✅ All checks have passed
30/30 successful checksacoustic-carpenter-78188
10/30/2023, 7:35 AMacoustic-carpenter-78188
11/08/2023, 12:58 AM