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(buildId string, reason AbortInfo) error
- func AbortVersionTasks(versionId string, reason AbortInfo) error
- func ActivateTasks(tasks []Task, activationTime time.Time, updateDependencies bool, caller string) error
- func ActivateTasksByIdsWithDependencies(ids []string, caller string) error
- func AddDisplayTaskIdToExecTasks(displayTaskId string, execTasksToUpdate []string) error
- func AddExecTasksToDisplayTask(displayTaskId string, execTasks []string, displayTaskActivated bool) error
- func AddGeneratedStepbackInfoForGenerator(taskId string, s StepbackInfo) error
- func AddHostCreateDetails(taskId, hostId string, execution int, hostCreateError error) error
- func AddIssueToAnnotation(taskId string, execution int, issue annotations.IssueLink, username string) error
- func Aggregate(pipeline []bson.M, results interface{}) error
- func AnyActiveTasks(tasks []Task) bool
- func ArchiveMany(ctx context.Context, tasks []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 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 ByDifferentFailedBuildVariants(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 ByStatuses(statuses []string, buildVariant, displayName, project, requester string) 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 ByVersionsForNameAndVariant(versions, displayNames []string, buildVariant string) bson.M
- func ByVersionsWithChildTasks(versionIDs []string) bson.M
- func CheckUsersPatchTaskLimit(requester, username string, includeDisplayAndTaskGroups bool, tasks ...Task) error
- func Count(query db.Q) (int, error)
- func CountActivatedTasksForVersion(versionId string) (int, error)
- func CountLargeParserProjectTasks() (int, error)
- func CountNumExecutionsForInterval(input NumExecutionsForIntervalInput) (int, error)
- func DeactivateDependencies(tasks []string, caller string) error
- func DeactivateStepbackTask(projectId, buildVariantName, taskName, caller string) error
- func DeactivateTasks(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(buildId string) ([]string, error)
- func FindAllTaskIDsFromVersion(versionId string) ([]string, error)
- func FindExecTasksToReset(t *Task) ([]string, error)
- func FindProjectForTask(taskID string) (string, error)
- func FindTaskNamesByBuildVariant(projectId string, buildVariant string, repoOrderNumber int) ([]string, error)
- func FindVariantsWithTask(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 GetBaseStatusesForActivatedTasks(ctx context.Context, versionID string, baseVersionID string) ([]string, error)
- func GetFormattedTimeSpent(tasks []Task) (string, string)
- func GetLatestExecution(taskId string) (int, error)
- func GetPendingGenerateTasks(ctx context.Context) (int, 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(taskId string) (bool, error)
- func HasMatchingTasks(ctx context.Context, versionID string, opts HasMatchingTasksOptions) (bool, error)
- func HasUnfinishedTaskForVersions(versionIds []string, taskName, variantName string) (bool, error)
- func MakeOldID(taskID string, execution int) string
- func MarkGeneratedTasks(taskID string) error
- func MarkGeneratedTasksErr(taskID string, errorToSet error) error
- func MarkTasksAsContainerDeallocated(taskIDs []string) error
- func MoveIssueToSuspectedIssue(taskId string, taskExecution int, issue annotations.IssueLink, username string) error
- func MoveSuspectedIssueToIssue(taskId string, taskExecution int, issue annotations.IssueLink, username string) error
- func NonExecutionTasksByVersions(versions []string) bson.M
- func PatchAnnotation(a *annotations.TaskAnnotation, userDisplayName string, upsert bool) error
- func PotentiallyBlockedTasksByIds(taskIds []string) bson.M
- func Remove(id string) error
- func RemoveIssueFromAnnotation(taskId string, execution int, issue annotations.IssueLink) error
- func ResetTasks(tasks []Task, caller string) error
- func ScheduledContainerTasksQuery() bson.M
- func SetGeneratedStepbackInfoForGenerator(ctx context.Context, taskId string, s StepbackInfo) error
- func SetHasAnnotations(taskId string, execution int) error
- func SetLastAndPreviousStepbackIds(taskId string, s StepbackInfo) error
- func SetNextStepbackId(taskId string, s StepbackInfo) error
- func SetTasksScheduledTime(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 UndispatchedContainerTasksQuery() bson.M
- func UnsetHasAnnotations(taskId string, execution int) error
- func UpdateAll(query interface{}, update interface{}) (*adb.ChangeInfo, error)
- func UpdateAllWithHint(ctx context.Context, query interface{}, update interface{}, hint interface{}) (*adb.ChangeInfo, error)
- func UpdateOne(query interface{}, update interface{}) error
- func UpdateOneContext(ctx context.Context, query interface{}, update interface{}) error
- func UpdateSchedulingLimit(username, requester string, numTasksModified int, activated bool) error
- func UpsertAnnotation(a *annotations.TaskAnnotation, userDisplayName string) error
- type AbortInfo
- type BaseTaskInfo
- type BuildVariantTuple
- type ByPriority
- type ContainerOptions
- 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 DisplayTaskCache
- type ExecutionPlatform
- type GeneratedJSONFileStorage
- type GeneratedJSONFiles
- type GeneratedTaskInfo
- type GetTasksByProjectAndCommitOptions
- type GetTasksByVersionOptions
- type GroupedTaskStatusCount
- type HasMatchingTasksOptions
- type HostCreateDetail
- type NumExecutionsForIntervalInput
- type ResultCounts
- type Stat
- type StatusCount
- type StatusItem
- type StepbackInfo
- type SyncAtEndOptions
- type Task
- func AddParentDisplayTasks(tasks []Task) ([]Task, error)
- func ByBeforeMidwayTaskFromIds(t1Id, t2Id string) (*Task, error)
- func FilterTasksOnStatus(tasks []Task, statuses ...string) []Task
- func Find(filter bson.M) ([]Task, error)
- func FindActivatedByVersionWithoutDisplay(versionId string) ([]Task, error)
- func FindActivatedStepbackTaskByName(projectId string, variantName string, taskName string) (*Task, error)
- func FindAll(query db.Q) ([]Task, error)
- func FindAllDependencyTasksToModify(tasks []Task, isBlocking, ignoreDependencyStatusForBlocking bool) ([]Task, error)
- func FindAllFirstExecution(query db.Q) ([]Task, error)
- func FindAllOld(query db.Q) ([]Task, error)
- func FindAllTasksFromVersionWithDependencies(versionId string) ([]Task, error)
- func FindByExecutionTasksAndMaxExecution(taskIds []string, execution int, filters ...bson.E) ([]Task, error)
- func FindByIdExecution(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 FindMergeTaskForVersion(versionId string) (*Task, error)
- func FindNeedsContainerAllocation() ([]Task, error)
- func FindOld(filter bson.M) ([]Task, error)
- func FindOldWithDisplayTasks(filter bson.M) ([]Task, error)
- func FindOne(query db.Q) (*Task, error)
- func FindOneId(id string) (*Task, error)
- func FindOneIdAndExecution(id string, execution int) (*Task, error)
- func FindOneIdAndExecutionWithDisplayStatus(id string, execution *int) (*Task, error)
- func FindOneIdOldOrNew(id string, execution int) (*Task, error)
- func FindOneIdWithFields(id string, projected ...string) (*Task, error)
- func FindOneOld(filter bson.M) (*Task, error)
- func FindOneOldByIdAndExecution(id string, execution int) (*Task, error)
- func FindOneOldByIdAndExecutionWithDisplayStatus(id string, execution *int) (*Task, error)
- func FindOneOldId(id string) (*Task, error)
- func FindOneOldWithFields(filter bson.M, fields ...string) (*Task, error)
- func FindStuckDispatching() ([]Task, error)
- func FindTaskForVersion(versionId, taskName, variantName string) (*Task, error)
- func FindTaskGroupFromBuild(buildId, taskGroup string) ([]Task, error)
- func FindTasksFromVersions(versionIds []string) ([]Task, error)
- func FindWithFields(filter bson.M, fields ...string) ([]Task, error)
- func FindWithSort(filter bson.M, sort []string) ([]Task, error)
- func GenerateNotRun() ([]Task, error)
- func GetLatestTaskFromImage(ctx context.Context, imageID string) (*Task, error)
- func GetRecentTasks(period time.Duration) ([]Task, error)
- func GetRecursiveDependenciesUp(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(cache map[string]Task) (bool, error)
- func (t *Task) Archive(ctx context.Context) error
- func (t *Task) Blocked() bool
- func (t *Task) BlockedState(dependencies map[string]*Task) (string, error)
- func (t *Task) CircularDependencies() error
- func (t *Task) CountSimilarFailingTasks() (int, error)
- func (t *Task) CreateTestResultsTaskOptions() ([]testresult.TaskOptions, error)
- func (t *Task) DependenciesMet(depCaches map[string]Task) (bool, error)
- func (t *Task) FetchExpectedDuration() util.DurationStats
- func (t *Task) FindAbortingAndResettingDependencies() ([]Task, error)
- func (t *Task) FindTaskOnBaseCommit() (*Task, error)
- func (t *Task) FindTaskOnPreviousCommit() (*Task, error)
- func (t *Task) GetDeactivatedBlockingDependencies(depCache map[string]Task) ([]string, error)
- func (t *Task) GetDisplayStatus() string
- func (t *Task) GetDisplayTask() (*Task, error)
- func (t *Task) GetFailedTestSample(ctx context.Context, env evergreen.Environment) ([]string, error)
- func (t *Task) GetFinishedBlockingDependencies(depCache map[string]Task) ([]Task, error)
- func (t *Task) GetJQL(searchProjects []string) string
- func (t *Task) GetTaskGroupString() string
- func (t *Task) GetTaskLogs(ctx context.Context, getOpts taskoutput.TaskLogGetOptions) (log.LogIterator, error)
- func (t *Task) GetTaskOutputWithError() (*taskoutput.TaskOutput, error)
- func (t *Task) GetTestLogs(ctx context.Context, getOpts taskoutput.TestLogGetOptions) (log.LogIterator, error)
- func (t *Task) GetTestResults(ctx context.Context, env evergreen.Environment, ...) (testresult.TaskTestResults, error)
- func (t *Task) GetTestResultsStats(ctx context.Context, env evergreen.Environment) (testresult.TaskTestResultsStats, error)
- func (t *Task) HasCheckRun() bool
- func (t *Task) HasDependenciesMet() bool
- func (t *Task) HasResults() bool
- func (t *Task) IncNumNextTaskDispatches() error
- func (t *Task) Insert() error
- func (t *Task) IsAbortable() bool
- func (t *Task) IsContainerDispatchable() bool
- func (t *Task) IsContainerTask() bool
- func (t *Task) IsDispatchable() 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() 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) MarkAsContainerAllocated(ctx context.Context, env evergreen.Environment) error
- func (t *Task) MarkAsContainerDeallocated(ctx context.Context, env evergreen.Environment) error
- func (t *Task) MarkAsContainerDispatched(ctx context.Context, env evergreen.Environment, podID, agentVersion string) error
- func (t *Task) MarkAsHostDispatched(hostID, distroID, agentRevision string, dispatchTime time.Time) error
- func (t *Task) MarkAsHostDispatchedWithContext(ctx context.Context, env evergreen.Environment, ...) error
- func (t *Task) MarkAsHostUndispatchedWithContext(ctx context.Context, env evergreen.Environment) error
- func (t *Task) MarkDependenciesFinished(ctx context.Context, finished bool) error
- func (t *Task) MarkEnd(finishTime time.Time, detail *apimodels.TaskEndDetail) error
- func (t *Task) MarkFailed() error
- func (t *Task) MarkStart(startTime time.Time) error
- func (t *Task) MarkSystemFailed(description string) error
- func (t *Task) MarkUnscheduled() error
- func (t *Task) MarshalBSON() ([]byte, error)
- func (t *Task) PopulateTestResults() error
- func (t *Task) PreviousCompletedTask(project string, statuses []string) (*Task, error)
- func (t *Task) RemainingContainerAllocationAttempts() int
- func (t *Task) RemoveDependency(dependencyId string) error
- func (t *Task) Reset(ctx context.Context, caller string) error
- func (t *Task) ResultStatus() string
- func (t *Task) S3Path(bv, name string) string
- func (t *Task) SatisfiesDependency(depTask *Task) bool
- func (t *Task) SetAborted(reason AbortInfo) error
- func (t *Task) SetCheckRunId(checkRunId int64) error
- func (t *Task) SetDisplayTaskID(id string) error
- func (t *Task) SetGenerateTasksEstimations(ctx context.Context) error
- func (t *Task) SetGeneratedJSON(files GeneratedJSONFiles) error
- func (t *Task) SetGeneratedJSONStorageMethod(method evergreen.ParserProjectStorageMethod) error
- func (t *Task) SetGeneratedTasksToActivate(buildVariantName, taskName string) error
- func (t *Task) SetNumActivatedGeneratedTasks(numActivatedGeneratedTasks int) error
- func (t *Task) SetNumDependents() error
- func (t *Task) SetNumGeneratedTasks(numGeneratedTasks int) error
- func (t *Task) SetOverrideDependencies(userID string) error
- func (t *Task) SetResetFailedWhenFinished(caller string) error
- func (t *Task) SetResetWhenFinished(caller string) error
- func (t *Task) SetResetWhenFinishedWithInc() error
- func (t *Task) SetResultsInfo(service string, failedResults bool) error
- func (t *Task) SetTaskGroupInfo() error
- func (t *Task) ShouldAllocateContainer() bool
- func (t *Task) String() (taskStruct string)
- func (t *Task) ToTaskNode() TaskNode
- func (t *Task) UnmarshalBSON(in []byte) error
- func (t *Task) UpdateDependsOn(status string, newDependencyIDs []string) error
- func (t *Task) UpdateHeartbeat() error
- func (t *Task) WillRun() bool
- type TaskNode
- type TaskStats
- type TaskStatusCount
- type Tasks
- type TasksSortOrder
Constants ¶
const ( Collection = "tasks" OldCollection = "old_tasks" )
const ( // UnschedulableThreshold is the threshold after which a task waiting to // dispatch should be unscheduled due to staleness. UnschedulableThreshold = 7 * 24 * time.Hour )
const VersionLimit = 50
Variables ¶
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") ContainerAllocatedTimeKey = bsonutil.MustHaveTag(Task{}, "ContainerAllocatedTime") 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") ContainerAllocatedKey = bsonutil.MustHaveTag(Task{}, "ContainerAllocated") ContainerAllocationAttemptsKey = bsonutil.MustHaveTag(Task{}, "ContainerAllocationAttempts") 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") NumDepsKey = bsonutil.MustHaveTag(Task{}, "NumDependents") DisplayNameKey = bsonutil.MustHaveTag(Task{}, "DisplayName") ExecutionPlatformKey = bsonutil.MustHaveTag(Task{}, "ExecutionPlatform") HostIdKey = bsonutil.MustHaveTag(Task{}, "HostId") PodIDKey = bsonutil.MustHaveTag(Task{}, "PodID") 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") 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") HasCedarResultsKey = bsonutil.MustHaveTag(Task{}, "HasCedarResults") ResultsFailedKey = bsonutil.MustHaveTag(Task{}, "ResultsFailed") 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") EstimatedNumActivatedGeneratedTasksKey = bsonutil.MustHaveTag(Task{}, "EstimatedNumActivatedGeneratedTasks") ResetWhenFinishedKey = bsonutil.MustHaveTag(Task{}, "ResetWhenFinished") ResetFailedWhenFinishedKey = bsonutil.MustHaveTag(Task{}, "ResetFailedWhenFinished") NumAutomaticRestartsKey = bsonutil.MustHaveTag(Task{}, "NumAutomaticRestarts") IsAutomaticRestartKey = bsonutil.MustHaveTag(Task{}, "IsAutomaticRestart") CommitQueueMergeKey = bsonutil.MustHaveTag(Task{}, "CommitQueueMerge") DisplayStatusKey = bsonutil.MustHaveTag(Task{}, "DisplayStatus") 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") )
var ( // BSON fields for task dependency struct DependencyTaskIdKey = bsonutil.MustHaveTag(Dependency{}, "TaskId") DependencyStatusKey = bsonutil.MustHaveTag(Dependency{}, "Status") DependencyUnattainableKey = bsonutil.MustHaveTag(Dependency{}, "Unattainable") DependencyFinishedKey = bsonutil.MustHaveTag(Dependency{}, "Finished") 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": []interface{}{"$" + HasAnnotationsKey, true}, }, "then": evergreen.TaskKnownIssue, }, { "case": bson.M{ "$eq": []interface{}{"$" + 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": []interface{}{"$" + 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": []interface{}{"$" + 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": []interface{}{"$" + bsonutil.GetDottedKeyName(DetailsKey, TaskEndDetailTimedOut), true}, }, "then": evergreen.TaskTimedOut, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []interface{}{"$" + ActivatedKey, false}}, {"$eq": []string{"$" + StatusKey, evergreen.TaskUndispatched}}, }, }, "then": evergreen.TaskUnscheduled, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []string{"$" + StatusKey, evergreen.TaskUndispatched}}, {"$ne": []interface{}{"$" + OverrideDependenciesKey, true}}, isUnattainable, }, }, "then": evergreen.TaskStatusBlocked, }, { "case": bson.M{ "$and": []bson.M{ {"$eq": []string{"$" + StatusKey, evergreen.TaskUndispatched}}, {"$eq": []interface{}{"$" + ActivatedKey, true}}, }, }, "then": evergreen.TaskWillRun, }, }, "default": "$" + StatusKey, }, } )
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}, } )
var All = db.Query(nil)
All returns all tasks.
var (
AllStatuses = "*"
)
var BaseTaskStatusKey = bsonutil.GetDottedKeyName(BaseTaskKey, StatusKey)
var DurationIndex = 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 ( IsDispatchedOrStarted = bson.M{ StatusKey: bson.M{"$in": []string{evergreen.TaskStarted, evergreen.TaskDispatched}}, } )
var StatusFields = []string{ BuildIdKey, DisplayNameKey, StatusKey, DetailsKey, StartTimeKey, TimeTakenKey, ActivatedKey, DependsOnKey, }
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(tasks []Task, activationTime time.Time, updateDependencies bool, caller string) error
ActivateTasks sets all given tasks to active, logs them as activated, and proceeds to activate any dependencies that were deactivated.
func ActivateTasksByIdsWithDependencies ¶
ActivateTasksByIdsWithDependencies activates the given tasks and their dependencies.
func AddGeneratedStepbackInfoForGenerator ¶
func AddGeneratedStepbackInfoForGenerator(taskId string, s StepbackInfo) error
AddGeneratedStepbackInfoForGenerator appends a new StepbackInfo to the task's GeneratedStepbackInfo.
func AddHostCreateDetails ¶
func AddIssueToAnnotation ¶
func AddIssueToAnnotation(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 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 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 ByDifferentFailedBuildVariants ¶
func ByDifferentFailedBuildVariants(revision, buildVariant, displayName, project, requester string) bson.M
ByDifferentFailedBuildVariants returns a query for all failed tasks on a revision that are not of a buildVariant
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 ByStatuses ¶
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 CheckUsersPatchTaskLimit ¶
func CheckUsersPatchTaskLimit(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 CountLargeParserProjectTasks ¶
CountLargeParserProjectTasks counts the number of tasks running with parser projects stored in s3.
func CountNumExecutionsForInterval ¶
func CountNumExecutionsForInterval(input NumExecutionsForIntervalInput) (int, error)
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 ¶
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(projectId string, buildVariant string, repoOrderNumber int) ([]string, error)
FindTaskNamesByBuildVariant returns a list of unique task names for a given build variant
func FindVariantsWithTask ¶
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 GetBaseStatusesForActivatedTasks ¶
func GetBaseStatusesForActivatedTasks(ctx context.Context, versionID string, baseVersionID string) ([]string, error)
GetBaseStatusesForActivatedTasks returns the base statuses for activated tasks on a version.
func GetFormattedTimeSpent ¶
GetFormattedTimeSpent returns the total time_taken and makespan of tasks as a formatted string
func GetLatestExecution ¶
func GetPendingGenerateTasks ¶
GetPendingGenerateTasks returns an estimated number of tasks the current dispatched tasks will generate.
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 HasUnfinishedTaskForVersions ¶
HasUnfinishedTaskForVersions returns true if there are any scheduled but unfinished tasks matching the given conditions.
func MarkGeneratedTasks ¶
MarkGeneratedTasks marks that the task has generated tasks.
func MarkGeneratedTasksErr ¶
MarkGeneratedTasksErr marks that the task hit errors generating tasks.
func MarkTasksAsContainerDeallocated ¶
MarkTasksAsContainerDeallocated marks multiple container tasks as no longer allocated containers.
func MoveIssueToSuspectedIssue ¶
func MoveIssueToSuspectedIssue(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(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 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(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(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 ScheduledContainerTasksQuery ¶
ScheduledContainerTasksQuery returns a query indicating if the container is in a state where it is scheduled to run and is logically equivalent to (Task).isContainerScheduled. This encompasses two potential states:
- A container is not yet allocated to the task but it's ready to be allocated one. Note that this is a subset of all tasks that could eventually run (i.e. evergreen.TaskWillRun from (Task).GetDisplayStatus), because a container task is not scheduled until all of its dependencies have been met.
- The container is allocated but the agent has not picked up the task yet.
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 SetHasAnnotations ¶
SetHasAnnotations sets a task's HasAnnotations flag, indicating that there are annotations with populated IssuesKey for its id / execution pair.
func SetLastAndPreviousStepbackIds ¶
func SetLastAndPreviousStepbackIds(taskId string, s StepbackInfo) error
SetLastAndPreviousStepbackIds sets the LastFailingStepbackTaskId, LastPassingStepbackTaskId, and PreviousStepbackTaskId for a given task id.
func SetNextStepbackId ¶
func SetNextStepbackId(taskId string, s StepbackInfo) error
SetNextStepbackId sets the NextStepbackTaskId for a given task id.
func SetTasksScheduledTime ¶
SetTasksScheduledTime takes a list of tasks and a time, and then sets the scheduled time in the database for the tasks if it is currently 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 UndispatchedContainerTasksQuery ¶
UndispatchedContainerTasksQuery returns a query retrieving all undispatched container tasks.
func UnsetHasAnnotations ¶
UnsetHasAnnotations unsets a task's HasAnnotations flag, indicating that there are no longer any annotations with populated IssuesKey for its id / execution pair.
func UpdateAll ¶
func UpdateAll(query interface{}, update interface{}) (*adb.ChangeInfo, error)
func UpdateAllWithHint ¶
func UpdateAllWithHint(ctx context.Context, query interface{}, update interface{}, hint interface{}) (*adb.ChangeInfo, error)
func UpdateOne ¶
func UpdateOne(query interface{}, update interface{}) error
UpdateOne updates one task.
func UpdateOneContext ¶
func UpdateSchedulingLimit ¶
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(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(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 ContainerOptions ¶
type ContainerOptions struct { CPU int `bson:"cpu,omitempty" json:"cpu"` MemoryMB int `bson:"memory_mb,omitempty" json:"memory_mb"` WorkingDir string `bson:"working_dir,omitempty" json:"working_dir"` Image string `bson:"image,omitempty" json:"image"` // RepoCredsName is the name of the project container secret containing the // repository credentials. RepoCredsName string `bson:"repo_creds_name,omitempty" json:"repo_creds_name"` OS evergreen.ContainerOS `bson:"os,omitempty" json:"os"` Arch evergreen.ContainerArch `bson:"arch,omitempty" json:"arch"` WindowsVersion evergreen.WindowsVersion `bson:"windows_version,omitempty" json:"windows_version"` }
ContainerOptions represent options to create the container to run a task.
func (ContainerOptions) IsZero ¶
func (o ContainerOptions) IsZero() bool
IsZero implements the bsoncodec.Zeroer interface for the sake of defining the zero value for BSON marshalling.
type Dependency ¶
type Dependency struct { TaskId string `bson:"_id" json:"id"` Status string `bson:"status" json:"status"` Unattainable bool `bson:"unattainable" json:"unattainable"` // Finished indicates if the task's dependency has finished running or not. Finished bool `bson:"finished" json:"finished"` // 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(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(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 DisplayTaskCache ¶
type DisplayTaskCache struct {
// contains filtered or unexported fields
}
func NewDisplayTaskCache ¶
func NewDisplayTaskCache() DisplayTaskCache
func (*DisplayTaskCache) List ¶
func (c *DisplayTaskCache) List() []*Task
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 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(generatorID string) ([]GeneratedTaskInfo, error)
FindGeneratedTasksFromID finds all tasks that were generated by the given generator task and returns the filtered information.
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 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,omitempty"` // 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() interface{}
func (*ResultCounts) String ¶
func (c *ResultCounts) String() string
type StatusCount ¶
type StatusItem ¶
func GetRecentTaskStats ¶
func GetRecentTaskStats(period time.Duration, nameKey string) ([]StatusItem, error)
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 SyncAtEndOptions ¶
type Task ¶
type Task struct { Id string `bson:"_id" json:"id"` Secret string `bson:"secret" json:"secret"` // time information for task // CreateTime - the creation time for the task, derived from the commit time or the patch creation time. // 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. // ContainerAllocated - for tasks that run on containers, the time the container was allocated. 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"` ContainerAllocatedTime time.Time `bson:"container_allocated_time,omitempty" json:"container_allocated_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"` // PriorityRankValue is not persisted to the db, but stored in memory and passed to the task queue document. // It is a mixture of Priority and the various task queue ranking factors that multiply on top of Priority. PriorityRankValue int64 `bson:"priority_rank_value" json:"priority_rank_value"` 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"` HasCedarResults bool `bson:"has_cedar_results,omitempty" json:"has_cedar_results,omitempty"` ResultsFailed bool `bson:"results_failed,omitempty" json:"results_failed,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"` // ContainerAllocated indicates whether this task has been allocated a // container to run it. It only applies to tasks running in containers. ContainerAllocated bool `bson:"container_allocated" json:"container_allocated"` // ContainerAllocationAttempts is the number of times this task has // been allocated a container to run it (for a single execution). ContainerAllocationAttempts int `bson:"container_allocation_attempts" json:"container_allocation_attempts"` BuildId string `bson:"build_id" json:"build_id"` DistroId string `bson:"distro" json:"distro"` // Container is the name of the container configuration for running a // container task. Container string `bson:"container,omitempty" json:"container,omitempty"` // ContainerOpts contains the options to configure the container that will // run the task. ContainerOpts ContainerOptions `bson:"container_options,omitempty" json:"container_options,omitempty"` 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"` // PodID is the pod that was assigned to run the task. This value is only // set for container tasks. PodID string `bson:"pod_id,omitempty" json:"pod_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.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"` // 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"` // 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"` CommitQueueMerge bool `bson:"commit_queue_merge,omitempty" json:"commit_queue_merge,omitempty"` CanSync bool `bson:"can_sync" json:"can_sync"` SyncAtEndOpts SyncAtEndOptions `bson:"sync_at_end_opts,omitempty" json:"sync_at_end_opts,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"` }
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(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(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 FindAllOld ¶
Find returns really all tasks that satisfy the query.
func FindAllTasksFromVersionWithDependencies ¶
FindAllTasksFromVersionWithDependencies finds all tasks in a version and includes only their dependencies.
func FindByExecutionTasksAndMaxExecution ¶
func FindByExecutionTasksAndMaxExecution(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 FindMergeTaskForVersion ¶
func FindNeedsContainerAllocation ¶
FindNeedsContainerAllocation returns all container tasks that are waiting for a container to be allocated to them sorted by activation time.
func FindOld ¶
FindOld returns all non-display tasks from the old tasks collection that satisfy the given query.
func FindOldWithDisplayTasks ¶
FindOldWithDisplayTasks returns all display and execution tasks from the old collection that satisfy the given query.
func FindOneIdAndExecution ¶
FindOneIdAndExecution returns a single task with the given ID and execution.
func FindOneIdAndExecutionWithDisplayStatus ¶
FindOneIdAndExecutionWithDisplayStatus returns a single task with the given ID and execution, with display statuses added.
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 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 FindOneOldByIdAndExecutionWithDisplayStatus ¶
FindOneOldByIdAndExecutionWithDisplayStatus returns a single task with the given ID and execution from the old tasks collection, with display statuses added.
func FindOneOldId ¶
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 FindTaskForVersion ¶
FindTaskForVersion returns a task matching the given version and task info.
func FindTaskGroupFromBuild ¶
func FindTasksFromVersions ¶
FindTasksFromVersions returns all tasks associated with the given versions. Note that this only returns a few key fields.
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 ¶
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 unscheduable 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) BlockedState ¶
func (*Task) CircularDependencies ¶
CircularDependencies detects if any tasks in this version are part of a dependency cycle Note that it does not check inter-version dependencies, because only evergreen can add those
func (*Task) CountSimilarFailingTasks ¶
CountSimilarFailingTasks returns a count of all tasks with the same project, same display name, and in other buildvariants, that have failed in the same revision
func (*Task) CreateTestResultsTaskOptions ¶
func (t *Task) CreateTestResultsTaskOptions() ([]testresult.TaskOptions, error)
CreateTestResultsTaskOptions 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) 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) FetchExpectedDuration ¶
func (t *Task) FetchExpectedDuration() 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 ¶
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) GetDisplayStatus ¶
GetDisplayStatus finds and sets DisplayStatus to the task. It should reflect the statuses assigned during the addDisplayStatus aggregation step.
func (*Task) GetDisplayTask ¶
func (*Task) GetFailedTestSample ¶
func (t *Task) GetFailedTestSample(ctx context.Context, env evergreen.Environment) ([]string, error)
GetTestResultsStats returns a sample of test names (up to 10) that failed in the task. If the task does not have any results or does not have any failing tests, a nil slice is returned.
func (*Task) GetFinishedBlockingDependencies ¶
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) GetTaskGroupString ¶
func (*Task) GetTaskLogs ¶
func (t *Task) GetTaskLogs(ctx context.Context, getOpts taskoutput.TaskLogGetOptions) (log.LogIterator, error)
GetTaskLogs returns the task's task logs with the given options.
func (*Task) GetTaskOutputWithError ¶
func (t *Task) GetTaskOutputWithError() (*taskoutput.TaskOutput, error)
GetTaskOutputInfoWithError is a convenience function to avoid panics when accessing the task output data.
func (*Task) GetTestLogs ¶
func (t *Task) GetTestLogs(ctx context.Context, getOpts taskoutput.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 *testresult.FilterOptions) (testresult.TaskTestResults, error)
GetTestResults returns the task's test results filtered, sorted, and paginated as specified by the optional filter options.
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) HasCheckRun ¶
HasCheckRun retruns true if the task specifies a check run path.
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) 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) IsContainerDispatchable ¶
IsContainerDispatchable returns true if the task should run in a container and can be dispatched.
func (*Task) IsContainerTask ¶
IsContainerTask returns true if it's a task that runs on containers.
func (*Task) IsDispatchable ¶
IsDispatchable returns true if the task should make progress towards dispatching to run.
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) IsPartOfDisplay ¶
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) MarkAsContainerAllocated ¶
MarkAsContainerAllocated marks a container task as allocated a container. This will fail if the task is not in a state where it needs a container to be allocated to it.
func (*Task) MarkAsContainerDeallocated ¶
MarkAsContainerDeallocated marks a container task that was allocated as no longer allocated a container.
func (*Task) MarkAsContainerDispatched ¶
func (t *Task) MarkAsContainerDispatched(ctx context.Context, env evergreen.Environment, podID, agentVersion string) error
MarkAsContainerDispatched marks that the container task has been dispatched to a pod.
func (*Task) MarkAsHostDispatched ¶
func (t *Task) MarkAsHostDispatched(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) MarkAsHostDispatchedWithContext ¶
func (t *Task) MarkAsHostDispatchedWithContext(ctx context.Context, env evergreen.Environment, hostID, distroID, agentRevision string, dispatchTime time.Time) error
MarkAsHostDispatchedWithContext marks that the task has been dispatched onto a particular host. Unlike MarkAsHostDispatched, this does not update the parent display task.
func (*Task) MarkAsHostUndispatchedWithContext ¶
func (t *Task) MarkAsHostUndispatchedWithContext(ctx context.Context, env evergreen.Environment) error
MarkAsHostUndispatchedWithContext 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 MarkAsHostDispatchedWithContext.
func (*Task) MarkDependenciesFinished ¶
MarkDependenciesFinished updates all direct dependencies on this task to cache whether or not this task has finished running.
func (*Task) MarkEnd ¶
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) 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 ¶
Find the previously completed task for the same project + build variant + display name combination as the specified task
func (*Task) RemainingContainerAllocationAttempts ¶
RemainingContainerAllocationAttempts returns the number of times this task execution is allowed to try allocating a container.
func (*Task) RemoveDependency ¶
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) 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) 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) SetGenerateTasksEstimations ¶
SetGenerateTasksEstimations calculates and caches the estimated number of tasks that this task will generate. To be called only in task creation.
func (*Task) SetGeneratedJSON ¶
func (t *Task) SetGeneratedJSON(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(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 ¶
SetGeneratedTasksToActivate adds a task to stepback after activation
func (*Task) SetNumActivatedGeneratedTasks ¶
SetNumActivatedGeneratedTasks sets the number of activated generated tasks to the given value.
func (*Task) SetNumDependents ¶
func (*Task) SetNumGeneratedTasks ¶
SetNumGeneratedTasks sets the number of generated tasks to the given value.
func (*Task) SetOverrideDependencies ¶
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) SetTaskGroupInfo ¶
func (*Task) ShouldAllocateContainer ¶
ShouldAllocateContainer indicates whether a task should be allocated a container or not.
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
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 TaskStats ¶
type TaskStats struct { Counts []StatusCount `bson:"counts"` ETA *time.Time `bson:"eta"` }
func GetTaskStatsByVersion ¶
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)