<#1977 New Features in VSCode Plugin: Auto server ...
# flyte-github
a
#1977 New Features in VSCode Plugin: Auto server termination after max idle time and default installation of python + jupyter notebook extensions Pull request opened by JasonZhu1313 New Features in VSCode Plugin: Auto server termination after max idle time and default installation of python + jupyter notebook extensions TL;DR Please replace this text with a description of what this PR accomplishes. This is a followup PR of VSCode Plugin contribution: #1922 with additional features: 1. Terminate the VSCode server after reaching the maximum idle time when no activity is detected. 2. Enabling the installation of VSCode plugins from VSCode plugin marketplace urls, by default python and jupyter notebook plugins. 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 How did you fix the bug, make the feature etc. Link to any design docs etc • Termination after max idle time Replace original hard coded server_up_seconds with max_idle_seconds, check the heartbeat file located at ~/.local/share/code-server/heartbeat ever 60 seconds source, if the duration if the time till last connection is longer than max idle seconds, terminate the VSCode server. • Installation of python + jupyter notebook extensions from urls Expose plugins_remote_paths argument in vscode annotation, so users could choose plugin urls they'd like to install. By default python and Jupyter notebook plugin will be installed. The urls of plugin follows this pattern:
Copy code
https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${extension name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
We'll be extracting the ${extension name} from url using regex as the extension name on local disk, the extension will be named with .vsix extension. Ex. Python plugin url
Copy code
https://ms-python.gallery.vsassets.io/_apis/public/gallery/publisher/ms-python/extension/python/2023.12.0/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
Will be downloaded on local disk as python.vsix for installation. Tracking Issue #1922 Tests The delta (duration in seconds after last activity detected) is refreshed after connected to vscode server. And server is terminated after delta reaches to max idle time.
Copy code
{"asctime": "2023-11-17 08:29:41,806", "name": "flytekit", "levelname": "INFO", "message": "heart beat path exist?: True"}
{"asctime": "2023-11-17 08:29:41,806", "name": "flytekit", "levelname": "INFO", "message": "The latest activity on code server is 238.5610237121582 seconds ago."}
{"asctime": "2023-11-17 08:29:41,806", "name": "flytekit", "levelname": "INFO", "message": "metadata"}
{"asctime": "2023-11-17 08:29:41,806", "name": "flytekit", "levelname": "INFO", "message": "238.5610237121582"}
{"asctime": "2023-11-17 08:29:41,806", "name": "flytekit", "levelname": "INFO", "message": "36000"}
{"asctime": "2023-11-17 08:29:41,806", "name": "flytekit", "levelname": "INFO", "message": "False"}
{"asctime": "2023-11-17 08:30:41,867", "name": "flytekit", "levelname": "INFO", "message": "heart beat path is here: /home/flytekit/.local/share/code-server/heartbeat"}
{"asctime": "2023-11-17 08:30:41,885", "name": "flytekit", "levelname": "INFO", "message": "heart beat path exist?: True"}
{"asctime": "2023-11-17 08:30:41,886", "name": "flytekit", "levelname": "INFO", "message": "The latest activity on code server is 14.362635612487793 seconds ago."}
{"asctime": "2023-11-17 08:30:41,886", "name": "flytekit", "levelname": "INFO", "message": "metadata"}
{"asctime": "2023-11-17 08:30:41,887", "name": "flytekit", "levelname": "INFO", "message": "14.362635612487793"}
{"asctime": "2023-11-17 08:30:41,887", "name": "flytekit", "levelname": "INFO", "message": "36000"}
{"asctime": "2023-11-17 08:30:41,888", "name": "flytekit", "levelname": "INFO", "message": "False"}
{"asctime": "2023-11-17 08:31:41,922", "name": "flytekit", "levelname": "INFO", "message": "heart beat path is here: /home/flytekit/.local/share/code-server/heartbeat"}
{"asctime": "2023-11-17 08:31:41,923", "name": "flytekit", "levelname": "INFO", "message": "heart beat path exist?: True"}
{"asctime": "2023-11-17 08:31:41,923", "name": "flytekit", "levelname": "INFO", "message": "The latest activity on code server is 14.39638066291809 seconds ago."}
{"asctime": "2023-11-17 08:31:41,923", "name": "flytekit", "levelname": "INFO", "message": "metadata"}
{"asctime": "2023-11-17 08:31:41,923", "name": "flytekit", "levelname": "INFO", "message": "14.39638066291809"}
{"asctime": "2023-11-17 08:31:41,923", "name": "flytekit", "levelname": "INFO", "message": "36000"}
{"asctime": "2023-11-17 08:31:41,923", "name": "flytekit", "levelname": "INFO", "message": "False"}
Plugins are installed successfully

Screenshot 2023-11-18 at 9 54 40 AM▾

flyteorg/flytekit ✅ All checks have passed 30/30 successful checks