-
Notifications
You must be signed in to change notification settings - Fork 115
Use status files to retrieve PID #1805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1805 +/- ##
==========================================
- Coverage 47.37% 47.36% -0.01%
==========================================
Files 233 232 -1
Lines 28649 28644 -5
==========================================
- Hits 13572 13568 -4
+ Misses 14062 14059 -3
- Partials 1015 1017 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
831204f
to
366e4bf
Compare
191d6de
to
919cddb
Compare
a3f08a4
to
094ecd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: It looks like the status for remote workloads is still reading from the PID file instead of the status file, is that intentional?
toolhive/pkg/workloads/manager.go
Lines 870 to 889 in ffdb3ff
func (d *defaultManager) getRemoteWorkloadState(ctx context.Context, name, baseName string) *workloadState { | |
workloadSt := &workloadState{ | |
BaseName: baseName, | |
} | |
// Check the workload status | |
workload, err := d.statuses.GetWorkload(ctx, name) | |
if err != nil { | |
// If we can't get the status, assume it's not running | |
logger.Debugf("Failed to get status for remote workload %s: %v", name, err) | |
workloadSt.Running = false | |
} else { | |
workloadSt.Running = workload.Status == rt.WorkloadStatusRunning | |
} | |
// Check if the detached process is actually running | |
workloadSt.ProxyRunning = proxy.IsRunning(baseName) | |
return workloadSt | |
} |
toolhive/pkg/transport/proxy/manager.go
Lines 41 to 65 in ffdb3ff
func IsRunning(containerBaseName string) bool { | |
logger.Debugf("Checking if proxy process is running for container %s", containerBaseName) | |
if containerBaseName == "" { | |
logger.Warnf("Warning: Could not find base container name in labels") | |
return false | |
} | |
// Try to read the PID file | |
logger.Debugf("Reading PID file for container %s", containerBaseName) | |
pid, err := process.ReadPIDFile(containerBaseName) | |
if err != nil { | |
logger.Debugf("No PID file found for container %s", containerBaseName) | |
return false | |
} | |
// Check if the process exists and is running | |
logger.Debugf("Checking if process with PID %d is running", pid) | |
isRunning, err := process.FindProcess(pid) | |
if err != nil { | |
logger.Warnf("Warning: Error checking process: %v", err) | |
return false | |
} | |
return isRunning | |
} |
64b9442
to
e18ae92
Compare
This follows on from the previous PRs which migrated PIDs from the PID files to status files.
a9a4300
to
e97212c
Compare
This follows on from the previous PRs which migrated PIDs from the PID files to status files.