Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trana authored and trana committed Oct 8, 2024
1 parent 0031db1 commit 238b48f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pkg/slurm/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ func (h *SidecarHandler) LoadJIDs() error {
return nil
}

func handleError(Ctx context.Context, err error) (String, error) {
if err != nil {
log.G(Ctx).Error(err)
return "", err
}
}

// prepareEnvs reads all Environment variables from a container and append them to a envfile.properties. The values are bash-escaped.
// It returns the slice containing, if there are Environment variables, the arguments for envfile and its path, or else an empty array.
func prepareEnvs(Ctx context.Context, config SlurmConfig, podData commonIL.RetrievedPodData, container v1.Container) []string {
Expand Down Expand Up @@ -238,6 +231,9 @@ func prepareEnvs(Ctx context.Context, config SlurmConfig, podData commonIL.Retri
log.G(Ctx).Error(err)
return "", err
}

// Calling Close() in case of error. If not error, the defer will close it again but it should be idempotent.
envfile.Close()
}

duration := time.Now().UnixMicro() - start
Expand All @@ -247,8 +243,6 @@ func prepareEnvs(Ctx context.Context, config SlurmConfig, podData commonIL.Retri
attribute.StringSlice("prepareenvs.container.envs", envs),
attribute.StringSlice("prepareenvs.container.envs_data", envs_data)))

// Calling Close() in case of error. If not error, the defer will close it again but it should be idempotent.
envfile.Close()
return envs
}

Expand Down

0 comments on commit 238b48f

Please sign in to comment.