Skip to content

Commit 79a426d

Browse files
committed
fix
Signed-off-by: Rishi Jat <rishijat098@gmail.com>
1 parent e43a990 commit 79a426d

2 files changed

Lines changed: 3 additions & 36 deletions

File tree

pkg/cmd/dev/dev.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ func runDev(ctx context.Context, options *DevStartOptions) error {
116116
}
117117

118118
if err := llmHarness.Start(modelPath, loraPaths); err != nil {
119-
output.Debugf("Failed to start harness: %v", err)
120-
if markErr := llmHarness.MarkMockRunning(); markErr != nil {
121-
output.Debugf("Failed to record mock harness session: %v", markErr)
122-
}
123-
return nil
119+
return err
124120
}
125121

126122
return nil

pkg/lib/harness/llm-harness.go

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
)
3737

3838
const LlamaFileVersion = "0.8.16"
39-
const mockHarnessPID = "mock"
4039

4140
type LLMHarness struct {
4241
Host string
@@ -146,45 +145,17 @@ func (harness *LLMHarness) Start(modelPath string, loraPaths []string) (err erro
146145
return nil
147146
}
148147

149-
func (harness *LLMHarness) MarkMockRunning() error {
150-
harnessPath := constants.HarnessPath(harness.ConfigHome)
151-
pidFile := filepath.Join(harnessPath, constants.HarnessProcessFile)
152-
153-
if err := os.MkdirAll(harnessPath, 0o755); err != nil {
154-
return fmt.Errorf("error creating directory %s: %w", harnessPath, err)
155-
}
156-
157-
if err := os.WriteFile(pidFile, []byte(mockHarnessPID), 0644); err != nil {
158-
return fmt.Errorf("error writing PID to file %s: %w", pidFile, err)
159-
}
160-
161-
return nil
162-
}
163-
164148
func (harness *LLMHarness) Stop() error {
165149
pidFile := filepath.Join(constants.HarnessPath(harness.ConfigHome), constants.HarnessProcessFile)
166-
pidData, err := os.ReadFile(pidFile)
150+
151+
pid, err := readPIDFromFile(pidFile)
167152
if os.IsNotExist(err) {
168153
return fmt.Errorf("no Running server found")
169154
}
170155
if err != nil {
171156
return err
172157
}
173158

174-
pidStr := strings.TrimSpace(string(pidData))
175-
176-
if pidStr == mockHarnessPID {
177-
if err := os.Remove(pidFile); err != nil {
178-
return fmt.Errorf("error removing PID file: %w", err)
179-
}
180-
return nil
181-
}
182-
183-
pid, err := strconv.Atoi(pidStr)
184-
if err != nil {
185-
return fmt.Errorf("invalid PID file contents: %w", err)
186-
}
187-
188159
// Check if the process is still running.
189160
if !isProcessRunning(pid) {
190161
return fmt.Errorf("no running process found with PID %d", pid)

0 commit comments

Comments
 (0)