Add missing error log statements.
When "markRunnerAsUsed" fails, we silently ignored it. Only, when additionally the return of the runner failed, we threw the error. When a Runner is destroyed, we are only notified that Nomad removed the allocation, but cannot tell about the reason. For "the execution did not stop after SIGQUIT" we did not log the belonging runner id.
This commit is contained in:
@ -62,6 +62,7 @@ func (m *NomadRunnerManager) markRunnerAsUsed(runner Runner, timeoutDuration int
|
||||
return
|
||||
})
|
||||
if err != nil {
|
||||
log.WithError(err).WithField(dto.KeyRunnerID, runner.ID()).Error("cannot mark runner as used")
|
||||
err := m.Return(runner)
|
||||
if err != nil {
|
||||
log.WithError(err).WithField(dto.KeyRunnerID, runner.ID()).Error("can't mark runner as used and can't return runner")
|
||||
|
@ -64,7 +64,8 @@ type NomadJob struct {
|
||||
func NewNomadJob(id string, portMappings []nomadApi.PortMapping,
|
||||
apiClient nomad.ExecutorAPI, onDestroy DestroyRunnerHandler,
|
||||
) *NomadJob {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx := context.WithValue(context.Background(), dto.ContextKey(dto.KeyRunnerID), id)
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
job := &NomadJob{
|
||||
id: id,
|
||||
portMappings: portMappings,
|
||||
@ -237,6 +238,7 @@ func (r *NomadJob) GetFileContent(
|
||||
|
||||
func (r *NomadJob) Destroy(reason DestroyReason) (err error) {
|
||||
r.ctx = context.WithValue(r.ctx, destroyReasonContextKey, reason)
|
||||
log.WithContext(r.ctx).Debug("Destroying Runner")
|
||||
r.cancel()
|
||||
r.StopTimeout()
|
||||
if r.onDestroy != nil {
|
||||
@ -254,6 +256,8 @@ func (r *NomadJob) Destroy(reason DestroyReason) (err error) {
|
||||
|
||||
if err != nil {
|
||||
err = fmt.Errorf("cannot destroy runner: %w", err)
|
||||
} else {
|
||||
log.WithContext(r.ctx).Trace("Runner destroyed")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user