Skip to main content
func (*JobClient) Query(
    ctx context.Context,
    options ...job.QueryOption,
) iter.Seq2[*workflows.Job, error]
Query jobs in the specified interval. The jobs are lazily loaded and returned as a sequence of Jobs. The jobs are returned sorted by creation time in reverse order. The output sequence can be transformed into a slice of Job using Collect function.

Parameters

options
[]job.QueryOption
Options for querying jobs

Options

WithTemporalExtent(temporalExtent query.TemporalExtent)
required
Specify the time interval for which data should be queried. Right now, a temporal extent is required for every query.
WithAutomationID(automationID uuid.UUID)
Specify the automation id for which data should be queried. Only jobs that were created by the specified automation will be returned.
WithJobStates(states ...workflows.JobState)
Filter jobs by their state. Only jobs in any of the given states will be returned.
WithName(name string)
Filter jobs by name. Only jobs with a matching name will be returned.
WithTaskStates(states ...workflows.TaskState)
Filter jobs by the states of their tasks. Only jobs that have at least one task in any of the given states will be returned. Useful for finding jobs with optional task failures.

Returns

A sequence of jobs.
import (
  "time"
  workflows "github.com/tilebox/tilebox-go/workflows/v1"
  "github.com/tilebox/tilebox-go/workflows/v1/job"
	"github.com/tilebox/tilebox-go/query"
)

interval := query.NewTimeInterval(
  time.Now().Add(-24 * time.Hour),
  time.Now(),
)

jobs, err := workflows.Collect(
  client.Jobs.Query(ctx, 
    job.WithTemporalExtent(interval),
  ),
)