Skip to content

Commit e7697bf

Browse files
committed
add warning when conda activation fails
1 parent 935e856 commit e7697bf

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

cmd/jhub-app-proxy/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ func run(cfg *config.Config) error {
135135
return fmt.Errorf("failed to create process manager: %w", err)
136136
}
137137

138+
// Add conda warning to log buffer if there was a conda activation failure
139+
// This ensures the warning appears in the interim UI logs
140+
if condaWarning := cmdBuilder.GetCondaWarning(); condaWarning != "" {
141+
mgr.AddErrorLog(condaWarning)
142+
}
143+
138144
// Create and start HTTP server
139145
subprocessURL := fmt.Sprintf("http://127.0.0.1:%d", subprocessPort)
140146
srv, err := server.New(server.Config{

pkg/command/builder.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212

1313
// Builder helps construct and manipulate commands for subprocess execution
1414
type Builder struct {
15-
logger *logger.Logger
15+
logger *logger.Logger
16+
condaWarning string // Stores conda activation warning if any
1617
}
1718

1819
// NewBuilder creates a new command builder
@@ -31,16 +32,29 @@ func (b *Builder) Build(command []string, condaEnv string) ([]string, error) {
3132
// Apply conda activation if specified
3233
if condaEnv != "" {
3334
condaMgr := conda.NewManager(b.logger)
34-
var err error
35-
command, err = condaMgr.BuildActivationCommand(condaEnv, command)
35+
activatedCommand, err := condaMgr.BuildActivationCommand(condaEnv, command)
3636
if err != nil {
37-
return nil, fmt.Errorf("failed to build conda activation: %w", err)
37+
// Store warning message for later display in interim UI
38+
b.condaWarning = fmt.Sprintf("WARNING: Conda environment activation failed: %s. Running command without conda activation.", err.Error())
39+
40+
// Log warning but continue with original command without conda activation
41+
b.logger.Warn("conda environment activation failed, running command without conda activation",
42+
"conda_env", condaEnv,
43+
"error", err.Error())
44+
// Return original command without conda activation
45+
return command, nil
3846
}
47+
command = activatedCommand
3948
}
4049

4150
return command, nil
4251
}
4352

53+
// GetCondaWarning returns the conda activation warning message if any
54+
func (b *Builder) GetCondaWarning() string {
55+
return b.condaWarning
56+
}
57+
4458
// SubstitutePort replaces jhsingle-native-proxy style placeholders in command arguments
4559
// Handles: {port} → actual port, {-} → -, {--} → --, and strips surrounding quotes
4660
func SubstitutePort(command []string, allocatedPort int) []string {

pkg/ui/logs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ async function checkAppStatus() {
139139
}
140140

141141
if (data.version) {
142-
versionText.textContent = 'jhub-app-proxy v' + data.version;
142+
versionText.textContent = 'jhub-app-proxy ' + data.version;
143143
} else {
144144
versionText.textContent = 'jhub-app-proxy';
145145
}

0 commit comments

Comments
 (0)