Documentation
¶
Overview ¶
Package task models the task, the simplest unit of execution for Evergreen.
Index ¶
- Constants
- Variables
- func AbortAndMarkResetTasksForBuild(ctx context.Context, buildID string, taskIDs []string, caller string) error
- func AbortAndMarkResetTasksForVersion(ctx context.Context, versionID string, taskIDs []string, caller string) error
- func AbortBuildTasks(ctx context.Context, buildId string, reason AbortInfo) error
- func AbortVersionTasks(ctx context.Context, versionId string, reason AbortInfo) error
- func ActivateTasks(ctx context.Context, tasks []Task, activationTime time.Time, ...) ([]string, error)
- func AddDisplayTaskIdToExecTasks(ctx context.Context, displayTaskId string, execTasksToUpdate []string) error
- func AddExecTasksToDisplayTask(ctx context.Context, displayTaskId string, execTasks []string, ...) error
- func AddGeneratedStepbackInfoForGenerator(ctx context.Context, taskId string, s StepbackInfo) error
- func AddHostCreateDetails(ctx context.Context, taskId, hostId string, execution int, ...) error
- func AddIssueToAnnotation(ctx context.Context, taskId string, execution int, issue annotations.IssueLink, ...) error
- func Aggregate(ctx context.Context, pipeline []bson.M, results any) error
- func AnyActiveTasks(tasks []Task) bool
- func AppendTaskLogs(ctx context.Context, task *Task, logType TaskLogType, lines []log.LogLine) error
- func AppendTestResultMetadata(ctx context.Context, t *Task, env evergreen.Environment, ...) error
- func ArchiveMany(ctx context.Context, tasks []Task) error
- func BulkUpdateNumDependents(ctx context.Context, tasks map[string]*Task) error
- func ByAborted(aborted bool) bson.M
- func ByActivatedBeforeRevisionWithStatuses(revisionOrder int, statuses []string, buildVariant string, displayName string, ...) (bson.M, []string)
- func ByActivation(active bool) bson.M
- func ByAfterRevisionWithStatusesAndRequesters(revisionOrder int, statuses []string, ...) bson.M
- func ByBeforeRevision(revisionOrder int, buildVariant, displayName, project, requester string) (bson.M, []string)
- func ByBeforeRevisionWithStatusesAndRequesters(revisionOrder int, statuses []string, ...) bson.M
- func ByBuildId(buildId string) bson.M
- func ByBuildIdAndGithubChecks(buildId string) bson.M
- func ByBuildIds(buildIds []string) bson.M
- func ByCommit(revision, buildVariant, displayName, project, requester string) bson.M
- func ByExecutionPlatform(platform ExecutionPlatform) bson.M
- func ByExecutionTask(taskId string) bson.M
- func ByExecutionTasks(ids []string) bson.M
- func ById(id string) bson.M
- func ByIdAndExecution(id string, execution int) bson.M
- func ByIds(ids []string) bson.M
- func ByIdsAndStatus(taskIds []string, statuses []string) bson.M
- func ByOldTaskID(id string) bson.M
- func ByPreviousCommit(buildVariant, displayName, project, requester string, order int) bson.M
- func ByStaleRunningTask(staleness time.Duration) bson.M
- func ByTaskIDAndExecution(id string, execution int) bson.M
- func ByTimeStartedAndFailed(startTime, endTime time.Time, commandTypes []string) bson.M
- func ByVersion(version string) bson.M
- func ByVersionWithChildTasks(version string) bson.M
- func ByVersions(versionIDs []string) bson.M
- func ByVersionsWithChildTasks(versionIDs []string) bson.M
- func CalculateAdjustedTaskCost(runtimeSeconds float64, distroCostData distro.CostData, ...) float64
- func CalculateEBSStorageAdjustedCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint, ...) float64
- func CalculateEBSStorageOnDemandCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint) float64
- func CalculateEBSThroughputAdjustedCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint, ...) float64
- func CalculateEBSThroughputOnDemandCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint) float64
- func CalculateOnDemandCost(runtimeSeconds float64, distroCostData distro.CostData, ...) float64
- func CalculateTaskCost(runtimeSeconds float64, distroCostData distro.CostData, ...) cost.Cost
- func CheckUsersPatchTaskLimit(ctx context.Context, requester, username string, ...) error
- func ClearTestResults(ctx context.Context, env evergreen.Environment) error
- func ComputePredictedCostsForTasks(ctx context.Context, tasks Tasks) (map[string]cost.Cost, error)
- func Count(ctx context.Context, query db.Q) (int, error)
- func CountActivatedTasksForVersion(ctx context.Context, versionId string) (int, error)
- func CountLargeParserProjectTasks(ctx context.Context) (int, error)
- func CountNumExecutionsForInterval(ctx context.Context, input NumExecutionsForIntervalInput) (int, error)
- func CountRunningTasksForVersions(ctx context.Context, versionIDs []string) (int, error)
- func DeactivateDependencies(ctx context.Context, tasks []string, caller string) error
- func DeactivateStepbackTask(ctx context.Context, projectId, buildVariantName, taskName, caller string) error
- func DeactivateTasks(ctx context.Context, tasks []Task, updateDependencies bool, caller string) error
- func DisplayTasksByVersion(version string, includeNeverActivatedTasks bool) bson.M
- func FailedTasksByIds(taskIds []string) bson.M
- func FailedTasksByVersion(version string) bson.M
- func FindAllTaskIDsFromBuild(ctx context.Context, buildId string) ([]string, error)
- func FindAllTaskIDsFromVersion(ctx context.Context, versionId string) ([]string, error)
- func FindExecTasksToReset(ctx context.Context, t *Task) ([]string, error)
- func FindProjectForTask(ctx context.Context, taskID string) (string, error)
- func FindTaskNamesByBuildVariant(ctx context.Context, projectId string, buildVariant string, ...) ([]string, error)
- func FindVariantsWithTask(ctx context.Context, taskName, project string, orderMin, orderMax int) ([]string, error)
- func GeneratedJSONInsert(ctx context.Context, settings *evergreen.Settings, t *Task, ...) error
- func GeneratedJSONInsertWithS3Fallback(ctx context.Context, settings *evergreen.Settings, t *Task, ...) (evergreen.ParserProjectStorageMethod, error)
- func GetBatchedGenerateTasksEstimations(ctx context.Context, project, buildVariant string, displayNames []string) (map[string]GenerateTasksEstimation, error)
- func GetFailedTestSamples(ctx context.Context, env evergreen.Environment, tasks []Task, ...) ([]testresult.TaskTestResultsFailedSample, error)
- func GetFirstTaskStartTimeForVersion(ctx context.Context, versionID string) (time.Time, error)
- func GetFormattedTimeSpent(tasks []Task) (string, string)
- func GetLatestExecution(ctx context.Context, taskId string) (int, error)
- func GetPendingGenerateTasks(ctx context.Context) (int, error)
- func GetQuarantinedTestSamples(ctx context.Context, env evergreen.Environment, tasks []Task, limit int) ([]testresult.TaskTestResultsQuarantinedSample, error)
- func GetResultCountList(statuses []StatusItem) map[string][]Stat
- func GetSystemFailureDetails(description string) apimodels.TaskEndDetail
- func GetTaskStatusesByVersion(ctx context.Context, versionID string) ([]string, error)
- func GetTimeSpent(tasks []Task) (time.Duration, time.Duration)
- func HasActivatedDependentTasks(ctx context.Context, taskId string) (bool, error)
- func HasMatchingTasks(ctx context.Context, versionID string, opts HasMatchingTasksOptions) (bool, error)
- func MakeOldID(taskID string, execution int) string
- func MarkGeneratedTasks(ctx context.Context, taskID string) error
- func MarkGeneratedTasksErr(ctx context.Context, taskID string, errorToSet error) error
- func MoveIssueToSuspectedIssue(ctx context.Context, taskId string, taskExecution int, ...) error
- func MoveSuspectedIssueToIssue(ctx context.Context, taskId string, taskExecution int, ...) error
- func NewLocalService(env evergreen.Environment) *localTestResultsService
- func NewTaskLogSender(ctx context.Context, task *Task, senderOpts EvergreenSenderOptions, ...) (send.Sender, error)
- func NewTestLogSender(ctx context.Context, task Task, senderOpts EvergreenSenderOptions, ...) (send.Sender, error)
- func NewTestResultService(env evergreen.Environment) *testResultService
- func NonExecutionTasksByVersions(versions []string) bson.M
- func PatchAnnotation(ctx context.Context, a *annotations.TaskAnnotation, userDisplayName string, ...) error
- func PotentiallyBlockedTasksByIds(taskIds []string) bson.M
- func Remove(ctx context.Context, id string) error
- func RemoveIssueFromAnnotation(ctx context.Context, taskId string, execution int, issue annotations.IssueLink) error
- func ResetTasks(ctx context.Context, tasks []Task, caller string) error
- func SetGeneratedStepbackInfoForGenerator(ctx context.Context, taskId string, s StepbackInfo) error
- func SetLastAndPreviousStepbackIds(ctx context.Context, taskId string, s StepbackInfo) error
- func SetNextStepbackId(ctx context.Context, taskId string, s StepbackInfo) error
- func SetTasksScheduledAndDepsMetTime(ctx context.Context, tasks []Task, scheduledTime time.Time) error
- func TaskSliceToMap(tasks []Task) map[string]Task
- func TasksByBuildIdPipeline(buildId, taskId, taskStatus string, limit, sortDir int) []bson.M
- func TasksByProjectAndCommitPipeline(opts GetTasksByProjectAndCommitOptions) []bson.M
- func UpdateAll(ctx context.Context, query any, update any) (*adb.ChangeInfo, error)
- func UpdateAllWithHint(ctx context.Context, query any, update any, hint any) (*adb.ChangeInfo, error)
- func UpdateHasAnnotations(ctx context.Context, taskId string, execution int, hasAnnotations bool) error
- func UpdateOne(ctx context.Context, query any, update any) error
- func UpdateSchedulingLimit(ctx context.Context, username, requester string, numTasksModified int, ...) error
- func UpsertAnnotation(ctx context.Context, a *annotations.TaskAnnotation, userDisplayName string) error
- type AbortInfo
- type BaseTaskInfo
- type BuildVariantTuple
- type ByPriority
- type CostPredictionResult
- type Dependency
- type DependencyCycles
- type DependencyEdge
- type DependencyGraph
- func (g *DependencyGraph) AddEdge(dependentTask, dependedOnTask TaskNode, status string)
- func (g *DependencyGraph) AddTaskNode(tNode TaskNode)
- func (g *DependencyGraph) Cycles() DependencyCycles
- func (g *DependencyGraph) DepthFirstSearch(start, target TaskNode, traverseEdge func(edge DependencyEdge) bool) bool
- func (g *DependencyGraph) EdgesIntoTask(t TaskNode) []DependencyEdge
- func (g *DependencyGraph) GetDependencyEdge(fromTask, toTask TaskNode) *DependencyEdge
- func (g *DependencyGraph) Nodes() []TaskNode
- func (g *DependencyGraph) TopologicalStableSort() ([]TaskNode, error)
- type EvergreenSenderOptions
- type ExecutionPlatform
- type FilterOptions
- type GenerateTasksEstimation
- type GeneratedJSONFileStorage
- type GeneratedJSONFiles
- type GeneratedTaskInfo
- type GetTaskTestResultsOptions
- type GetTasksByProjectAndCommitOptions
- type GetTasksByVersionOptions
- type GroupedTaskStatusCount
- type HasMatchingTasksOptions
- type HostCreateDetail
- type LargeParserProjectTaskStats
- type NumExecutionsForIntervalInput
- type PriorityBreakdown
- type RankValueBreakdown
- type ResultCounts
- type SortingValueBreakdown
- type Stat
- type StatusCount
- type StatusItem
- type StepbackInfo
- type Task
- func AddParentDisplayTasks(ctx context.Context, tasks []Task) ([]Task, error)
- func ByBeforeMidwayTaskFromIds(ctx context.Context, t1Id, t2Id string) (*Task, error)
- func FilterTasksOnStatus(tasks []Task, statuses ...string) []Task
- func Find(ctx context.Context, filter bson.M) ([]Task, error)
- func FindActivatedByVersionWithoutDisplay(ctx context.Context, versionId string) ([]Task, error)
- func FindActivatedStepbackTaskByName(ctx context.Context, projectId string, variantName string, taskName string) (*Task, error)
- func FindAll(ctx context.Context, query db.Q) ([]Task, error)
- func FindAllDependencyTasksToModify(ctx context.Context, tasks []Task, ...) ([]Task, error)
- func FindAllFirstExecution(ctx context.Context, query db.Q) ([]Task, error)
- func FindAllOld(ctx context.Context, query db.Q) ([]Task, error)
- func FindByExecutionTasksAndMaxExecution(ctx context.Context, taskIds []string, execution int, filters ...bson.E) ([]Task, error)
- func FindByIdExecution(ctx context.Context, id string, execution *int) (*Task, error)
- func FindCompletedTasksByBuild(ctx context.Context, buildID string, taskIDs []string) ([]Task, error)
- func FindCompletedTasksByVersion(ctx context.Context, versionID string, taskIDs []string) ([]Task, error)
- func FindHostRunnable(ctx context.Context, distroID string, removeDeps bool) ([]Task, error)
- func FindHostSchedulable(ctx context.Context, distroID string) ([]Task, error)
- func FindHostSchedulableForAlias(ctx context.Context, id string) ([]Task, error)
- func FindOldWithDisplayTasks(ctx context.Context, filter bson.M) ([]Task, error)
- func FindOne(ctx context.Context, query db.Q) (*Task, error)
- func FindOneId(ctx context.Context, id string) (*Task, error)
- func FindOneIdAndExecution(ctx context.Context, id string, execution int) (*Task, error)
- func FindOneIdOldOrNew(ctx context.Context, id string, execution int) (*Task, error)
- func FindOneIdWithFields(ctx context.Context, id string, projected ...string) (*Task, error)
- func FindOneIdWithGeneratedJSON(ctx context.Context, id string) (*Task, error)
- func FindOneOld(ctx context.Context, filter bson.M) (*Task, error)
- func FindOneOldByIdAndExecution(ctx context.Context, id string, execution int) (*Task, error)
- func FindOneOldId(ctx context.Context, id string) (*Task, error)
- func FindOneOldWithFields(ctx context.Context, filter bson.M, fields ...string) (*Task, error)
- func FindStuckDispatching(ctx context.Context) ([]Task, error)
- func FindTaskGroupFromBuild(ctx context.Context, buildId, taskGroup string) ([]Task, error)
- func FindTasksFromVersions(ctx context.Context, versionIds []string) ([]Task, error)
- func FindWithFields(ctx context.Context, filter bson.M, fields ...string) ([]Task, error)
- func FindWithSort(ctx context.Context, filter bson.M, sort []string) ([]Task, error)
- func GenerateNotRun(ctx context.Context) ([]Task, error)
- func GetLatestTaskFromImage(ctx context.Context, imageID string) (*Task, error)
- func GetRecentTasks(ctx context.Context, period time.Duration) ([]Task, error)
- func GetRecursiveDependenciesUp(ctx context.Context, tasks []Task, depCache map[string]Task) ([]Task, error)
- func GetTasksByVersion(ctx context.Context, versionID string, opts GetTasksByVersionOptions) ([]Task, int, error)
- func MarkAllForUnattainableDependencies(ctx context.Context, tasks []Task, dependencyIDs []string, unattainable bool) ([]Task, error)
- func UnscheduleStaleUnderwaterHostTasks(ctx context.Context, distroID string) ([]Task, error)
- func (t *Task) AddDependency(ctx context.Context, d Dependency) error
- func (t *Task) AllDependenciesSatisfied(ctx context.Context, cache map[string]Task) (bool, error)
- func (t *Task) Archive(ctx context.Context) error
- func (t *Task) Blocked() bool
- func (t *Task) ComputePredictedCostForWeek(ctx context.Context) (CostPredictionResult, error)
- func (t *Task) DependenciesMet(ctx context.Context, depCaches map[string]Task) (bool, error)
- func (t *Task) DetermineDisplayStatus() string
- func (t *Task) FetchExpectedDuration(ctx context.Context) util.DurationStats
- func (t *Task) FindAbortingAndResettingDependencies(ctx context.Context) ([]Task, error)
- func (t *Task) FindTaskOnBaseCommit(ctx context.Context) (*Task, error)
- func (t *Task) FindTaskOnPreviousCommit(ctx context.Context) (*Task, error)
- func (t *Task) GetDeactivatedBlockingDependencies(ctx context.Context, depCache map[string]Task) ([]string, error)
- func (t *Task) GetDisplayCost() cost.Cost
- func (t *Task) GetDisplayStatus() string
- func (t *Task) GetDisplayTask(ctx context.Context) (*Task, error)
- func (t *Task) GetFinishedBlockingDependencies(ctx context.Context, depCache map[string]Task) ([]Task, error)
- func (t *Task) GetJQL(searchProjects []string) string
- func (t *Task) GetS3ArtifactUsageFromDB(ctx context.Context) (s3usage.ArtifactMetrics, error)
- func (t *Task) GetS3LogUsageFromS3(ctx context.Context) (s3usage.LogMetrics, error)
- func (t *Task) GetTaskGroupString() string
- func (t *Task) GetTaskLogs(ctx context.Context, getOpts TaskLogGetOptions) (log.LogIterator, error)
- func (t *Task) GetTaskOutputSafe() (*TaskOutput, bool)
- func (t *Task) GetTestLogs(ctx context.Context, getOpts TestLogGetOptions) (log.LogIterator, error)
- func (t *Task) GetTestResults(ctx context.Context, env evergreen.Environment, filterOpts *FilterOptions) (testresult.TaskTestResults, error)
- func (t *Task) GetTestResultsStats(ctx context.Context, env evergreen.Environment) (testresult.TaskTestResultsStats, error)
- func (t *Task) GetTestResultsTasks(ctx context.Context) ([]Task, error)
- func (t *Task) HasCheckRun() bool
- func (t *Task) HasCostPrediction() bool
- func (t *Task) HasDependenciesMet() bool
- func (t *Task) HasResults(ctx context.Context) bool
- func (t *Task) HasValidDistro(ctx context.Context) bool
- func (t *Task) IncNumNextTaskDispatches(ctx context.Context) error
- func (t *Task) Insert(ctx context.Context) error
- func (t *Task) IsAbortable() bool
- func (t *Task) IsFinished() bool
- func (t *Task) IsHostDispatchable() bool
- func (t *Task) IsHostTask() bool
- func (t *Task) IsInProgress() bool
- func (t *Task) IsPartOfDisplay(ctx context.Context) bool
- func (t *Task) IsPartOfSingleHostTaskGroup() bool
- func (t *Task) IsPatchRequest() bool
- func (t *Task) IsRestartFailedOnly() bool
- func (t *Task) IsStuckTask() bool
- func (t *Task) IsUnfinishedSystemUnresponsive() bool
- func (t *Task) IsUnscheduled() bool
- func (t *Task) LogBucketName() string
- func (t *Task) MarkAsHostDispatched(ctx context.Context, hostID, distroID, agentRevision string, ...) error
- func (t *Task) MarkAsHostDispatchedWithEnv(ctx context.Context, env evergreen.Environment, ...) error
- func (t *Task) MarkAsHostUndispatched(ctx context.Context, env evergreen.Environment) error
- func (t *Task) MarkDependenciesFinished(ctx context.Context, finished bool) error
- func (t *Task) MarkEnd(ctx context.Context, finishTime time.Time, detail *apimodels.TaskEndDetail) error
- func (t *Task) MarkFailed(ctx context.Context) error
- func (t *Task) MarkStart(ctx context.Context, startTime time.Time) error
- func (t *Task) MarkSystemFailed(ctx context.Context, description string) error
- func (t *Task) MarkUnscheduled(ctx context.Context) error
- func (t *Task) MarshalBSON() ([]byte, error)
- func (t *Task) MoveTestAndTaskLogsToFailedBucket(ctx context.Context, settings *evergreen.Settings, ...) error
- func (t *Task) NextCompletedTask(ctx context.Context, project string, statuses []string) (*Task, error)
- func (t *Task) PopulateTestResults(ctx context.Context) error
- func (t *Task) PreviousCompletedTask(ctx context.Context, project string, statuses []string) (*Task, error)
- func (t *Task) Reset(ctx context.Context, caller string) error
- func (t *Task) ResultStatus() string
- func (t *Task) RevertBucketConfigToSource(ctx context.Context, sourceBucketCfg evergreen.BucketConfig) error
- func (t *Task) RevertBucketConfigToSourceIfLogsExist(ctx context.Context, sourceBucketCfg evergreen.BucketConfig) (bool, error)
- func (t *Task) SatisfiesDependency(depTask *Task) bool
- func (t *Task) SaveS3Usage(ctx context.Context, logLookup, artifactLookup bucketExpirationLookup, ...) error
- func (t *Task) SetAborted(ctx context.Context, reason AbortInfo) error
- func (t *Task) SetCheckRunId(ctx context.Context, checkRunId int64) error
- func (t *Task) SetDisplayTaskID(ctx context.Context, id string) error
- func (t *Task) SetGenerateTasksEstimationsFromMap(estimations map[string]GenerateTasksEstimation)
- func (t *Task) SetGeneratedJSON(ctx context.Context, files GeneratedJSONFiles) error
- func (t *Task) SetGeneratedJSONStorageMethod(ctx context.Context, method evergreen.ParserProjectStorageMethod) error
- func (t *Task) SetGeneratedTasksToActivate(ctx context.Context, buildVariantName, taskName string) error
- func (t *Task) SetNumActivatedGeneratedTasks(ctx context.Context, numActivatedGeneratedTasks int) error
- func (t *Task) SetNumDependents(ctx context.Context) error
- func (t *Task) SetNumGeneratedTasks(ctx context.Context, numGeneratedTasks int) error
- func (t *Task) SetOverrideDependencies(ctx context.Context, userID string) error
- func (t *Task) SetPredictedCost(c cost.Cost)
- func (t *Task) SetResetFailedWhenFinished(ctx context.Context, caller string) error
- func (t *Task) SetResetWhenFinished(ctx context.Context, caller string) error
- func (t *Task) SetResetWhenFinishedWithInc(ctx context.Context) error
- func (t *Task) SetResultsInfo(ctx context.Context, failedResults bool) error
- func (t *Task) SetSortingValueBreakdownAttributes(ctx context.Context, breakdown SortingValueBreakdown)
- func (t *Task) String() (taskStruct string)
- func (t *Task) ToTaskNode() TaskNode
- func (t *Task) UnmarshalBSON(in []byte) error
- func (t *Task) UpdateDependsOn(ctx context.Context, status string, newDependencyIDs []string) error
- func (t *Task) UpdateHeartbeat(ctx context.Context) error
- func (t *Task) UpdateTaskCost(ctx context.Context)
- func (t *Task) UsesLongRetentionBucket(settings *evergreen.Settings) bool
- func (t *Task) WillRun() bool
- type TaskLogGetOptions
- type TaskLogOutput
- type TaskLogType
- type TaskNode
- type TaskOutput
- type TaskStats
- type TaskStatusCount
- type Tasks
- func (t Tasks) Export() []Task
- func (t Tasks) Insert(ctx context.Context) error
- func (t Tasks) InsertUnordered(ctx context.Context) error
- func (t Tasks) InsertUnorderedWithPredictions(ctx context.Context, predictions map[string]cost.Cost) error
- func (t Tasks) Len() int
- func (t Tasks) Less(i, j int) bool
- func (t Tasks) Swap(i, j int)
- type TasksSortOrder
- type TestLogGetOptions
- type TestLogOutput
- type TestResultOutput
- type TestResultsService
Constants ¶
const ( Collection = "tasks" OldCollection = "old_tasks" )
const ( // GP3FreeThroughputMBps is the free throughput tier for GP3 volumes (125 MB/s). GP3FreeThroughputMBps = 125 // GP3ThroughputPricePerMBpsMonth is the price per MB/s-month above the free tier. GP3ThroughputPricePerMBpsMonth = 0.04 // GP3StoragePricePerGBMonth is the on-demand price per GB-month for EBS storage (us-east-1). GP3StoragePricePerGBMonth = 0.08 // SecondsPerMonth is 2,592,000 (60 * 60 * 24 * 30) and is used to convert monthly pricing to per-second pricing. SecondsPerMonth = 60 * 60 * 24 * 30 )
EBS GP3 pricing constants (us-east-1 rates). Pricing is standardized to us-east-1 and does not account for regional variations. GP2 volumes use GP3 pricing; price differences are ignored.
const ( TestResultServiceCedar = 0 TestResultServiceEvergreen = 1 TestResultServiceLocal = 2 )
const ( // UnschedulableThreshold is the threshold after which a task waiting to // dispatch should be unscheduled due to staleness. UnschedulableThreshold = oneWeek )
const VersionLimit = 50
Variables ¶
var ( ActivatedTasksByDistroIndex = bson.D{ {Key: DistroIdKey, Value: 1}, {Key: StatusKey, Value: 1}, {Key: ActivatedKey, Value: 1}, {Key: PriorityKey, Value: 1}, {Key: OverrideDependenciesKey, Value: 1}, {Key: UnattainableDependencyKey, Value: 1}, } // RetryFailedLogMoveIndex is the index used by the hourly retry-failed-log-move cron to find // failed tasks whose logs still need to be copied to the failed-tasks bucket. RetryFailedLogMoveIndex = bson.D{ {Key: StatusKey, Value: 1}, {Key: FinishTimeKey, Value: -1}, {Key: TaskOutputInfoKey + ".task_logs.bucket_config.name", Value: 1}, } )
var ( // BSON fields for the task struct IdKey = bsonutil.MustHaveTag(Task{}, "Id") SecretKey = bsonutil.MustHaveTag(Task{}, "Secret") CreateTimeKey = bsonutil.MustHaveTag(Task{}, "CreateTime") DispatchTimeKey = bsonutil.MustHaveTag(Task{}, "DispatchTime") ScheduledTimeKey = bsonutil.MustHaveTag(Task{}, "ScheduledTime") StartTimeKey = bsonutil.MustHaveTag(Task{}, "StartTime") FinishTimeKey = bsonutil.MustHaveTag(Task{}, "FinishTime") ActivatedTimeKey = bsonutil.MustHaveTag(Task{}, "ActivatedTime") DependenciesMetTimeKey = bsonutil.MustHaveTag(Task{}, "DependenciesMetTime") VersionKey = bsonutil.MustHaveTag(Task{}, "Version") ProjectKey = bsonutil.MustHaveTag(Task{}, "Project") RevisionKey = bsonutil.MustHaveTag(Task{}, "Revision") LastHeartbeatKey = bsonutil.MustHaveTag(Task{}, "LastHeartbeat") ActivatedKey = bsonutil.MustHaveTag(Task{}, "Activated") DeactivatedForDependencyKey = bsonutil.MustHaveTag(Task{}, "DeactivatedForDependency") BuildIdKey = bsonutil.MustHaveTag(Task{}, "BuildId") DistroIdKey = bsonutil.MustHaveTag(Task{}, "DistroId") SecondaryDistrosKey = bsonutil.MustHaveTag(Task{}, "SecondaryDistros") BuildVariantKey = bsonutil.MustHaveTag(Task{}, "BuildVariant") DependsOnKey = bsonutil.MustHaveTag(Task{}, "DependsOn") UnattainableDependencyKey = bsonutil.MustHaveTag(Task{}, "UnattainableDependency") OverrideDependenciesKey = bsonutil.MustHaveTag(Task{}, "OverrideDependencies") NumDependentsKey = bsonutil.MustHaveTag(Task{}, "NumDependents") DisplayNameKey = bsonutil.MustHaveTag(Task{}, "DisplayName") ExecutionPlatformKey = bsonutil.MustHaveTag(Task{}, "ExecutionPlatform") HostIdKey = bsonutil.MustHaveTag(Task{}, "HostId") AgentVersionKey = bsonutil.MustHaveTag(Task{}, "AgentVersion") ExecutionKey = bsonutil.MustHaveTag(Task{}, "Execution") LatestParentExecutionKey = bsonutil.MustHaveTag(Task{}, "LatestParentExecution") OldTaskIdKey = bsonutil.MustHaveTag(Task{}, "OldTaskId") ArchivedKey = bsonutil.MustHaveTag(Task{}, "Archived") CanResetKey = bsonutil.MustHaveTag(Task{}, "CanReset") CheckRunIdKey = bsonutil.MustHaveTag(Task{}, "CheckRunId") RevisionOrderNumberKey = bsonutil.MustHaveTag(Task{}, "RevisionOrderNumber") RequesterKey = bsonutil.MustHaveTag(Task{}, "Requester") StatusKey = bsonutil.MustHaveTag(Task{}, "Status") DetailsKey = bsonutil.MustHaveTag(Task{}, "Details") AbortedKey = bsonutil.MustHaveTag(Task{}, "Aborted") AbortInfoKey = bsonutil.MustHaveTag(Task{}, "AbortInfo") TimeTakenKey = bsonutil.MustHaveTag(Task{}, "TimeTaken") TaskCostKey = bsonutil.MustHaveTag(Task{}, "TaskCost") PredictedTaskCostKey = bsonutil.MustHaveTag(Task{}, "PredictedTaskCost") S3UsageKey = bsonutil.MustHaveTag(Task{}, "S3Usage") ExpectedDurationKey = bsonutil.MustHaveTag(Task{}, "ExpectedDuration") ExpectedDurationStddevKey = bsonutil.MustHaveTag(Task{}, "ExpectedDurationStdDev") DurationPredictionKey = bsonutil.MustHaveTag(Task{}, "DurationPrediction") PriorityKey = bsonutil.MustHaveTag(Task{}, "Priority") ActivatedByKey = bsonutil.MustHaveTag(Task{}, "ActivatedBy") StepbackInfoKey = bsonutil.MustHaveTag(Task{}, "StepbackInfo") ExecutionTasksKey = bsonutil.MustHaveTag(Task{}, "ExecutionTasks") DisplayOnlyKey = bsonutil.MustHaveTag(Task{}, "DisplayOnly") DisplayTaskIdKey = bsonutil.MustHaveTag(Task{}, "DisplayTaskId") ParentPatchIDKey = bsonutil.MustHaveTag(Task{}, "ParentPatchID") TaskGroupKey = bsonutil.MustHaveTag(Task{}, "TaskGroup") TaskGroupMaxHostsKey = bsonutil.MustHaveTag(Task{}, "TaskGroupMaxHosts") TaskGroupOrderKey = bsonutil.MustHaveTag(Task{}, "TaskGroupOrder") GenerateTaskKey = bsonutil.MustHaveTag(Task{}, "GenerateTask") GeneratedTasksKey = bsonutil.MustHaveTag(Task{}, "GeneratedTasks") GeneratedByKey = bsonutil.MustHaveTag(Task{}, "GeneratedBy") TaskOutputInfoKey = bsonutil.MustHaveTag(Task{}, "TaskOutputInfo") ResultsServiceKey = bsonutil.MustHaveTag(Task{}, "ResultsService") HasTestResultsKey = bsonutil.MustHaveTag(Task{}, "HasTestResults") ResultsFailedKey = bsonutil.MustHaveTag(Task{}, "ResultsFailed") NumQuarantinedTestsSkippedKey = bsonutil.MustHaveTag(Task{}, "NumQuarantinedTestsSkipped") IsGithubCheckKey = bsonutil.MustHaveTag(Task{}, "IsGithubCheck") HostCreateDetailsKey = bsonutil.MustHaveTag(Task{}, "HostCreateDetails") GeneratedJSONAsStringKey = bsonutil.MustHaveTag(Task{}, "GeneratedJSONAsString") GeneratedJSONStorageMethodKey = bsonutil.MustHaveTag(Task{}, "GeneratedJSONStorageMethod") GenerateTasksErrorKey = bsonutil.MustHaveTag(Task{}, "GenerateTasksError") GeneratedTasksToActivateKey = bsonutil.MustHaveTag(Task{}, "GeneratedTasksToActivate") NumGeneratedTasksKey = bsonutil.MustHaveTag(Task{}, "NumGeneratedTasks") EstimatedNumGeneratedTasksKey = bsonutil.MustHaveTag(Task{}, "EstimatedNumGeneratedTasks") NumActivatedGeneratedTasksKey = bsonutil.MustHaveTag(Task{}, "NumActivatedGeneratedTasks") ResetWhenFinishedKey = bsonutil.MustHaveTag(Task{}, "ResetWhenFinished") ResetFailedWhenFinishedKey = bsonutil.MustHaveTag(Task{}, "ResetFailedWhenFinished") NumAutomaticRestartsKey = bsonutil.MustHaveTag(Task{}, "NumAutomaticRestarts") IsAutomaticRestartKey = bsonutil.MustHaveTag(Task{}, "IsAutomaticRestart") DisplayStatusKey = bsonutil.MustHaveTag(Task{}, "DisplayStatus") DisplayStatusCacheKey = bsonutil.MustHaveTag(Task{}, "DisplayStatusCache") BaseTaskKey = bsonutil.MustHaveTag(Task{}, "BaseTask") BuildVariantDisplayNameKey = bsonutil.MustHaveTag(Task{}, "BuildVariantDisplayName") IsEssentialToSucceedKey = bsonutil.MustHaveTag(Task{}, "IsEssentialToSucceed") HasAnnotationsKey = bsonutil.MustHaveTag(Task{}, "HasAnnotations") NumNextTaskDispatchesKey = bsonutil.MustHaveTag(Task{}, "NumNextTaskDispatches") CachedProjectStorageMethodKey = bsonutil.MustHaveTag(Task{}, "CachedProjectStorageMethod") )
var ( // BSON fields for stepback information LastFailingStepbackTaskIdKey = bsonutil.MustHaveTag(StepbackInfo{}, "LastFailingStepbackTaskId") LastPassingStepbackTaskIdKey = bsonutil.MustHaveTag(StepbackInfo{}, "LastPassingStepbackTaskId") NextStepbackTaskIdKey = bsonutil.MustHaveTag(StepbackInfo{}, "NextStepbackTaskId") PreviousStepbackTaskIdKey = bsonutil.MustHaveTag(StepbackInfo{}, "PreviousStepbackTaskId") GeneratedStepbackInfoKey = bsonutil.MustHaveTag(StepbackInfo{}, "GeneratedStepbackInfo") StepbackInfoDisplayNameKey = bsonutil.MustHaveTag(StepbackInfo{}, "DisplayName") StepbackInfoBuildVariantKey = bsonutil.MustHaveTag(StepbackInfo{}, "BuildVariant") )
var ( // BSON fields for task status details struct TaskEndDetailStatus = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "Status") TaskEndDetailTimedOut = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "TimedOut") TaskEndDetailType = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "Type") TaskEndDetailDescription = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "Description") TaskEndDetailDiskDevicesKey = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "DiskDevices") TaskEndDetailTraceIDKey = bsonutil.MustHaveTag(apimodels.TaskEndDetail{}, "TraceID") )
var ( // BSON fields for task dependency struct DependencyTaskIdKey = bsonutil.MustHaveTag(Dependency{}, "TaskId") DependencyStatusKey = bsonutil.MustHaveTag(Dependency{}, "Status") DependencyUnattainableKey = bsonutil.MustHaveTag(Dependency{}, "Unattainable") DependencyFinishedAtKey = bsonutil.MustHaveTag(Dependency{}, "FinishedAt") DependencyOmitGeneratedTasksKey = bsonutil.MustHaveTag(Dependency{}, "OmitGeneratedTasks") )
var ( FinishedOpts = []bson.M{{ StatusKey: bson.M{ "$in": []string{ evergreen.TaskFailed, evergreen.TaskSucceeded, }, }, }, } // This should reflect Task.GetDisplayStatus() DisplayStatusExpression = bson.M{ "$switch": bson.M{ "branches": []bson.M{ { "case": bson.M{ "$eq": []any{"$" + HasAnnotationsKey, true}, }, "then": evergreen.TaskKnownIssue, }, { "case": bson.M{ "$eq": []any{"$" + AbortedKey, true}, }, "then": evergreen.TaskAborted, }, { "case": bson.M{ "$eq": []string{"$" + StatusKey, evergreen.TaskSucceeded}, }, "then": evergreen.TaskSucceeded, }, { "case": bson.M{ "$eq": []string{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailType), evergreen.CommandTypeSetup}, }, "then": evergreen.TaskSetupFailed, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []string{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailType), evergreen.CommandTypeSystem}}, {"$eq": []any{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailTimedOut), true}}, {"$eq": []string{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailDescription), evergreen.TaskDescriptionHeartbeat}}, }, }, "then": evergreen.TaskSystemUnresponse, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []string{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailType), evergreen.CommandTypeSystem}}, {"$eq": []any{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailTimedOut), true}}, }, }, "then": evergreen.TaskSystemTimedOut, }, { "case": bson.M{ "$eq": []string{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailType), evergreen.CommandTypeSystem}, }, "then": evergreen.TaskSystemFailed, }, { "case": bson.M{ "$eq": []any{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailTimedOut), true}, }, "then": evergreen.TaskTimedOut, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []any{"$" + ActivatedKey, false}}, {"$eq": []string{"$" + StatusKey, evergreen.TaskUndispatched}}, }, }, "then": evergreen.TaskUnscheduled, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []string{"$" + StatusKey, evergreen.TaskUndispatched}}, {"$ne": []any{"$" + OverrideDependenciesKey, true}}, isUnattainable, }, }, "then": evergreen.TaskStatusBlocked, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []string{"$" + StatusKey, evergreen.TaskUndispatched}}, {"$eq": []any{"$" + ActivatedKey, true}}, }, }, "then": evergreen.TaskWillRun, }, }, "default": "$" + StatusKey, }, } )
var ( TestResultTaskIDKey = bsonutil.MustHaveTag(dbTaskTestResultsID{}, "TaskID") TestResultExecutionKey = bsonutil.MustHaveTag(dbTaskTestResultsID{}, "Execution") ResultsKey = bsonutil.MustHaveTag(localDbTaskTestResults{}, "Results") )
var All = db.Query(nil)
All returns all tasks.
var (
AllStatuses = "*"
)
var BaseTaskStatusKey = bsonutil.GetDottedKeyName(BaseTaskKey, StatusKey)
var ( IsDispatchedOrStarted = bson.M{ StatusKey: bson.M{"$in": []string{evergreen.TaskStarted, evergreen.TaskDispatched}}, } )
var StatusFields = []string{ BuildIdKey, DisplayNameKey, StatusKey, DetailsKey, StartTimeKey, TimeTakenKey, ActivatedKey, DependsOnKey, }
var TaskHistoricalDataIndex = bson.D{ {Key: ProjectKey, Value: 1}, {Key: BuildVariantKey, Value: 1}, {Key: DisplayNameKey, Value: 1}, {Key: StatusKey, Value: 1}, {Key: FinishTimeKey, Value: 1}, {Key: StartTimeKey, Value: 1}, }
var TaskVersionCostIndex = bson.D{ {Key: VersionKey, Value: 1}, {Key: DisplayOnlyKey, Value: 1}, }
TaskVersionCostIndex is used to efficiently aggregate task costs by version.
Functions ¶
func AbortAndMarkResetTasksForBuild ¶
func AbortAndMarkResetTasksForBuild(ctx context.Context, buildID string, taskIDs []string, caller string) error
AbortAndMarkResetTasksForBuild aborts and marks in-progress tasks to reset from the specified task IDs and build ID. If no task IDs are specified, all in-progress tasks belonging to the build are aborted and marked to reset.
func AbortAndMarkResetTasksForVersion ¶
func AbortAndMarkResetTasksForVersion(ctx context.Context, versionID string, taskIDs []string, caller string) error
AbortAndMarkResetTasksForVersion aborts and marks in-progress tasks to reset from the specified task IDs and version ID. If no task IDs are specified, all in-progress tasks belonging to the version are aborted and marked to reset.
func AbortBuildTasks ¶
AbortBuildTasks sets the abort flag on all tasks associated with the build which are in an abortable
func AbortVersionTasks ¶
AbortVersionTasks sets the abort flag on all tasks associated with the version which are in an abortable state
func ActivateTasks ¶
func ActivateTasks(ctx context.Context, tasks []Task, activationTime time.Time, updateDependencies bool, caller string) ([]string, error)
ActivateTasks sets all given tasks to active, logs them as activated, and proceeds to activate any dependencies that were deactivated. This returns the task IDs that were activated.
func AddGeneratedStepbackInfoForGenerator ¶
func AddGeneratedStepbackInfoForGenerator(ctx context.Context, taskId string, s StepbackInfo) error
AddGeneratedStepbackInfoForGenerator appends a new StepbackInfo to the task's GeneratedStepbackInfo.
func AddHostCreateDetails ¶
func AddIssueToAnnotation ¶
func AddIssueToAnnotation(ctx context.Context, taskId string, execution int, issue annotations.IssueLink, username string) error
AddIssueToAnnotation adds an issue onto an existing annotation and marks its associated task document as having annotations.
func AnyActiveTasks ¶
func AppendTaskLogs ¶
func AppendTaskLogs(ctx context.Context, task *Task, logType TaskLogType, lines []log.LogLine) error
AppendTaskLogs appends log lines to the specified task log for the given task run.
func AppendTestResultMetadata ¶
func AppendTestResultMetadata(ctx context.Context, t *Task, env evergreen.Environment, failedTestSample []string, failedCount int, totalResults int, record testresult.DbTaskTestResults) error
AppendTestResultMetadata appends test result metadata for the given task run.
func ArchiveMany ¶
ArchiveMany accepts tasks and display tasks (no execution tasks). The function expects that each one is going to be archived and progressed to the next execution. For execution tasks in display tasks, it will properly account for archiving only tasks that should be if failed.
func BulkUpdateNumDependents ¶
BulkUpdateNumDependents updates NumDependents for multiple tasks in a single bulk operation.
func ByActivation ¶
ByActivation creates a query to return tasks with an activated state
func ByBeforeRevision ¶
func ByBuildIdAndGithubChecks ¶
ByBuildIdAndGithubChecks creates a query to return github check tasks with a certain build ID.
func ByBuildIds ¶
ByBuildIds creates a query to return tasks in buildsIds
func ByCommit ¶
ByCommit creates a query on Evergreen as the requester on a revision, buildVariant, displayName and project.
func ByExecutionPlatform ¶
func ByExecutionPlatform(platform ExecutionPlatform) bson.M
ByExecutionPlatform returns the query to find tasks matching the given execution platform. If the empty string is given, the task is assumed to be the default of ExecutionPlatformHost.
func ByExecutionTask ¶
func ByExecutionTasks ¶
func ByIdAndExecution ¶
ByIdAndExecution creates a query that finds a task by its _id and execution.
func ByIdsAndStatus ¶
ByIdsBuildIdAndStatus creates a query to return tasks with a certain build id and statuses
func ByOldTaskID ¶
func ByPreviousCommit ¶
ByPreviousCommit creates a query on Evergreen as the requester on a previous revision with the same buildVariant, displayName and project
func ByStaleRunningTask ¶
ByStaleRunningTask creates a query that finds any running tasks whose last heartbeat was at least the specified threshold ago.
func ByTaskIDAndExecution ¶
ByTaskIDAndExecution constructs a query to find a test result for a specific task id and execution pair.
func ByTimeStartedAndFailed ¶
ByTimeStartedAndFailed returns all failed tasks that started or finished between 2 given times
func ByVersionWithChildTasks ¶
ByVersionWithChildTasks creates a query to return tasks or child tasks associated with the given version.
func ByVersions ¶
ByVersions produces a query that returns tasks for the given version.
func ByVersionsWithChildTasks ¶
ByVersionsWithChildTasks produces a query that returns tasks and child tasks for the given version.
func CalculateAdjustedTaskCost ¶
func CalculateAdjustedTaskCost(runtimeSeconds float64, distroCostData distro.CostData, financeConfig evergreen.CostConfig) float64
CalculateAdjustedTaskCost calculates the adjusted cost of running a task based on the provided runtime, distro cost data, and admin finance settings using the finance formula.
func CalculateEBSStorageAdjustedCost ¶
func CalculateEBSStorageAdjustedCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint, ebsConfig evergreen.EBSCostConfig) float64
CalculateEBSStorageAdjustedCost calculates the adjusted EBS storage cost. It applies the discount: adjusted = on_demand * (1 - EBSDiscount).
func CalculateEBSStorageOnDemandCost ¶
func CalculateEBSStorageOnDemandCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint) float64
CalculateEBSStorageOnDemandCost calculates the raw on-demand cost for EBS storage. Pricing is based on us-east-1 rates: $0.08 per GB-month (GP3); GP2 volumes use the same rate in this model. It does not apply a discount; use CalculateEBSStorageAdjustedCost for the discounted cost.
func CalculateEBSThroughputAdjustedCost ¶
func CalculateEBSThroughputAdjustedCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint, ebsConfig evergreen.EBSCostConfig) float64
CalculateEBSThroughputAdjustedCost calculates the adjusted cost for EBS GP3 throughput. It applies the discount: adjusted = on_demand * (1 - EBSDiscount).
func CalculateEBSThroughputOnDemandCost ¶
func CalculateEBSThroughputOnDemandCost(runtimeSeconds float64, mountPoints []ec2mount.MountPoint) float64
CalculateEBSThroughputOnDemandCost calculates the raw on-demand cost for EBS GP3 throughput. Pricing is based on us-east-1 rates: $0.04 per MB/s-month above the 125 MB/s baseline. It does not apply a discount; use CalculateEBSThroughputAdjustedCost for the discounted cost.
func CalculateOnDemandCost ¶
func CalculateOnDemandCost(runtimeSeconds float64, distroCostData distro.CostData, financeConfig evergreen.CostConfig) float64
CalculateOnDemandCost calculates the on-demand cost of running a task.
func CalculateTaskCost ¶
func CalculateTaskCost(runtimeSeconds float64, distroCostData distro.CostData, financeConfig evergreen.CostConfig) cost.Cost
CalculateTaskCost calculates both on-demand and adjusted costs for a task.
func CheckUsersPatchTaskLimit ¶
func CheckUsersPatchTaskLimit(ctx context.Context, requester, username string, includeDisplayAndTaskGroups bool, tasks ...Task) error
CheckUsersPatchTaskLimit takes in an input list of tasks that is set to get activated, and checks if they're non commit-queue patch tasks, and that the request has been submitted by a user. If so, the maximum hourly patch tasks counter will be incremented accordingly. The includeDisplayAndTaskGroups parameter indicates that execution tasks and single host task group tasks are to be counted as part of the limit update, otherwise they will be ignored.
func ClearTestResults ¶
func ClearTestResults(ctx context.Context, env evergreen.Environment) error
ClearTestResults clears the local test results store.
func ComputePredictedCostsForTasks ¶
ComputePredictedCostsForTasks computes predicted costs for activated tasks
func CountLargeParserProjectTasks ¶
CountLargeParserProjectTasks counts the number of tasks running with parser projects stored in s3.
func CountNumExecutionsForInterval ¶
func CountNumExecutionsForInterval(ctx context.Context, input NumExecutionsForIntervalInput) (int, error)
func CountRunningTasksForVersions ¶
CountRunningTasksForVersions returns the number of running or dispatched tasks for the given versions.
func DeactivateDependencies ¶
DeactivateDependencies gets all tasks that are blocked by the given tasks (this could be 1st level or recursive) and deactivates them. Then it sends out the event logs for the deactivation.
func DeactivateStepbackTask ¶
func DeactivateStepbackTask(ctx context.Context, projectId, buildVariantName, taskName, caller string) error
DeactivateStepbackTask deactivates and aborts the matching stepback task.
func DeactivateTasks ¶
func DisplayTasksByVersion ¶
DisplayTasksByVersion produces a query that returns all display tasks for the given version.
func FailedTasksByIds ¶
func FailedTasksByVersion ¶
FailedTasksByVersion produces a query that returns all failed tasks for the given version.
func FindAllTaskIDsFromBuild ¶
FindAllTaskIDsFromBuild returns a list of task IDs associated with a build.
func FindAllTaskIDsFromVersion ¶
FindAllTaskIDsFromVersion returns a list of task IDs associated with a version.
func FindExecTasksToReset ¶
func FindProjectForTask ¶
func FindTaskNamesByBuildVariant ¶
func FindTaskNamesByBuildVariant(ctx context.Context, projectId string, buildVariant string, repoOrderNumber int) ([]string, error)
FindTaskNamesByBuildVariant returns a list of unique task names for a given build variant
func FindVariantsWithTask ¶
func FindVariantsWithTask(ctx context.Context, taskName, project string, orderMin, orderMax int) ([]string, error)
FindVariantsWithTask returns a list of build variants between specified commits that contain a specific task name
func GeneratedJSONInsert ¶
func GeneratedJSONInsert(ctx context.Context, settings *evergreen.Settings, t *Task, files GeneratedJSONFiles, method evergreen.ParserProjectStorageMethod) error
GeneratedJSONInsert is a convenience wrapper to insert all generated JSON files for the given task to persistent storage.
func GeneratedJSONInsertWithS3Fallback ¶
func GeneratedJSONInsertWithS3Fallback(ctx context.Context, settings *evergreen.Settings, t *Task, files GeneratedJSONFiles, method evergreen.ParserProjectStorageMethod) (evergreen.ParserProjectStorageMethod, error)
GeneratedJSONInsertWithS3Fallback attempts to insert the generated JSON files into persistent storage using the given storage method. If it fails due to DB document size limitations, it will attempt to fall back to using S3 to store it. If it succeeds, this returns the actual storage method used to persist the generated JSON files; otherwise, it returns the originally-requested storage method.
func GetBatchedGenerateTasksEstimations ¶
func GetBatchedGenerateTasksEstimations(ctx context.Context, project, buildVariant string, displayNames []string) (map[string]GenerateTasksEstimation, error)
GetBatchedGenerateTasksEstimations returns a map of estimations for multiple generator tasks, where keys are each task's display name.
func GetFailedTestSamples ¶
func GetFailedTestSamples(ctx context.Context, env evergreen.Environment, tasks []Task, regexFilters []string) ([]testresult.TaskTestResultsFailedSample, error)
GetFailedTestSamples returns failed test samples filtered as specified by the optional regex filters for each task specified.
func GetFirstTaskStartTimeForVersion ¶
GetFirstTaskStartTimeForVersion returns the start time of the first task to start for a version.
func GetFormattedTimeSpent ¶
GetFormattedTimeSpent returns the total time_taken and makespan of tasks as a formatted string
func GetPendingGenerateTasks ¶
GetPendingGenerateTasks returns an estimated number of tasks the current dispatched tasks will generate.
func GetQuarantinedTestSamples ¶
func GetQuarantinedTestSamples(ctx context.Context, env evergreen.Environment, tasks []Task, limit int) ([]testresult.TaskTestResultsQuarantinedSample, error)
GetQuarantinedTestSamples returns tests skipped because they were quarantined in TSS for each task specified.
func GetResultCountList ¶
func GetResultCountList(statuses []StatusItem) map[string][]Stat
func GetSystemFailureDetails ¶
func GetSystemFailureDetails(description string) apimodels.TaskEndDetail
GetSystemFailureDetails returns a task's end details based on an input description.
func GetTaskStatusesByVersion ¶
GetTaskStatusesByVersion gets all unique task display statuses for a specific version
func GetTimeSpent ¶
GetTimeSpent returns the total time_taken and makespan of tasks
func HasActivatedDependentTasks ¶
HasActivatedDependentTasks returns true if there are active tasks waiting on the given task.
func HasMatchingTasks ¶
func HasMatchingTasks(ctx context.Context, versionID string, opts HasMatchingTasksOptions) (bool, error)
HasMatchingTasks returns true if the version has tasks with the given statuses
func MarkGeneratedTasks ¶
MarkGeneratedTasks marks that the task has generated tasks.
func MarkGeneratedTasksErr ¶
MarkGeneratedTasksErr marks that the task hit errors generating tasks.
func MoveIssueToSuspectedIssue ¶
func MoveIssueToSuspectedIssue(ctx context.Context, taskId string, taskExecution int, issue annotations.IssueLink, username string) error
MoveIssueToSuspectedIssue removes an issue from an existing annotation and adds it to its suspected issues, and unsets its associated task document as having annotations if this was the last issue removed from the annotation.
func MoveSuspectedIssueToIssue ¶
func MoveSuspectedIssueToIssue(ctx context.Context, taskId string, taskExecution int, issue annotations.IssueLink, username string) error
MoveSuspectedIssueToIssue removes a suspected issue from an existing annotation and adds it to its issues, and marks its associated task document as having annotations.
func NewLocalService ¶
func NewLocalService(env evergreen.Environment) *localTestResultsService
NewLocalService returns a local test results service implementation.
func NewTaskLogSender ¶
func NewTaskLogSender(ctx context.Context, task *Task, senderOpts EvergreenSenderOptions, logType TaskLogType) (send.Sender, error)
NewTaskLogSender returns a new task log sender for the given task run.
func NewTestLogSender ¶
func NewTestLogSender(ctx context.Context, task Task, senderOpts EvergreenSenderOptions, logPath string, sequence int) (send.Sender, error)
NewTestLogSender returns a new test log sender for the given task run.
func NewTestResultService ¶
func NewTestResultService(env evergreen.Environment) *testResultService
NewTestResultService returns a new test result service.
func NonExecutionTasksByVersions ¶
NonExecutionTasksByVersions will filter out newer execution tasks that store if they have a display task. Old execution tasks without display task ID populated will still be returned.
func PatchAnnotation ¶
func PatchAnnotation(ctx context.Context, a *annotations.TaskAnnotation, userDisplayName string, upsert bool) error
PatchAnnotation adds issues onto existing annotations, and marks its associated task document as having annotations if the patch includes a non-nil Issues field.
func PotentiallyBlockedTasksByIds ¶
PotentiallyBlockedTasksByIds finds tasks with the given task ids that have dependencies (these could be completed or not), do not have override dependencies set to true, and the dependencies met time has not been set.
func RemoveIssueFromAnnotation ¶
func RemoveIssueFromAnnotation(ctx context.Context, taskId string, execution int, issue annotations.IssueLink) error
RemoveIssueFromAnnotation removes an issue from an existing annotation, and unsets its associated task document as having annotations if this was the last issue removed from the annotation.
func ResetTasks ¶
ResetTasks performs the same DB updates as (*Task).Reset, but resets many tasks instead of a single one.
func SetGeneratedStepbackInfoForGenerator ¶
func SetGeneratedStepbackInfoForGenerator(ctx context.Context, taskId string, s StepbackInfo) error
SetGeneratedStepbackInfoForGenerator sets the StepbackInfo's GeneratedStepbackInfo element with the same DisplayName and BuildVariant as the input StepbackInfo.
func SetLastAndPreviousStepbackIds ¶
func SetLastAndPreviousStepbackIds(ctx context.Context, taskId string, s StepbackInfo) error
SetLastAndPreviousStepbackIds sets the LastFailingStepbackTaskId, LastPassingStepbackTaskId, and PreviousStepbackTaskId for a given task id.
func SetNextStepbackId ¶
func SetNextStepbackId(ctx context.Context, taskId string, s StepbackInfo) error
SetNextStepbackId sets the NextStepbackTaskId for a given task id.
func SetTasksScheduledAndDepsMetTime ¶
func SetTasksScheduledAndDepsMetTime(ctx context.Context, tasks []Task, scheduledTime time.Time) error
SetTasksScheduledAndDepsMetTime takes a list of tasks and a time, and then sets the scheduled time in the database for the tasks if ScheduledTime is currently unset, and does the same for the dependencies met time for the tasks if the task has its dependencies met and DependenciesMetTime is unset.
func TaskSliceToMap ¶
func TasksByBuildIdPipeline ¶
TasksByBuildIdPipeline fetches the pipeline to Get the retrieve all tasks associated with a given build.
func TasksByProjectAndCommitPipeline ¶
func TasksByProjectAndCommitPipeline(opts GetTasksByProjectAndCommitOptions) []bson.M
TasksByProjectAndCommitPipeline fetches the pipeline to get the retrieve all mainline commit tasks associated with a given project and commit hash. Filtering by task status, task name, and buildvariant name are optionally available.
func UpdateAllWithHint ¶
func UpdateHasAnnotations ¶
func UpdateHasAnnotations(ctx context.Context, taskId string, execution int, hasAnnotations bool) error
UpdateHasAnnotations updates a task's HasAnnotations flag, indicating if there are any annotations with populated IssuesKey for its id / execution pair. This function handles both current tasks (in 'tasks' collection) and archived tasks (in 'old_tasks' collection).
func UpdateSchedulingLimit ¶
func UpdateSchedulingLimit(ctx context.Context, username, requester string, numTasksModified int, activated bool) error
UpdateSchedulingLimit retrieves a user from the DB and updates their hourly scheduling limit info if they are not a service user.
func UpsertAnnotation ¶
func UpsertAnnotation(ctx context.Context, a *annotations.TaskAnnotation, userDisplayName string) error
UpsertAnnotation upserts a task annotation, and marks its associated task document as having annotations if the upsert includes a non-nil Issues field.
Types ¶
type BaseTaskInfo ¶
type BaseTaskInfo struct {
Id string `bson:"_id" json:"id"`
Status string `bson:"status" json:"status"`
}
BaseTaskInfo is a subset of task fields that should be returned for patch tasks. The bson keys must match those of the actual task document
type BuildVariantTuple ¶
type BuildVariantTuple struct {
BuildVariant string `bson:"build_variant"`
DisplayName string `bson:"build_variant_display_name"`
}
func FindUniqueBuildVariantNamesByTask ¶
func FindUniqueBuildVariantNamesByTask(ctx context.Context, projectId string, taskName string, repoOrderNumber int) ([]*BuildVariantTuple, error)
FindUniqueBuildVariantNamesByTask returns a list of unique build variants names and their display names for a given task name. It attempts to return the most recent display name for each build variant to avoid returning duplicates caused by display names changing. It only checks the last 50 versions that ran for a given task name.
type ByPriority ¶
type ByPriority []Task
ByPriority sorts execution tasks within a parent display task according to their display statuses (and has nothing to do with its scheduling priority).
func (ByPriority) Len ¶
func (p ByPriority) Len() int
func (ByPriority) Less ¶
func (p ByPriority) Less(i, j int) bool
func (ByPriority) Swap ¶
func (p ByPriority) Swap(i, j int)
type CostPredictionResult ¶
type Dependency ¶
type Dependency struct {
TaskId string `bson:"_id" json:"id"`
Status string `bson:"status" json:"status"`
Unattainable bool `bson:"unattainable" json:"unattainable"`
// FinishedAt indicates the time the task's dependency was finished at.
FinishedAt time.Time `bson:"finished_at,omitempty" json:"finished_at,omitempty"`
// OmitGeneratedTasks causes tasks that depend on a generator task to not depend on
// the generated tasks if this is set
OmitGeneratedTasks bool `bson:"omit_generated_tasks,omitempty" json:"omit_generated_tasks,omitempty"`
}
Dependency represents a task that must be completed before the owning task can be scheduled.
func GetAllDependencies ¶
func GetAllDependencies(ctx context.Context, taskIDs []string, taskMap map[string]*Task) ([]Dependency, error)
GetAllDependencies returns all the dependencies the tasks in taskIDs rely on
func (*Dependency) SetBSON ¶
func (d *Dependency) SetBSON(raw mgobson.Raw) error
SetBSON allows us to use dependency representation of both just task Ids and of true Dependency structs.
TODO eventually drop all of this switching
func (*Dependency) UnmarshalBSON ¶
func (d *Dependency) UnmarshalBSON(in []byte) error
type DependencyCycles ¶
type DependencyCycles [][]TaskNode
DependencyCycles is a jagged array of node cycles.
func (DependencyCycles) String ¶
func (dc DependencyCycles) String() string
String represents DependencyCycles as a string.
type DependencyEdge ¶
type DependencyEdge struct {
// Status is the status specified by the dependency, if any.
Status string
// From is the node the edge begins from.
From TaskNode
// To is the node the edge points to.
To TaskNode
}
DependencyEdge is a representation of a dependency in the graph.
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph models task dependency relationships as a directed graph. Use NewDependencyGraph to initialize a new DependencyGraph.
func NewDependencyGraph ¶
func NewDependencyGraph(transposed bool) DependencyGraph
NewDependencyGraph returns an initialized DependencyGraph. transposed determines the direction of edges in the graph. If transposed is false, edges point from dependent tasks to the tasks they depend on. If transposed is true, edges point from depended on tasks to the tasks that depend on them.
func VersionDependencyGraph ¶
func VersionDependencyGraph(ctx context.Context, versionID string, transposed bool) (DependencyGraph, error)
VersionDependencyGraph finds all the tasks from the version given by versionID and constructs a DependencyGraph from them.
func (*DependencyGraph) AddEdge ¶
func (g *DependencyGraph) AddEdge(dependentTask, dependedOnTask TaskNode, status string)
AddEdge adds an edge between tasks in the graph. The edge direction is determined by whether the DependencyGraph is transposed. Noop if one of the nodes doesn't exist in the graph.
func (*DependencyGraph) AddTaskNode ¶
func (g *DependencyGraph) AddTaskNode(tNode TaskNode)
AddTaskNode adds a node to the graph.
func (*DependencyGraph) Cycles ¶
func (g *DependencyGraph) Cycles() DependencyCycles
Cycles returns cycles in the graph, if any. Self-loops are also considered cycles.
func (*DependencyGraph) DepthFirstSearch ¶
func (g *DependencyGraph) DepthFirstSearch(start, target TaskNode, traverseEdge func(edge DependencyEdge) bool) bool
DepthFirstSearch begins a DFS from start and returns whether target is reachable. If traverseEdge is not nil an edge is only traversed if traverseEdge returns true on that edge.
func (*DependencyGraph) EdgesIntoTask ¶
func (g *DependencyGraph) EdgesIntoTask(t TaskNode) []DependencyEdge
EdgesIntoTask returns all the edges that point to t. For a regular graph these edges are tasks that directly depend on t. If the graph is transposed these edges are tasks t directly depends on.
func (*DependencyGraph) GetDependencyEdge ¶
func (g *DependencyGraph) GetDependencyEdge(fromTask, toTask TaskNode) *DependencyEdge
GetDependencyEdge returns a pointer to the edge from fromNode to toNode. If the edge doesn't exist it returns nil.
func (*DependencyGraph) Nodes ¶
func (g *DependencyGraph) Nodes() []TaskNode
Nodes returns a slice of all the task nodes in the graph.
func (*DependencyGraph) TopologicalStableSort ¶
func (g *DependencyGraph) TopologicalStableSort() ([]TaskNode, error)
TopologicalStableSort sorts the nodes in the graph topologically. It is stable in the sense that when a topological ordering is ambiguous the order the tasks were added to the graph prevails. To sort with all dependent tasks before the tasks they depend on use the default graph. To sort with all depended on tasks before the tasks that depend on them use a transposed graph.
type EvergreenSenderOptions ¶
type EvergreenSenderOptions struct {
// LevelInfo configures the sender's log levels. Defaults the default
// and threshold log levels to "trace".
LevelInfo send.LevelInfo
// Local is the sender for "fallback" operations and to collect any
// logger error output. Defaults to stdout.
Local send.Sender
// MaxBufferSize is the maximum number of bytes to buffer before
// persisting log data. Defaults to 10MB.
MaxBufferSize int
// FlushInterval is time interval at which to flush log lines,
// regardless of whether the max buffer size has been reached. A flush
// interval equal to 0 will disable timed flushes.
FlushInterval time.Duration
// Parse is the injectable line parser that allows the sender to be
// agnostic to the raw log line formats it ingests. Defaults to a basic
// line parser that adds the raw string as the log line data field.
Parse log.LineParser
// S3Usage tracks S3 API usage for log uploads. If set, flush() will increment log file
// metrics after each successful write. Concurrent flushes on a shared instance are
// serialized inside IncrementLogs via S3Usage.Init.
S3Usage *s3usage.S3Usage
// LogType is the type of log being written (e.g., s3usage.LogTypeTask).
LogType string
// LogKey is the S3 key for the log being written, used for storage cost tracking.
LogKey string
// contains filtered or unexported fields
}
EvergreenSenderOptions support the use and creation of an Evergreen sender.
type ExecutionPlatform ¶
type ExecutionPlatform string
ExecutionPlatform indicates the type of environment that the task runs in.
const ( // ExecutionPlatformHost indicates that the task runs in a host. ExecutionPlatformHost ExecutionPlatform = "host" // ExecutionPlatformContainer indicates that the task runs in a container. ExecutionPlatformContainer ExecutionPlatform = "container" )
type FilterOptions ¶
type FilterOptions struct {
TestName string
ExcludeDisplayNames bool
Statuses []string
GroupID string
Sort []testresult.SortBy
Limit int
Page int
BaseTasks []Task
IncludeQuarantinedTests bool
}
FilterOptions represents the filtering arguments for fetching test results.
type GenerateTasksEstimation ¶
type GenerateTasksEstimation struct {
EstimatedNumGeneratedTasks int
EstimatedNumActivatedGeneratedTasks int
}
GenerateTasksEstimation holds estimation results for a single generator task.
type GeneratedJSONFileStorage ¶
type GeneratedJSONFileStorage interface {
// FindByTaskID finds all generated JSON files for a given task.
Find(ctx context.Context, t *Task) (GeneratedJSONFiles, error)
// Insert inserts all the generated JSON files for the given task. If any
// of the files already exist, they are replaced.
Insert(ctx context.Context, t *Task, files GeneratedJSONFiles) error
}
GeneratedJSONFileStorage is an interface for accessing a task's generated JSON for generate.tasks to update the project YAML.
func GetGeneratedJSONFileStorage ¶
func GetGeneratedJSONFileStorage(ctx context.Context, settings *evergreen.Settings, method evergreen.ParserProjectStorageMethod) (GeneratedJSONFileStorage, error)
GetGeneratedJSONFileStorage returns the generated JSON file storage mechanism to access the persistent copy of it. Users of the returned GeneratedJSONFileStorage must call Close once they are finished using it.
type GeneratedJSONFiles ¶
type GeneratedJSONFiles []string
GeneratedJSONFiles represent files used by a task for generate.tasks to update the project YAML.
func GeneratedJSONFind ¶
func GeneratedJSONFind(ctx context.Context, settings *evergreen.Settings, t *Task) (GeneratedJSONFiles, error)
GeneratedJSONFind is a convenience wrapper to insert all generated JSON files for the given task to persistent storage.
type GeneratedTaskInfo ¶
type GeneratedTaskInfo struct {
TaskID string
TaskName string
BuildID string
BuildVariant string
BuildVariantDisplayName string
}
GeneratedTaskInfo contains basic information about a generated task.
func FindGeneratedTasksFromID ¶
func FindGeneratedTasksFromID(ctx context.Context, generatorID string) ([]GeneratedTaskInfo, error)
FindGeneratedTasksFromID finds all tasks that were generated by the given generator task and returns the filtered information.
type GetTaskTestResultsOptions ¶
type GetTaskTestResultsOptions struct {
// Fields limits the returned test result metadata to the specified fields.
Fields []string
// IncludeQuarantinedTests includes quarantined test snapshots. The snapshots
// are omitted by default because they can be large.
IncludeQuarantinedTests bool
// QuarantinedTestsLimit limits quarantined test snapshots in the database
// projection before they are decoded.
QuarantinedTestsLimit *int
}
GetTaskTestResultsOptions configures how test result metadata is fetched.
type GetTasksByVersionOptions ¶
type GetTasksByVersionOptions struct {
Statuses []string
BaseStatuses []string
Variants []string
TaskNames []string
Page int
Limit int
FieldsToProject []string
Sorts []TasksSortOrder
IncludeExecutionTasks bool
IncludeNeverActivatedTasks bool // NeverActivated tasks are tasks that lack an activation time
BaseVersionID string
}
type GroupedTaskStatusCount ¶
type GroupedTaskStatusCount struct {
Variant string `bson:"variant"`
DisplayName string `bson:"display_name"`
StatusCounts []*StatusCount `bson:"status_counts"`
}
func GetGroupedTaskStatsByVersion ¶
func GetGroupedTaskStatsByVersion(ctx context.Context, versionID string, opts GetTasksByVersionOptions) ([]*GroupedTaskStatusCount, error)
type HasMatchingTasksOptions ¶
type HostCreateDetail ¶
type LargeParserProjectTaskStats ¶
type LargeParserProjectTaskStats struct {
Project string `bson:"_id"`
RunningTasks int `bson:"running_tasks"`
}
LargeParserProjectTaskStats contains the running task count for a single project with parser projects stored in S3.
func GetLargeParserProjectTaskStats ¶
func GetLargeParserProjectTaskStats(ctx context.Context, env evergreen.Environment) ([]LargeParserProjectTaskStats, error)
GetLargeParserProjectTaskStats returns per-project counts of tasks currently running with S3-stored parser projects.
type PriorityBreakdown ¶
type PriorityBreakdown struct {
// InitialPriorityImpact represents how much of the total priority can be attributed to the
// original priority set on a task.
InitialPriorityImpact int64
// TaskGroupImpact represents how much of the total priority can be attributed to a
// task being in a task group.
TaskGroupImpact int64
// GeneratorTaskImpact represents how much of the total priority can be attributed to a
// task having a generate.tasks command in it.
GeneratorTaskImpact int64
// CommitQueueImpact represents how much of the total priority can be attributed to a task
// being in the commit queue.
CommitQueueImpact int64
}
PriorityBreakdown contains information on how much various factors impacted the custom priority value that is used in the queue sorting value equation.
type RankValueBreakdown ¶
type RankValueBreakdown struct {
// CommitQueueImpact represents how much of the total rank value can be attributed to a task
// being in the commit queue.
CommitQueueImpact int64
// NumDependentsImpact represents how much of the total rank value can be attributed to the number
// of tasks that are dependents of a task.
NumDependentsImpact int64
// EstimatedRuntimeImpact represents how much of the total rank value can be attributed to the
// estimated runtime of a task.
EstimatedRuntimeImpact int64
// MainlineWaitTimeImpact represents how much of the total rank value can be attributed to
// how long a mainline task has been waiting for dispatch.
MainlineWaitTimeImpact int64
// StepbackImpact represents how much of the total rank value can be attributed to
// a task being activated by the stepback process.
StepbackImpact int64
// PatchImpact represents how much of the total rank value can be attributed to a task
// being part of a patch.
PatchImpact int64
// PatchWaitTimeImpact represents how much of the total rank value can be attributed to
// how long a patch task has been waiting for dispatch.
PatchWaitTimeImpact int64
}
RankValueBreakdown contains information on how much various factors impacted the custom rank value that is used in the queue sorting value equation.
type ResultCounts ¶
type ResultCounts struct {
Total int `json:"total"`
Inactive int `json:"inactive"`
Unstarted int `json:"unstarted"`
Started int `json:"started"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
SetupFailed int `json:"setup-failed"`
SystemFailed int `json:"system-failed"`
SystemUnresponsive int `json:"system-unresponsive"`
SystemTimedOut int `json:"system-timed-out"`
TestTimedOut int `json:"test-timed-out"`
message.Base `json:"metadata"`
// contains filtered or unexported fields
}
ResultCounts stores a collection of counters related to.
This type implements the grip/message.Composer interface and may be passed directly to grip loggers.
func GetResultCounts ¶
func GetResultCounts(tasks []Task) *ResultCounts
GetResultCounts takes a list of tasks and collects their outcomes using the same status as the.
func (*ResultCounts) Loggable ¶
func (c *ResultCounts) Loggable() bool
func (*ResultCounts) Raw ¶
func (c *ResultCounts) Raw() any
func (*ResultCounts) String ¶
func (c *ResultCounts) String() string
type SortingValueBreakdown ¶
type SortingValueBreakdown struct {
TaskGroupLength int64
TotalValue int64
PriorityBreakdown PriorityBreakdown
RankValueBreakdown RankValueBreakdown
}
SortingValueBreakdown is the full breakdown of the final value used to sort on in the queue, with accompanying breakdowns of priority and rank value.
type StatusCount ¶
type StatusItem ¶
func GetRecentTaskStats ¶
type StepbackInfo ¶
type StepbackInfo struct {
// LastFailingStepbackTaskId stores the last failing task while doing stepback.
LastFailingStepbackTaskId string `bson:"last_failing_stepback_task_id,omitempty" json:"last_failing_stepback_task_id"`
// LastPassingStepbackTaskId stores the last passing task while doing stepback.
LastPassingStepbackTaskId string `bson:"last_passing_stepback_task_id,omitempty" json:"last_passing_stepback_task_id"`
// NextStepbackTaskId stores the next task id to stepback to when doing bisect stepback. This
// is the middle of LastFailingStepbackTaskId and LastPassingStepbackTaskId of the last iteration.
NextStepbackTaskId string `bson:"next_stepback_task_id,omitempty" json:"next_stepback_task_id"`
// PreviousStepbackTaskId stores the last stepback iteration id.
PreviousStepbackTaskId string `bson:"previous_stepback_task_id,omitempty" json:"previous_stepback_task_id"`
// GeneratedStepbackInfo stores information on a generator for it's generated tasks.
GeneratedStepbackInfo []StepbackInfo `bson:"generated_stepback_info,omitempty" json:"generated_stepback_info,omitempty"`
// Generator fields only (responsible for propogating stepback in its generated tasks).
// DisplayName is the display name of the generated task.
DisplayName string `bson:"display_name,omitempty" json:"display_name,omitempty"`
// BuildVariant is the build variant of the generated task.
BuildVariant string `bson:"build_variant,omitempty" json:"build_variant,omitempty"`
}
StepbackInfo helps determine which task to bisect to when performing stepback.
func (*StepbackInfo) GetStepbackInfoForGeneratedTask ¶
func (s *StepbackInfo) GetStepbackInfoForGeneratedTask(displayName string, buildVariant string) *StepbackInfo
GetStepbackInfoForGeneratedTask returns the StepbackInfo for a generated task that's on a generator task.
func (*StepbackInfo) IsZero ¶
func (s *StepbackInfo) IsZero() bool
IsZero returns true if the StepbackInfo is empty or nil. It does not include GeneratedStepbackInfo in the check because those do not cause a generator to stepback.
type Task ¶
type Task struct {
Id string `bson:"_id" json:"id"`
Secret string `bson:"secret" json:"secret"`
// Time fields (see also model.Version for the same CreateTime vs IngestTime distinction):
// CreateTime - logical time for this task, aligned with the parent version's semantics: derived from
// commit/revision metadata or patch timing (same idea as the version's CreateTime). It is not the
// wall-clock time the task row was written; use IngestTime for that.
// IngestTime - wall-clock time this task document was first inserted in Evergreen (set in createOneTask).
// DispatchTime - the time the task runner starts up the agent on the host.
// ScheduledTime - the time the task is scheduled.
// StartTime - the time the agent starts the task on the host after spinning it up.
// FinishTime - the time the task was completed on the remote host.
// ActivatedTime - the time the task was marked as available to be scheduled, automatically or by a developer.
// DependenciesMet - for tasks that have dependencies, the time all dependencies are met.
CreateTime time.Time `bson:"create_time" json:"create_time"`
IngestTime time.Time `bson:"injest_time" json:"ingest_time"`
DispatchTime time.Time `bson:"dispatch_time" json:"dispatch_time"`
ScheduledTime time.Time `bson:"scheduled_time" json:"scheduled_time"`
StartTime time.Time `bson:"start_time" json:"start_time"`
FinishTime time.Time `bson:"finish_time" json:"finish_time"`
ActivatedTime time.Time `bson:"activated_time" json:"activated_time"`
DependenciesMetTime time.Time `bson:"dependencies_met_time,omitempty" json:"dependencies_met_time,omitempty"`
Version string `bson:"version" json:"version,omitempty"`
// Project is the project id of the task.
Project string `bson:"branch" json:"branch,omitempty"`
Revision string `bson:"gitspec" json:"gitspec"`
// Priority is a specifiable value that adds weight to the prioritization that task will be given in its
// corresponding distro task queue.
Priority int64 `bson:"priority" json:"priority"`
// SortingValueBreakdown is not persisted to the db, but stored in memory and passed to the task queue document.
// It contains information on what factors led to the overall queue ranking value for the task.
SortingValueBreakdown SortingValueBreakdown `bson:"-" json:"sorting_value_breakdown"`
TaskGroup string `bson:"task_group" json:"task_group"`
TaskGroupMaxHosts int `bson:"task_group_max_hosts,omitempty" json:"task_group_max_hosts,omitempty"`
TaskGroupOrder int `bson:"task_group_order,omitempty" json:"task_group_order,omitempty"`
ResultsService string `bson:"results_service,omitempty" json:"results_service,omitempty"`
HasTestResults bool `bson:"has_test_results,omitempty" json:"has_test_results,omitempty"`
ResultsFailed bool `bson:"results_failed,omitempty" json:"results_failed,omitempty"`
// NumQuarantinedTestsSkipped is the number of tests this execution skipped
// because they were quarantined in TSS.
NumQuarantinedTestsSkipped int `bson:"num_quarantined_tests_skipped,omitempty" json:"num_quarantined_tests_skipped,omitempty"`
MustHaveResults bool `bson:"must_have_results,omitempty" json:"must_have_results,omitempty"`
// only relevant if the task is running. the time of the last heartbeat
// sent back by the agent
LastHeartbeat time.Time `bson:"last_heartbeat" json:"last_heartbeat"`
// Activated indicates whether the task should be scheduled to run or not.
Activated bool `bson:"activated" json:"activated"`
ActivatedBy string `bson:"activated_by" json:"activated_by"`
DeactivatedForDependency bool `bson:"deactivated_for_dependency" json:"deactivated_for_dependency"`
BuildId string `bson:"build_id" json:"build_id"`
DistroId string `bson:"distro" json:"distro"`
BuildVariant string `bson:"build_variant" json:"build_variant"`
BuildVariantDisplayName string `bson:"build_variant_display_name" json:"-"`
DependsOn []Dependency `bson:"depends_on" json:"depends_on"`
// UnattainableDependency caches the contents of DependsOn for more
// efficient querying. It is true if any of its dependencies is unattainable
// and is false if all of its dependencies are attainable.
UnattainableDependency bool `bson:"unattainable_dependency" json:"unattainable_dependency"`
NumDependents int `bson:"num_dependents,omitempty" json:"num_dependents,omitempty"`
// OverrideDependencies indicates whether a task should override its dependencies. If set, it will not
// wait for its dependencies to finish before running.
OverrideDependencies bool `bson:"override_dependencies,omitempty" json:"override_dependencies,omitempty"`
// SecondaryDistros refer to the optional secondary distros that can be
// associated with a task. This is used for running tasks in case there are
// idle hosts in a distro with an empty primary queue. This is a distinct concept
// from distro aliases (i.e. alternative distro names).
// Tags refer to outdated naming; maintained for compatibility.
SecondaryDistros []string `bson:"distro_aliases,omitempty" json:"distro_aliases,omitempty"`
// Human-readable name
DisplayName string `bson:"display_name" json:"display_name"`
// Tags that describe the task
Tags []string `bson:"tags,omitempty" json:"tags,omitempty"`
// The host the task was run on. This value is only set for host tasks.
HostId string `bson:"host_id,omitempty" json:"host_id"`
// ExecutionPlatform determines the execution environment that the task runs
// in.
ExecutionPlatform ExecutionPlatform `bson:"execution_platform,omitempty" json:"execution_platform,omitempty"`
// The version of the agent this task was run on.
AgentVersion string `bson:"agent_version,omitempty" json:"agent_version,omitempty"`
// TaskOutputInfo holds the information for the interface that
// coordinates persistent storage of a task's output data.
// There are four possible scenarios:
// 1. The task will never have output data (e.g., display tasks)
// and, therefore, the value is and always will be nil.
// 2. The task does not have output data yet, but can in the future
// if/when dispatched, and, therefore, the value is currently
// nil.
// 3. The task has been dispatched with the task output information
// initialized and the application can safely use this field to
// fetch any output data. If the task has not finished running,
// the output data is accessible but may not be complete yet.
// 4. The task has data but was run before the introduction of the
// field and should be initialized before the application can
// safely fetch any output data.
// This field should *never* be accessed directly, instead call
// `Task.GetTaskOutputSafe()`.
TaskOutputInfo *TaskOutput `bson:"task_output_info,omitempty" json:"task_output_info,omitempty"`
// Set to true if the task should be considered for mainline github checks
IsGithubCheck bool `bson:"is_github_check,omitempty" json:"is_github_check,omitempty"`
// CheckRunPath is a local file path to an output json file for the checkrun.
CheckRunPath *string `bson:"check_run_path,omitempty" json:"check_run_path,omitempty"`
// CheckRunId is the id for the checkrun that was created in github.
// This is used to update the checkrun for future executions of the task.
CheckRunId *int64 `bson:"check_run_id,omitempty" json:"check_run_id,omitempty"`
// CanReset indicates that the task has successfully archived and is in a valid state to be reset.
CanReset bool `bson:"can_reset,omitempty" json:"can_reset,omitempty"`
Execution int `bson:"execution" json:"execution"`
OldTaskId string `bson:"old_task_id,omitempty" json:"old_task_id,omitempty"`
Archived bool `bson:"archived,omitempty" json:"archived,omitempty"`
// RevisionOrderNumber for user-submitted patches is the user's current patch submission count.
// For mainline commits for a project, it is the amount of versions for that repositry so far.
RevisionOrderNumber int `bson:"order,omitempty" json:"order,omitempty"`
// task requester - this is used to help tell the
// reason this task was created. e.g. it could be
// because the repotracker requested it (via tracking the
// repository) or it was triggered by a developer
// patch request
Requester string `bson:"r" json:"r"`
// tasks that are part of a child patch will store the id and patch number of the parent patch
ParentPatchID string `bson:"parent_patch_id,omitempty" json:"parent_patch_id,omitempty"`
ParentPatchNumber int `bson:"parent_patch_number,omitempty" json:"parent_patch_number,omitempty"`
// Status represents the various stages the task could be in. Note that this
// task status is distinct from the way a task status is displayed in the
// UI. For example, a task that has failed will have a status of
// evergreen.TaskFailed regardless of the specific cause of failure.
// However, in the UI, the displayed status supports more granular failure
// type such as system failed and setup failed by checking this status and
// the task status details.
Status string `bson:"status" json:"status"`
Details apimodels.TaskEndDetail `bson:"details" json:"task_end_details"`
Aborted bool `bson:"abort,omitempty" json:"abort"`
AbortInfo AbortInfo `bson:"abort_info,omitempty" json:"abort_info,omitempty"`
// HostCreateDetails stores information about why host.create failed for this task
HostCreateDetails []HostCreateDetail `bson:"host_create_details,omitempty" json:"host_create_details,omitempty"`
// DisplayStatus is not persisted to the db. It is the status to display in the UI.
// It may be added via aggregation
DisplayStatus string `bson:"display_status,omitempty" json:"display_status,omitempty"`
// DisplayStatusCache is semantically the same as DisplayStatus, but is persisted to the DB, unlike DisplayStatus.
DisplayStatusCache string `bson:"display_status_cache,omitempty" json:"display_status_cache,omitempty"`
// BaseTask is not persisted to the db. It is the data of the task on the base commit
// It may be added via aggregation
BaseTask BaseTaskInfo `bson:"base_task" json:"base_task"`
// TimeTaken is how long the task took to execute (if it has finished) or how long the task has been running (if it has started)
TimeTaken time.Duration `bson:"time_taken" json:"time_taken"`
// PredictedTaskCost is the expected cost of running the task based on historical data
PredictedTaskCost cost.Cost `bson:"predicted_cost,omitempty" json:"predicted_cost,omitempty"`
// TaskCost is the actual cost of the task based on runtime and distro cost rates
TaskCost cost.Cost `bson:"cost,omitempty" json:"cost,omitempty"`
// S3Usage tracks S3 API usage for cost calculation
S3Usage s3usage.S3Usage `bson:"s3_usage,omitempty" json:"s3_usage,omitempty"`
// WaitSinceDependenciesMet is populated in GetDistroQueueInfo, used for host allocation
WaitSinceDependenciesMet time.Duration `bson:"wait_since_dependencies_met,omitempty" json:"wait_since_dependencies_met,omitempty"`
// how long we expect the task to take from start to
// finish. expected duration is the legacy value, but the UI
// probably depends on it, so we maintain both values.
ExpectedDuration time.Duration `bson:"expected_duration,omitempty" json:"expected_duration,omitempty"`
ExpectedDurationStdDev time.Duration `bson:"expected_duration_std_dev,omitempty" json:"expected_duration_std_dev,omitempty"`
DurationPrediction util.CachedDurationValue `bson:"duration_prediction,omitempty" json:"-"`
// test results embedded from the testresults collection
LocalTestResults []testresult.TestResult `bson:"-" json:"test_results"`
// display task fields
DisplayOnly bool `bson:"display_only,omitempty" json:"display_only,omitempty"`
ExecutionTasks []string `bson:"execution_tasks,omitempty" json:"execution_tasks,omitempty"`
LatestParentExecution int `bson:"latest_parent_execution" json:"latest_parent_execution"`
StepbackInfo *StepbackInfo `bson:"stepback_info,omitempty" json:"stepback_info,omitempty"`
// ResetWhenFinished indicates that a task should be reset once it is
// finished running. This is typically to deal with tasks that should be
// reset but cannot do so yet because they're currently running. This and
// ResetFailedWhenFinished are mutually exclusive settings.
ResetWhenFinished bool `bson:"reset_when_finished,omitempty" json:"reset_when_finished,omitempty"`
// ResetWhenFinished indicates that a task should be reset once it is
// finished running and only reset if it fails. This is typically to deal
// with tasks that should be reset on failure but cannot do so yet because
// they're currently running. This and ResetWhenFinished are mutually
// exclusive settings.
ResetFailedWhenFinished bool `bson:"reset_failed_when_finished,omitempty" json:"reset_failed_when_finished,omitempty"`
// NumAutomaticRestarts is the number of times the task has been programmatically restarted via a failed agent command.
NumAutomaticRestarts int `bson:"num_automatic_restarts,omitempty" json:"num_automatic_restarts,omitempty"`
// IsAutomaticRestart indicates that the task was restarted via a failing agent command that was set to retry on failure.
IsAutomaticRestart bool `bson:"is_automatic_restart,omitempty" json:"is_automatic_restart,omitempty"`
DisplayTask *Task `bson:"-" json:"-"` // this is a local pointer from an exec to display task
// DisplayTaskId is set to the display task ID if the task is an execution task, the empty string if it's not an execution task,
// and is nil if we haven't yet checked whether or not this task has a display task.
DisplayTaskId *string `bson:"display_task_id,omitempty" json:"display_task_id,omitempty"`
// GenerateTask indicates that the task generates other tasks, which the
// scheduler will use to prioritize this task. This will not be set for
// tasks where the generate.tasks command runs outside of the main task
// block (e.g. pre, timeout).
GenerateTask bool `bson:"generate_task,omitempty" json:"generate_task,omitempty"`
// GeneratedTasks indicates that the task has already generated other tasks. This fields
// allows us to noop future requests, since a task should only generate others once.
GeneratedTasks bool `bson:"generated_tasks,omitempty" json:"generated_tasks,omitempty"`
// GeneratedBy, if present, is the ID of the task that generated this task.
GeneratedBy string `bson:"generated_by,omitempty" json:"generated_by,omitempty"`
// GeneratedJSONAsString is the configuration information to update the
// project YAML for generate.tasks. This is only used to store the
// configuration if GeneratedJSONStorageMethod is unset or is explicitly set
// to "db".
GeneratedJSONAsString GeneratedJSONFiles `bson:"generated_json,omitempty" json:"generated_json,omitempty"`
// GeneratedJSONStorageMethod describes how the generated JSON for
// generate.tasks is stored for this task before it's merged with the
// existing project YAML.
GeneratedJSONStorageMethod evergreen.ParserProjectStorageMethod `bson:"generated_json_storage_method,omitempty" json:"generated_json_storage_method,omitempty"`
// GenerateTasksError any encountered while generating tasks.
GenerateTasksError string `bson:"generate_error,omitempty" json:"generate_error,omitempty"`
// GeneratedTasksToActivate is only populated if we want to override activation for these generated tasks, because of stepback.
// Maps the build variant to a list of task names.
GeneratedTasksToActivate map[string][]string `bson:"generated_tasks_to_stepback,omitempty" json:"generated_tasks_to_stepback,omitempty"`
// NumGeneratedTasks is the number of tasks that this task has generated.
NumGeneratedTasks int `bson:"num_generated_tasks,omitempty" json:"num_generated_tasks,omitempty"`
// EstimatedNumGeneratedTasks is the estimated number of tasks that this task will generate.
EstimatedNumGeneratedTasks *int `bson:"estimated_num_generated_tasks,omitempty" json:"estimated_num_generated_tasks,omitempty"`
// NumActivatedGeneratedTasks is the number of tasks that this task has generated and activated.
NumActivatedGeneratedTasks int `bson:"num_activated_generated_tasks,omitempty" json:"num_activated_generated_tasks,omitempty"`
// EstimatedNumActivatedGeneratedTasks is the estimated number of tasks that this task will generate and activate.
EstimatedNumActivatedGeneratedTasks *int `bson:"estimated_num_activated_generated_tasks,omitempty" json:"estimated_num_activated_generated_tasks,omitempty"`
// Fields set if triggered by an upstream build.
TriggerID string `bson:"trigger_id,omitempty" json:"trigger_id,omitempty"`
TriggerType string `bson:"trigger_type,omitempty" json:"trigger_type,omitempty"`
TriggerEvent string `bson:"trigger_event,omitempty" json:"trigger_event,omitempty"`
// IsEssentialToSucceed indicates that this task must finish in order for
// its build and version to be considered successful. For example, tasks
// selected by the GitHub PR alias must succeed for the GitHub PR requester
// before its build or version can be reported as successful, but tasks
// manually scheduled by the user afterwards are not required.
IsEssentialToSucceed bool `bson:"is_essential_to_succeed" json:"is_essential_to_succeed"`
// HasAnnotations indicates whether there exist task annotations with this task's
// execution and id that have a populated Issues key
HasAnnotations bool `bson:"has_annotations" json:"has_annotations"`
// NumNextTaskDispatches is the number of times the task has been dispatched to run on a
// host or in a container. This is used to determine if the task seems to be stuck.
NumNextTaskDispatches int `bson:"num_next_task_dispatches" json:"num_next_task_dispatches"`
// CachedProjectStorageMethod is a cached value how the parser project for this task's version was
// stored at the time this task was created. If this is empty, the default storage method is StorageMethodDB.
CachedProjectStorageMethod evergreen.ParserProjectStorageMethod `bson:"cached_project_storage_method" json:"cached_project_storage_method,omitempty"`
// TestSelectionEnabled indicates whether test selection is enabled for this
// task.
TestSelectionEnabled bool `bson:"test_selection_enabled" json:"test_selection_enabled"`
}
func AddParentDisplayTasks ¶
func ByBeforeMidwayTaskFromIds ¶
ByBeforeMidwayTaskFromIds tries to get the midway task between two tasks but if it does not find it (i.e. periodic builds), it gets the closest task (with lower order number). If there are no matching tasks, or the task it gets is out of bounds, it returns the given lower order revision task.
It verifies that the tasks are from the same project, requester, build variant, and display name.
func FilterTasksOnStatus ¶
FilterTasksOnStatus tasks in a slice of tasks and removes tasks whose result status do not match the passed-in statuses
func Find ¶
Find returns all tasks that satisfy the query it also filters out display tasks from the results.
func FindActivatedStepbackTaskByName ¶
func FindActivatedStepbackTaskByName(ctx context.Context, projectId string, variantName string, taskName string) (*Task, error)
FindActivatedStepbackTaskByName queries for running/scheduled stepback tasks with matching build variant and task name.
func FindAllDependencyTasksToModify ¶
func FindAllDependencyTasksToModify(ctx context.Context, tasks []Task, isBlocking, ignoreDependencyStatusForBlocking bool) ([]Task, error)
FindAllDependencyTasksToModify finds tasks that depend on the given tasks. The isBlocking parameter indicates whether we are fetching tasks to unblock them, and if so, for each task, all dependencies that have been marked unattainable will be retrieved. Otherwise, we are fetching tasks to block them, and for each task, all dependencies that have a status that that would block the task from running (i.e., it is inconsistent with the task's Dependency.Status field) and have not been marked unattainable will be retrieved. The ignoreDependencyStatusForBlocking parameter indicates whether all tasks that depend on the given need to be updated for a blocking operation (for example, if a single host task group host terminates before completing the group and we need to block all later tasks regardless of their Dependency.Status field).
This must find tasks in smaller chunks to avoid the 16 MB query size limit - if the number of tasks is large, a single query could be too large and the DB will reject it.
func FindAllFirstExecution ¶
func FindAllOld ¶
Find returns really all tasks that satisfy the query.
func FindByExecutionTasksAndMaxExecution ¶
func FindByExecutionTasksAndMaxExecution(ctx context.Context, taskIds []string, execution int, filters ...bson.E) ([]Task, error)
FindByExecutionTasksAndMaxExecution returns the tasks corresponding to the passed in taskIds and execution, or the most recent executions of those tasks if they do not have a matching execution.
func FindByIdExecution ¶
FindByIdExecution returns a single task with the given ID and execution. If execution is nil, the latest execution is returned.
func FindCompletedTasksByBuild ¶
func FindCompletedTasksByBuild(ctx context.Context, buildID string, taskIDs []string) ([]Task, error)
FindCompletedTasksByBuild returns all completed tasks belonging to the given build ID. Excludes execution tasks. If no taskIDs are specified, all completed tasks belonging to the build are returned.
func FindCompletedTasksByVersion ¶
func FindCompletedTasksByVersion(ctx context.Context, versionID string, taskIDs []string) ([]Task, error)
FindCompletedTasksByVersion returns all completed tasks belonging to the given version ID. Excludes execution tasks. If no task IDs are specified, all completed tasks belonging to the version are returned.
func FindHostRunnable ¶
FindHostRunnable finds all host tasks that can be scheduled for a distro with an additional consideration for whether the task's dependencies are met. If removeDeps is true, tasks with unmet dependencies are excluded.
func FindHostSchedulable ¶
FindHostSchedulable finds all tasks that can be scheduled for a distro primary queue.
func FindHostSchedulableForAlias ¶
FindHostSchedulableForAlias finds all tasks that can be scheduled for a distro secondary queue.
func FindOldWithDisplayTasks ¶
FindOldWithDisplayTasks returns all display and execution tasks from the old collection that satisfy the given query.
func FindOneId ¶
FindOneId returns a single task with the given ID, excluding the GeneratedJSONAsString field which can be very large. Use FindOneIdWithGeneratedJSON if the generated JSON is needed.
func FindOneIdAndExecution ¶
FindOneIdAndExecution returns a single task with the given ID and execution.
func FindOneIdOldOrNew ¶
FindOneIdOldOrNew returns a single task with the given ID and execution, first looking in the old tasks collection, then the tasks collection.
func FindOneIdWithFields ¶
FindOneIdWithFields returns a single task with the given ID, projecting only the given fields.
func FindOneIdWithGeneratedJSON ¶
FindOneIdWithGeneratedJSON returns a single task with the given ID, including the GeneratedJSONAsString field.
func FindOneOld ¶
FindOneOld returns a single task from the old tasks collection that satifisfies the given query.
func FindOneOldByIdAndExecution ¶
FindOneOldByIdAndExecution returns a single task from the old tasks collection with the given ID and execution.
func FindOneOldWithFields ¶
func FindStuckDispatching ¶
FindStuckDispatching returns all "stuck" tasks. A task is considered stuck if it has a "dispatched" status for more than 30 minutes.
func FindTaskGroupFromBuild ¶
func FindTasksFromVersions ¶
FindTasksFromVersions returns all tasks associated with the given versions. Note that this only returns a few key fields.
func FindWithFields ¶
func FindWithSort ¶
func GenerateNotRun ¶
GenerateNotRun returns tasks that have requested to generate tasks.
func GetLatestTaskFromImage ¶
GetLatestTaskFromImage retrieves the latest task from all the distros corresponding to the imageID.
func GetRecentTasks ¶
GetRecentTasks returns the task results used by the recent_tasks endpoints.
func GetRecursiveDependenciesUp ¶
func GetRecursiveDependenciesUp(ctx context.Context, tasks []Task, depCache map[string]Task) ([]Task, error)
GetRecursiveDependenciesUp returns all tasks recursively depended upon that are not in the original task slice (this includes earlier tasks in task groups, if applicable). depCache should originally be nil. We assume there are no dependency cycles.
func GetTasksByVersion ¶
func GetTasksByVersion(ctx context.Context, versionID string, opts GetTasksByVersionOptions) ([]Task, int, error)
GetTasksByVersion gets all tasks for a specific version Query results can be filtered by task name, variant name and status in addition to being paginated and limited
func MarkAllForUnattainableDependencies ¶
func MarkAllForUnattainableDependencies(ctx context.Context, tasks []Task, dependencyIDs []string, unattainable bool) ([]Task, error)
MarkAllForUnattainableDependencies updates many tasks (taskIDs) to mark a subset of all their dependencies (dependencyIDs) as attainable or not. If marking the dependencies unattainable, it creates an event log for each newly blocked task. This returns all the tasks after the update.
func UnscheduleStaleUnderwaterHostTasks ¶
UnscheduleStaleUnderwaterHostTasks Removes host tasks older than the unschedulable threshold (e.g. one week) from the scheduler queue. If you pass an empty string as an argument to this function, this operation will select tasks from all distros.
func (*Task) AddDependency ¶
func (t *Task) AddDependency(ctx context.Context, d Dependency) error
func (*Task) AllDependenciesSatisfied ¶
AllDependenciesSatisfied inspects the tasks first-order dependencies with regards to the cached tasks, and reports if all of the dependencies have been satisfied.
If the cached tasks do not include a dependency specified by one of the tasks, the function returns an error.
func (*Task) Archive ¶
Archive modifies the current execution of the task so that it is no longer considered the latest execution. This task execution is inserted into the old_tasks collection. If this is a display task, its execution tasks are also archived.
func (*Task) ComputePredictedCostForWeek ¶
func (t *Task) ComputePredictedCostForWeek(ctx context.Context) (CostPredictionResult, error)
func (*Task) DependenciesMet ¶
DependenciesMet checks whether the dependencies for the task have all completed successfully. If any of the dependencies exist in the map that is passed in, they are used to check rather than fetching from the database. All queries are cached back into the map for later use.
func (*Task) DetermineDisplayStatus ¶
DetermineDisplayStatus publicly exports findDisplayStatus
func (*Task) FetchExpectedDuration ¶
func (t *Task) FetchExpectedDuration(ctx context.Context) util.DurationStats
func (*Task) FindAbortingAndResettingDependencies ¶
in the process of aborting and will eventually reset themselves.
func (*Task) FindTaskOnBaseCommit ¶
FindTaskOnBaseCommit returns the task that is on the base commit.
func (*Task) FindTaskOnPreviousCommit ¶
func (*Task) GetDeactivatedBlockingDependencies ¶
func (t *Task) GetDeactivatedBlockingDependencies(ctx context.Context, depCache map[string]Task) ([]string, error)
GetDeactivatedBlockingDependencies gets all blocking tasks that are not finished and are not activated. These tasks are not going to run unless they are manually activated.
func (*Task) GetDisplayCost ¶
GetDisplayCost returns the task's cost for display purposes.
func (*Task) GetDisplayStatus ¶
GetDisplayStatus finds and sets DisplayStatus to the task. It should reflect the statuses assigned by DisplayStatusExpression / addDisplayStatusCache.
func (*Task) GetFinishedBlockingDependencies ¶
func (t *Task) GetFinishedBlockingDependencies(ctx context.Context, depCache map[string]Task) ([]Task, error)
GetFinishedBlockingDependencies gets all blocking tasks that are finished or blocked.
func (*Task) GetJQL ¶
Generates a jira JQL string from the task When we search in jira for a task we search in the specified JIRA project If there are any test results, then we only search by test file name of all of the failed tests. Otherwise we search by the task name.
func (*Task) GetS3ArtifactUsageFromDB ¶
GetS3ArtifactUsageFromDB reconstructs artifact S3 usage on the crash path when the agent never sent a final report. Counts only devprod-owned uploads (ARN or account ID). Re-uploads to the same (bucket, key, role ARN) are deduped: PUTs accumulate, bytes take the last non-zero size.
func (*Task) GetS3LogUsageFromS3 ¶
GetS3LogUsageFromS3 reconstructs log S3 usage for the crash path, when the agent never reached teardown. PutRequests are approximated as 1 PUT per stored chunk; multipart uploads that issued multiple PUTs against a single object are not counted. Best-effort.
func (*Task) GetTaskGroupString ¶
func (*Task) GetTaskLogs ¶
func (t *Task) GetTaskLogs(ctx context.Context, getOpts TaskLogGetOptions) (log.LogIterator, error)
GetTaskLogs returns the task's task logs with the given options.
func (*Task) GetTaskOutputSafe ¶
func (t *Task) GetTaskOutputSafe() (*TaskOutput, bool)
GetTaskOutputSafe returns an instantiation of the task output interface and whether it is safe to fetch task output data. This function should always be called to access task output data.
func (*Task) GetTestLogs ¶
func (t *Task) GetTestLogs(ctx context.Context, getOpts TestLogGetOptions) (log.LogIterator, error)
GetTestLogs returns the task's test logs with the specified options.
func (*Task) GetTestResults ¶
func (t *Task) GetTestResults(ctx context.Context, env evergreen.Environment, filterOpts *FilterOptions) (testresult.TaskTestResults, error)
GetTestResults returns the merged test results filtered, sorted, and paginated as specified by the optional filter options for the given tasks.
func (*Task) GetTestResultsStats ¶
func (t *Task) GetTestResultsStats(ctx context.Context, env evergreen.Environment) (testresult.TaskTestResultsStats, error)
GetTestResultsStats returns basic statistics of the task's test results.
func (*Task) GetTestResultsTasks ¶
GetTestResultsTasks returns the options required for fetching test results for the task.
Calling this function explicitly is typically not necessary. In cases where additional tasks are required for fetching test results, such as when sorting results by some base status, using this function to populate those task options is useful.
func (*Task) HasCheckRun ¶
HasCheckRun retruns true if the task specifies a check run path.
func (*Task) HasCostPrediction ¶
func (*Task) HasDependenciesMet ¶
HasDependenciesMet indicates whether the task has had its dependencies met.
func (*Task) HasResults ¶
HasResults returns whether the task has test results or not.
func (*Task) HasValidDistro ¶
HasValidDistro determines if the task has a valid distro.
func (*Task) IncNumNextTaskDispatches ¶
IncNumNextTaskDispatches sets the number of times a host has requested this task and execution as its next task.
func (*Task) IsAbortable ¶
IsAbortable returns true if the task can be aborted.
func (*Task) IsFinished ¶
IsFinished returns true if the task is no longer running
func (*Task) IsHostDispatchable ¶
IsHostDispatchable returns true if the task should run on a host and can be dispatched.
func (*Task) IsHostTask ¶
IsHostTask returns true if it's a task that runs on hosts.
func (*Task) IsInProgress ¶
IsInProgress returns true if the task has been dispatched and is about to run, or is already running.
func (*Task) IsPartOfSingleHostTaskGroup ¶
func (*Task) IsPatchRequest ¶
func (*Task) IsRestartFailedOnly ¶
IsRestartFailedOnly returns true if the task should only restart failed tests.
func (*Task) IsStuckTask ¶
IsStuckTask returns true if the task has been dispatched over the system limit
func (*Task) IsUnfinishedSystemUnresponsive ¶
IsUnfinishedSystemUnresponsive returns true only if this is an unfinished system unresponsive task (i.e. not on max execution)
func (*Task) IsUnscheduled ¶
IsUnscheduled returns true if a task is unscheduled and will not run. This is logically equivalent to evergreen.TaskUnscheduled from (Task).GetDisplayStatus.
func (*Task) LogBucketName ¶
LogBucketName returns the S3 bucket name for this task's logs, applying the long-retention redirect if the project is in the long-retention list.
func (*Task) MarkAsHostDispatched ¶
func (t *Task) MarkAsHostDispatched(ctx context.Context, hostID, distroID, agentRevision string, dispatchTime time.Time) error
MarkAsHostDispatched marks that the task has been dispatched onto a particular host. If the task is part of a display task, the display task is also marked as dispatched to a host. Returns an error if any of the database updates fail.
func (*Task) MarkAsHostDispatchedWithEnv ¶
func (t *Task) MarkAsHostDispatchedWithEnv(ctx context.Context, env evergreen.Environment, hostID, distroID, agentRevision string, dispatchTime time.Time) error
MarkAsHostDispatchedWithEnv marks that the task has been dispatched onto a particular host. Unlike MarkAsHostDispatched, this does not update the parent display task.
func (*Task) MarkAsHostUndispatched ¶
MarkAsHostUndispatched marks that the host task is undispatched. If the task is already dispatched to a host, it aborts the dispatch by undoing the dispatch updates. This is the inverse operation of MarkAsHostDispatchedWithEnv.
func (*Task) MarkDependenciesFinished ¶
MarkDependenciesFinished updates all direct dependencies on this task to cache whether this task has finished running, and at what time it finished (if applicable).
func (*Task) MarkEnd ¶
func (t *Task) MarkEnd(ctx context.Context, finishTime time.Time, detail *apimodels.TaskEndDetail) error
MarkEnd handles the Task updates associated with ending a task. If the task's start time is zero at this time, it will set it to the finish time minus the timeout time.
func (*Task) MarkFailed ¶
MarkFailed changes the state of the task to failed.
func (*Task) MarkSystemFailed ¶
func (*Task) MarkUnscheduled ¶
MarkUnscheduled marks the task as undispatched and updates it in the database
func (*Task) MarshalBSON ¶
func (*Task) MoveTestAndTaskLogsToFailedBucket ¶
func (t *Task) MoveTestAndTaskLogsToFailedBucket(ctx context.Context, settings *evergreen.Settings, sourceBucketCfg evergreen.BucketConfig, runInOldTaskCollection bool) error
MoveTestAndTaskLogsToFailedBucket moves task + test logs to the failed-task bucket using the provided source bucket config
func (*Task) NextCompletedTask ¶
func (t *Task) NextCompletedTask(ctx context.Context, project string, statuses []string) (*Task, error)
NextCompletedTask finds the next completed task for the same project + build variant + display name combination as the specified task. It defaults to completed statuses if the array is empty.
func (*Task) PopulateTestResults ¶
PopulateTestResults populates the task's LocalTestResults field with any test results the task may have. If the results are already populated, this function no-ops.
func (*Task) PreviousCompletedTask ¶
func (t *Task) PreviousCompletedTask(ctx context.Context, project string, statuses []string) (*Task, error)
Find the previously completed task for the same project + build variant + display name combination as the specified task
func (*Task) ResultStatus ¶
ResultStatus returns the status for this task that should be displayed in the UI. It uses a combination of the TaskEndDetails and the Task's status to determine the state of the task.
func (*Task) RevertBucketConfigToSource ¶
func (t *Task) RevertBucketConfigToSource(ctx context.Context, sourceBucketCfg evergreen.BucketConfig) error
RevertBucketConfigToSource updates the task's DB bucket config back to sourceBucketCfg.
func (*Task) RevertBucketConfigToSourceIfLogsExist ¶
func (t *Task) RevertBucketConfigToSourceIfLogsExist(ctx context.Context, sourceBucketCfg evergreen.BucketConfig) (bool, error)
RevertBucketConfigToSourceIfLogsExist checks whether the task's log files are still in sourceBucketCfg. If they are, it calls RevertBucketConfigToSource to set the bucket config back to the source bucket.
func (*Task) SatisfiesDependency ¶
SatisfiesDependency checks a task the receiver task depends on to see if its status satisfies a dependency. If the "Status" field is unset, default to checking that is succeeded.
func (*Task) SaveS3Usage ¶
func (t *Task) SaveS3Usage(ctx context.Context, logLookup, artifactLookup bucketExpirationLookup, logBucketName string) error
SaveS3Usage persists the task's S3 usage metrics and calculates S3 costs.
func (*Task) SetAborted ¶
SetAborted sets the abort field and abort info of task to aborted and prevents the task from being reset when finished.
func (*Task) SetCheckRunId ¶
SetCheckRunId sets the checkRunId for the task
func (*Task) SetDisplayTaskID ¶
func (*Task) SetGenerateTasksEstimationsFromMap ¶
func (t *Task) SetGenerateTasksEstimationsFromMap(estimations map[string]GenerateTasksEstimation)
SetGenerateTasksEstimationsFromMap applies generate.tasks estimation results to a task.
func (*Task) SetGeneratedJSON ¶
func (t *Task) SetGeneratedJSON(ctx context.Context, files GeneratedJSONFiles) error
SetGeneratedJSON sets JSON data to generate tasks from. If the generated JSON files have already been stored, this is a no-op.
func (*Task) SetGeneratedJSONStorageMethod ¶
func (t *Task) SetGeneratedJSONStorageMethod(ctx context.Context, method evergreen.ParserProjectStorageMethod) error
SetGeneratedJSONStorageMethod sets the task's generated JSON file storage method. If it's already been set, this is a no-op.
func (*Task) SetGeneratedTasksToActivate ¶
func (t *Task) SetGeneratedTasksToActivate(ctx context.Context, buildVariantName, taskName string) error
SetGeneratedTasksToActivate adds a task to stepback after activation
func (*Task) SetNumActivatedGeneratedTasks ¶
func (t *Task) SetNumActivatedGeneratedTasks(ctx context.Context, numActivatedGeneratedTasks int) error
SetNumActivatedGeneratedTasks sets the number of activated generated tasks to the given value.
func (*Task) SetNumGeneratedTasks ¶
SetNumGeneratedTasks sets the number of generated tasks to the given value.
func (*Task) SetOverrideDependencies ¶
func (*Task) SetPredictedCost ¶
SetPredictedCost sets the task's predicted cost.
func (*Task) SetResetFailedWhenFinished ¶
SetResetFailedWhenFinished requests that a display task only restarts failed tasks.
func (*Task) SetResetWhenFinished ¶
SetResetWhenFinished requests that a display task or single-host task group reset itself when finished. Will mark itself as system failed.
func (*Task) SetResetWhenFinishedWithInc ¶
SetResetWhenFinishedWithInc requests that a task (that was marked to automatically reset when finished via the agent status server) reset itself when finished. It will also increment the number of automatic resets the task has performed.
func (*Task) SetResultsInfo ¶
SetResultsInfo sets the task's test results info.
Note that if failedResults is false, ResultsFailed is not set. This is because in cases where multiple calls to attach test results are made for a task, only one call needs to have a test failure for the ResultsFailed field to be set to true.
func (*Task) SetSortingValueBreakdownAttributes ¶
func (t *Task) SetSortingValueBreakdownAttributes(ctx context.Context, breakdown SortingValueBreakdown)
SetSortingValueBreakdownAttributes saves a full breakdown which compartmentalizes each factor that played a role in computing the overall value used to sort it in the queue, and creates a honeycomb trace with this data to enable dashboards/analysis.
func (*Task) ToTaskNode ¶
func (*Task) UnmarshalBSON ¶
func (*Task) UpdateDependsOn ¶
UpdateDependsOn appends new dependencies to tasks that already depend on this task if the task does not explicitly omit having generated tasks as dependencies
func (*Task) UpdateHeartbeat ¶
UpdateHeartbeat updates the heartbeat to be the current time
func (*Task) UpdateTaskCost ¶
UpdateTaskCost computes EC2 and EBS costs from the task's runtime and distro pricing into t.TaskCost.
func (*Task) UsesLongRetentionBucket ¶
UsesLongRetentionBucket returns true if the task failed and is not in LongRetentionProjects.
type TaskLogGetOptions ¶
type TaskLogGetOptions struct {
// LogType is the type of task log to fetch. Must be a valid task log
// type.
LogType TaskLogType
// Start is the start time (inclusive) of the time range filter,
// represented as a Unix timestamp in nanoseconds. Defaults to
// unbounded.
Start *int64
// End is the end time (inclusive) of the time range filter,
// represented as a Unix timestamp in nanoseconds. Defaults to
// unbounded.
End *int64
// LineLimit limits the number of lines read from the log. Ignored if
// less than or equal to 0.
LineLimit int
// TailN is the number of lines to read from the tail of the log.
// Ignored if less than or equal to 0.
TailN int
}
TaskLogGetOptions represents the arguments for fetching task logs belonging to a task run.
type TaskLogOutput ¶
type TaskLogOutput struct {
Version int `bson:"version" json:"version"`
BucketConfig evergreen.BucketConfig `bson:"bucket_config" json:"bucket_config"`
AWSCredentials aws.CredentialsProvider `bson:"-" json:"-"`
}
TaskLogOutput is the versioned entry point for coordinating persistent storage of a task run's task log data.
func (TaskLogOutput) ID ¶
func (TaskLogOutput) ID() string
ID returns the unique identifier of the task log output type. Note that this is distinct from the task log output type subtype `task_log`.
type TaskLogType ¶
type TaskLogType string
TaskLogType represents the recognized types of task logs.
const ( TaskLogTypeAll TaskLogType = "all_logs" TaskLogTypeAgent TaskLogType = "agent_log" TaskLogTypeSystem TaskLogType = "system_log" TaskLogTypeTask TaskLogType = "task_log" )
func (TaskLogType) Validate ¶
func (t TaskLogType) Validate(writing bool) error
type TaskNode ¶
type TaskNode struct {
// Name is the display name of the task.
Name string
// Variant is the build variant of the task.
Variant string
// ID is the task's ID.
ID string
}
TaskNode is the representation of a task in the graph.
type TaskOutput ¶
type TaskOutput struct {
TaskLogs TaskLogOutput `bson:"task_logs,omitempty" json:"task_logs"`
TestLogs TestLogOutput `bson:"test_logs,omitempty" json:"test_logs"`
TestResults TestResultOutput `bson:"test_results,omitempty" json:"test_results"`
}
TaskOutput is the versioned entry point for coordinating persistent storage of a task run's output data.
func InitializeTaskOutput ¶
func InitializeTaskOutput(env evergreen.Environment, projectID string) *TaskOutput
InitializeTaskOutput initializes the task output for a new task run.
type TaskStats ¶
type TaskStats struct {
Counts []StatusCount `bson:"counts"`
ETA *time.Time `bson:"eta"`
}
type TaskStatusCount ¶
type TaskStatusCount struct {
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Started int `json:"started"`
Undispatched int `json:"undispatched"`
Inactive int `json:"inactive"`
Dispatched int `json:"dispatched"`
TimedOut int `json:"timed_out"`
}
TaskStatusCount holds counts for task statuses
func (*TaskStatusCount) IncrementStatus ¶
func (tsc *TaskStatusCount) IncrementStatus(status string, statusDetails apimodels.TaskEndDetail)
type Tasks ¶
type Tasks []*Task
type TasksSortOrder ¶
type TestLogGetOptions ¶
type TestLogGetOptions struct {
// LogPaths are the paths of the logs to fetch and merge, prefixes may
// be specified. At least one value must be specified.
LogPaths []string
// Start is the start time (inclusive) of the time range filter,
// represented as a Unix timestamp in nanoseconds. Defaults to the
// first timestamp of the first specified log.
Start *int64
// End is the end time (inclusive) of the time range filter,
// represented as a Unix timestamp in nanoseconds. Defaults to the last
// timestamp of the first specified log.
End *int64
// LineLimit limits the number of lines read from the log. Ignored if
// less than or equal to 0.
LineLimit int
// TailN is the number of lines to read from the tail of the log.
// Ignored if less than or equal to 0.
TailN int
}
TestLogGetOptions represents the arguments for fetching test logs belonging to a task run.
type TestLogOutput ¶
type TestLogOutput struct {
Version int `bson:"version" json:"version"`
BucketConfig evergreen.BucketConfig `bson:"bucket_config" json:"bucket_config"`
AWSCredentials aws.CredentialsProvider `bson:"-" json:"-"`
}
TestLogOutput is the versioned entry point for coordinating persistent storage of a task run's test log data.
func (TestLogOutput) ID ¶
func (TestLogOutput) ID() string
ID returns the unique identifier of the test log output type.
type TestResultOutput ¶
type TestResultOutput struct {
Version int `bson:"version" json:"version"`
BucketConfig evergreen.BucketConfig `bson:"bucket_config" json:"bucket_config"`
AWSCredentials aws.CredentialsProvider `bson:"-" json:"-"`
}
TestResultOutput is the versioned entry point for coordinating persistent storage of a task run's test result data.
func (TestResultOutput) DownloadParquet ¶
func (o TestResultOutput) DownloadParquet(ctx context.Context, credentials evergreen.S3Credentials, t *testresult.DbTaskTestResults) ([]testresult.TestResult, error)
DownloadParquet downloads test results in parquet format from s3.
func (TestResultOutput) GetBucket ¶
func (o TestResultOutput) GetBucket(ctx context.Context, credentials evergreen.S3Credentials) (pail.Bucket, error)
GetBucket constructs an s3 bucket to retrieve test results from.
type TestResultsService ¶
type TestResultsService interface {
AppendTestResultMetadata(context.Context, []string, int, int, testresult.DbTaskTestResults) error
Get(context.Context, []Task, GetTaskTestResultsOptions) ([]testresult.TaskTestResults, error)
GetTaskTestResultsStats(context.Context, []Task) (testresult.TaskTestResultsStats, error)
}
TestResultsService is an interface for fetching test results data from an underlying test results store.
Source Files
¶
- db.go
- dependency_graph.go
- doc.go
- evergreen_sender.go
- expected_duration.go
- generate_tasks_estimations.go
- generated_json_db.go
- generated_json_s3.go
- generated_json_storage.go
- local_test_result_service.go
- otel.go
- results.go
- service_interface.go
- sorter.go
- task.go
- task_annotations.go
- task_log.go
- task_output.go
- test_log.go
- test_result.go
- test_result_service.go
- util.go