Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: troychiu <y.troychiu@gmail.com>
  • Loading branch information
troychiu committed Oct 28, 2023
1 parent f9ab885 commit 5940843
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
20 changes: 20 additions & 0 deletions plugins/flytekit-vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Flytekit VSCode Plugin

Flytekit VSCode plugin provides an simple way for users to run the task as a interactive vscode server with any image. `@vscode` is a decorator which users can put within @task and user function. With `@vscode`, the task will install vscode dependencies and run a vscode server instead of the user defined functions.

To install the plugin, run the following command:

```bash
pip install flytekitplugins-vscode
```

## Task Example
```python
from flytekit import task
from flytekitplugins.vscode import vscode

@task
@vscode
def train():
...
```
5 changes: 3 additions & 2 deletions plugins/flytekit-vscode/flytekitplugins/vscode/vscode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
from functools import wraps
import sys
import time
import os
import multiprocessing
Expand Down Expand Up @@ -130,6 +131,7 @@ def inner_wrapper(*args, **kwargs):
# 0. Executes the pre_execute function if provided.
if pre_execute is not None:
pre_execute()
print_flush("Pre execute function executed successfully!")

# 1. Downloads the VSCode server from Internet to local.
code_server_bin = download_vscode(
Expand All @@ -156,8 +158,7 @@ def inner_wrapper(*args, **kwargs):
print_flush("Post execute function executed successfully!")
child_process.terminate()
child_process.join()

return
sys.exit(0)

return inner_wrapper

Expand Down
Empty file.
Empty file.

0 comments on commit 5940843

Please sign in to comment.