<#1922 Add vscode plugin to enable interactive deb...
# flyte-github
a
#1922 Add vscode plugin to enable interactive debugging Pull request opened by troychiu TL;DR Add vscode plugin to enable interactive debugging Type ☐ Bug Fix ☐ Feature ☑︎ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☑︎ Unit tests added ☑︎ Code documentation added ☑︎ Any pending items have an associated Issue Complete description The Flytekit VSCode plugin offers an easy solution for users to run tasks within an interactive VSCode server, compatible with any image and any python task types (e.g. tfjob, pytorchjob, rayjob, etc). This plugin provides a
@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:
Copy code
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▾

Tracking Issue flyteorg/flyte#4284 Follow-up issue 1. shut down the server based on the idle time instead of a fix duration 2. support vscode plugin in the code server 3. automatically generate launch.json to support one click to run feature 4. detect whether a task run in local mode 5. Have a second entry point defined in the
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 checks