Manager: write to task log when assigning it to a worker
This commit is contained in:
parent
b4d2fc4231
commit
b186ea1828
@ -54,6 +54,7 @@ Note that list is **not** in any specific order.
|
||||
- [ ] Jobs
|
||||
- [ ] Tasks
|
||||
|
||||
- [x] Let Manager write to task log when it's assigned to a worker.
|
||||
- [ ] Worker sleep schedule
|
||||
- [ ] Loading of job compiler scripts from disk
|
||||
- [ ] CLI option to write built-in job compiler scripts to disk
|
||||
|
@ -318,6 +318,13 @@ func (f *Flamenco) ScheduleTask(e echo.Context) error {
|
||||
return e.NoContent(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// Add a note to the task log about the worker assignment.
|
||||
err = f.logStorage.Write(logger, dbTask.Job.UUID, dbTask.UUID,
|
||||
fmt.Sprintf("Task assigned to worker %s (%s)", worker.Name, worker.UUID))
|
||||
if err != nil {
|
||||
logger.Error().Err(err).Msg("error writing to task log")
|
||||
}
|
||||
|
||||
// Convert database objects to API objects:
|
||||
apiCommands := []api.Command{}
|
||||
for _, cmd := range dbTask.Commands {
|
||||
|
@ -35,6 +35,9 @@ func TestTaskScheduleHappy(t *testing.T) {
|
||||
}
|
||||
mf.persistence.EXPECT().ScheduleTask(echo.Request().Context(), &worker).Return(&task, nil)
|
||||
|
||||
mf.logStorage.EXPECT().Write(gomock.Any(), job.UUID, task.UUID,
|
||||
"Task assigned to worker дрон (e7632d62-c3b8-4af0-9e78-01752928952c)")
|
||||
|
||||
err := mf.flamenco.ScheduleTask(echo)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user