Skip to content

Commit

Permalink
Label interactive process with image filename
Browse files Browse the repository at this point in the history
When starting interactive container,
append image filename to process name.

Signed-off-by: Jeremy Spencer <jeremy.spencer@stfc.ac.uk>
  • Loading branch information
jeremyspencer39171 committed Jun 3, 2024
1 parent 7920ac5 commit 43274e8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/pkg/runtime/launch/launcher_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,13 @@ func (l *Launcher) Exec(ctx context.Context, image string, args []string, instan
if l.engineConfig.GetInstance() && !l.cfg.ShareNSMode {
err = l.starterInstance(loadOverlay, insideUserNs, instanceName, useSuid, cfg)
} else {
err = l.starterInteractive(loadOverlay, useSuid, cfg)
var instanceFilename string
var fileInfoErr error
info, fileInfoErr := os.Stat(image)
if fileInfoErr == nil {
instanceFilename = info.Name()
}
err = l.starterInteractive(loadOverlay, useSuid, cfg, instanceFilename)
}

// Execution is finished.
Expand Down Expand Up @@ -1177,9 +1183,9 @@ func (l *Launcher) prepareImage(c context.Context, insideUserNs bool, image stri
}

// starterInteractive executes the starter binary to run an image interactively, given the supplied engineConfig
func (l *Launcher) starterInteractive(loadOverlay bool, useSuid bool, cfg *config.Common) error {
func (l *Launcher) starterInteractive(loadOverlay bool, useSuid bool, cfg *config.Common, imageFilename string) error {
err := starter.Exec(
"Apptainer runtime parent",
"Apptainer runtime parent: "+imageFilename,
cfg,
starter.UseSuid(useSuid),
starter.LoadOverlayModule(loadOverlay),
Expand Down

0 comments on commit 43274e8

Please sign in to comment.