worker: add ability to track workers serverside
Unresponsive workers (>=1 hour of no status update) are cleaned up. Several things are enabled by keeping track of workers, in future the worker server could: - keep track of how many workers are active - see if a worker for a specific architecture is available
This commit is contained in:
parent
d784075d31
commit
794acd8e34
8 changed files with 368 additions and 84 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
|
|
@ -44,7 +45,7 @@ func TestComposeStatusFromLegacyError(t *testing.T) {
|
|||
jobId, err := api.workers.EnqueueOSBuild(arch.Name(), &worker.OSBuildJob{Manifest: mf}, "")
|
||||
require.NoError(t, err)
|
||||
|
||||
j, token, _, _, _, err := api.workers.RequestJob(context.Background(), arch.Name(), []string{worker.JobTypeOSBuild}, []string{""})
|
||||
j, token, _, _, _, err := api.workers.RequestJob(context.Background(), arch.Name(), []string{worker.JobTypeOSBuild}, []string{""}, uuid.Nil)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, jobId, j)
|
||||
|
||||
|
|
@ -97,7 +98,7 @@ func TestComposeStatusFromJobError(t *testing.T) {
|
|||
jobId, err := api.workers.EnqueueOSBuild(arch.Name(), &worker.OSBuildJob{Manifest: mf}, "")
|
||||
require.NoError(t, err)
|
||||
|
||||
j, token, _, _, _, err := api.workers.RequestJob(context.Background(), arch.Name(), []string{worker.JobTypeOSBuild}, []string{""})
|
||||
j, token, _, _, _, err := api.workers.RequestJob(context.Background(), arch.Name(), []string{worker.JobTypeOSBuild}, []string{""}, uuid.Nil)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, jobId, j)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue