Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>
ArvadosInstanceType string
ProviderInstanceType string
LastContainerUUID string
ArvadosInstanceType string
ProviderInstanceType string
LastContainerUUID string
- state State
- instance cloud.Instance
- executor Executor
- instType arvados.InstanceType
- vcpus int64
- memory int64
- probed time.Time
- updated time.Time
- busy time.Time
- unallocated time.Time
- lastUUID string
- running map[string]struct{}
- starting map[string]struct{}
- probing chan struct{}
+ state State
+ instance cloud.Instance
+ executor Executor
+ instType arvados.InstanceType
+ vcpus int64
+ memory int64
+ probed time.Time
+ updated time.Time
+ busy time.Time
+ lastUUID string
+ running map[string]struct{}
+ starting map[string]struct{}
+ probing chan struct{}
}
// Subscribe returns a channel that becomes ready whenever a worker's
}
// Subscribe returns a channel that becomes ready whenever a worker's
}).Infof("instance appeared in cloud")
now := time.Now()
wp.workers[id] = &worker{
}).Infof("instance appeared in cloud")
now := time.Now()
wp.workers[id] = &worker{
- executor: wp.newExecutor(inst),
- state: initialState,
- instance: inst,
- instType: it,
- probed: now,
- busy: now,
- updated: now,
- unallocated: now,
- running: make(map[string]struct{}),
- starting: make(map[string]struct{}),
- probing: make(chan struct{}, 1),
+ executor: wp.newExecutor(inst),
+ state: initialState,
+ instance: inst,
+ instType: it,
+ probed: now,
+ busy: now,
+ updated: now,
+ running: make(map[string]struct{}),
+ starting: make(map[string]struct{}),
+ probing: make(chan struct{}, 1),
if len(wkr.running)+len(wkr.starting) > 0 || wkr.state != StateRunning {
return false
}
if len(wkr.running)+len(wkr.starting) > 0 || wkr.state != StateRunning {
return false
}
- age := time.Since(wkr.unallocated)
+ age := time.Since(wkr.busy)
if age < wp.timeoutIdle {
return false
}
if age < wp.timeoutIdle {
return false
}
ArvadosInstanceType: w.instType.Name,
ProviderInstanceType: w.instType.ProviderType,
LastContainerUUID: w.lastUUID,
ArvadosInstanceType: w.instType.Name,
ProviderInstanceType: w.instType.ProviderType,
LastContainerUUID: w.lastUUID,
- Unallocated: w.unallocated,
WorkerState: w.state.String(),
})
}
WorkerState: w.state.String(),
})
}
wkr.busy = updateTime
wkr.lastUUID = ctrUUIDs[0]
} else if len(wkr.running) > 0 {
wkr.busy = updateTime
wkr.lastUUID = ctrUUIDs[0]
} else if len(wkr.running) > 0 {
- wkr.unallocated = updateTime
+ // Actual last-busy time was sometime between wkr.busy
+ // and now. Now is the earliest opportunity to take
+ // advantage of the non-busy state, though.
+ wkr.busy = updateTime
}
running := map[string]struct{}{}
changed := false
}
running := map[string]struct{}{}
changed := false