Skip to content

Conversation

@pmahindrakar-oss
Copy link
Contributor

@pmahindrakar-oss pmahindrakar-oss commented Dec 11, 2025

Tracking issue

Codeserver pods fail to shutdown even after the flytekit configured 10 hour timeout

What changes were proposed in this pull request?

Use the officially recommended approach to use the environment variable

What is the heartbeat file?
As long as there is an active browser connection, code-server touches ~/.local/share/code-server/heartbeat once a minute.

If you want to shutdown code-server if there hasn't been an active connection after a predetermined amount of time, you can use the --idle-timeout-seconds flag or set an CODE_SERVER_IDLE_TIMEOUT_SECONDS environment variable.

How was this patch tested?

Trivial change

import flytekit
from flytekit import ImageSpec
from flytekit.interactive import vscode

new_flytekit = "git+https://github.com/flyteorg/flytekit@fea9b277c63d3cf3f143ac78434afa17df776dfa"
image = ImageSpec(
    apt_packages=["git"],
    packages=["numpy", new_flytekit],
    registry="pingsutw",
)


@flytekit.task(container_image=image)
@vscode
def t1():
    print("hello")


@flytekit.workflow
def wf1():
    t1()

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

  • This pull request introduces an environment variable to set an idle timeout for the code-server, replacing the previous reliance on a heartbeat file.
  • The change aims to ensure that code-server pods can shut down gracefully after a specified period of inactivity, addressing issues with pods failing to terminate as expected.
  • The implementation is straightforward and follows the recommended approach from the code-server documentation.
  • Overall, this update introduces a new environment variable for idle timeout configuration, impacting the code-server module.

Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com>
Copy link
Member

@machichima machichima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this timeout is only set through the flytekit constant, this change make sense to me! Leaving this just as a note

MAX_IDLE_SECONDS = 10 * HOURS_TO_SECONDS # 10 hours

Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.52%. Comparing base (6a4c2d8) to head (fea9b27).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3357       +/-   ##
===========================================
+ Coverage   80.27%   92.52%   +12.24%     
===========================================
  Files         417        8      -409     
  Lines       32477      722    -31755     
  Branches     2979        0     -2979     
===========================================
- Hits        26071      668    -25403     
+ Misses       5601       54     -5547     
+ Partials      805        0      -805     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pingsutw pingsutw merged commit 010a0ef into master Dec 11, 2025
115 of 119 checks passed
@flyte-bot
Copy link
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants