func (a *AuctionRunner) ScheduleTasksForAuctions(tasks []auctioneer.TaskStartRequest) {
	a.lock.Lock()
	defer a.lock.Unlock()

	now := a.clock.Now()
	for _, task := range tasks {
		log.Infof("+task auction posted: %v: %v\n", task.TaskGuid)
		auction := auctiontypes.NewTaskAuction(task.Task, now)
		a.taskAuctions = append(a.taskAuctions, auction)
	}
	a.claimToHaveWork()
}
Beispiel #2
0
func (b *Batch) AddTasks(tasks []auctioneer.TaskStartRequest) {
	auctions := make([]auctiontypes.TaskAuction, 0, len(tasks))
	now := b.clock.Now()
	for i := range tasks {
		auctions = append(auctions, auctiontypes.NewTaskAuction(tasks[i].Task, now))
	}

	b.lock.Lock()
	b.taskAuctions = append(b.taskAuctions, auctions...)
	b.claimToHaveWork()
	b.lock.Unlock()
}
Beispiel #3
0
func BuildTaskAuction(task *rep.Task, queueTime time.Time) auctiontypes.TaskAuction {
	return auctiontypes.NewTaskAuction(*task, queueTime)
}