Documentation ¶
Index ¶
- Constants
- Variables
- func AddAndTriggerTask(ctx context.Context, task AddTaskVars) error
- func AddHandlers(externalRouter chi.Router)
- func AddTaskHandler(w http.ResponseWriter, r *http.Request, task AddTaskVars)
- func DatastoreTaskQuery(ctx context.Context, prototype Task, params QueryParams) *datastore.Iterator
- func DeleteTaskHandler(prototype Task, w http.ResponseWriter, r *http.Request)
- func EditTaskHandler(prototype Task, w http.ResponseWriter, r *http.Request)
- func GetEmailRecipients(runOwner string, ccList []string) []string
- func GetFailureEmailRecipients(runOwner string, ccList []string) []string
- func GetNextId(ctx context.Context, kind ds.Kind, task Task) (int64, error)
- func GetRunID(task Task) string
- func GetTasksHandler(prototype Task, w http.ResponseWriter, r *http.Request)
- func Init(ctx context.Context, local, enableAutoscaler bool, ...) error
- func RedoTaskHandler(prototype Task, w http.ResponseWriter, r *http.Request)
- func SetLogin(p alogin.Login)
- func TriggerTaskOnSwarming(ctx context.Context, task AddTaskVars, datastoreTask Task) error
- func UpdateTaskSetCompleted(ctx context.Context, task Task, success bool) error
- func UpdateTaskSetStarted(ctx context.Context, runID, swarmingTaskID string, task Task) error
- type AddTaskCommonVars
- type AddTaskVars
- type BenchmarksPlatformsResponse
- type ByPageSetDesc
- type CLDataResponse
- type ClusterTelemetryIDs
- type CommonCols
- type DeleteTaskRequest
- type EditTaskRequest
- type GetTasksResponse
- type PageSet
- type Permissions
- type QueryParams
- type RedoTaskRequest
- type Task
- type TaskPrioritiesResponse
Constants ¶
View Source
const ( // Default page size used for pagination. DEFAULT_PAGE_SIZE = 10 // Maximum page size used for pagination. MAX_PAGE_SIZE = 100 CANCEL_SWARMING_TASKS_WORKER_POOL_SIZE = 100 )
Variables ¶
View Source
var ( // The location of the service account JSON file. ServiceAccountFile string // Will be used to construct task specific URLs in emails. Will have a trailing "/". WebappURL string )
Functions ¶
func AddAndTriggerTask ¶
func AddAndTriggerTask(ctx context.Context, task AddTaskVars) error
AddAndTriggerTask adds the task to datastore and then triggers swarming tasks. The swarming tasks are triggered in a separate goroutine because if it is a GCE task then it can take a min or 2 to autoscale the GCE instances.
func AddHandlers ¶
func AddHandlers(externalRouter chi.Router)
func AddTaskHandler ¶
func AddTaskHandler(w http.ResponseWriter, r *http.Request, task AddTaskVars)
func DatastoreTaskQuery ¶
func DeleteTaskHandler ¶
func DeleteTaskHandler(prototype Task, w http.ResponseWriter, r *http.Request)
func EditTaskHandler ¶
func EditTaskHandler(prototype Task, w http.ResponseWriter, r *http.Request)
func GetEmailRecipients ¶
func GetFailureEmailRecipients ¶
Additionally adds CtAdmins to the email list.
func GetTasksHandler ¶
func GetTasksHandler(prototype Task, w http.ResponseWriter, r *http.Request)
func RedoTaskHandler ¶
func RedoTaskHandler(prototype Task, w http.ResponseWriter, r *http.Request)
func TriggerTaskOnSwarming ¶
func TriggerTaskOnSwarming(ctx context.Context, task AddTaskVars, datastoreTask Task) error
func UpdateTaskSetCompleted ¶
UpdateTaskSetCompleted calls the task's SetCompleted method and updates it in Datastore.
Types ¶
type AddTaskCommonVars ¶
type AddTaskCommonVars struct { Username string `json:"username"` TsAdded string `json:"ts_added"` RepeatAfterDays string `json:"repeat_after_days"` }
Data included in all tasks; set by AddTaskHandler.
func (*AddTaskCommonVars) GetAddTaskCommonVars ¶
func (vars *AddTaskCommonVars) GetAddTaskCommonVars() *AddTaskCommonVars
func (*AddTaskCommonVars) IsAdminTask ¶
func (vars *AddTaskCommonVars) IsAdminTask() bool
type AddTaskVars ¶
type ByPageSetDesc ¶
type ByPageSetDesc []PageSet
ByPageSetDesc implements sort.Interface to order PageSets by their descriptions.
func (ByPageSetDesc) Len ¶
func (p ByPageSetDesc) Len() int
func (ByPageSetDesc) Less ¶
func (p ByPageSetDesc) Less(i, j int) bool
func (ByPageSetDesc) Swap ¶
func (p ByPageSetDesc) Swap(i, j int)
type CLDataResponse ¶
type CLDataResponse struct { CL string `json:"cl"` Subject string `json:"subject"` URL string `json:"url"` Modified string `json:"modified"` ChromiumPatch string `json:"chromium_patch"` SkiaPatch string `json:"skia_patch"` V8Patch string `json:"v8_patch"` CatapultPatch string `json:"catapult_patch"` }
type ClusterTelemetryIDs ¶
type ClusterTelemetryIDs struct {
HighestID int64
}
type CommonCols ¶
type CommonCols struct { DatastoreKey *datastore.Key `json:"-" datastore:"__key__"` TsAdded int64 `json:"ts_added"` TsStarted int64 `json:"ts_started"` TsCompleted int64 `json:"ts_completed"` Username string `json:"username"` Failure bool `json:"failure"` RepeatAfterDays int64 `json:"repeat_after_days"` SwarmingLogs string `json:"swarming_logs"` TaskDone bool `json:"task_done"` SwarmingTaskID string `json:"swarming_task_id"` Id int `json:"id" datastore:"-"` CanRedo bool `json:"can_redo" datastore:"-"` CanDelete bool `json:"can_delete" datastore:"-"` FutureDate bool `json:"future_date" datastore:"-"` TaskType string `json:"task_type" datastore:"-"` GetURL string `json:"get_url" datastore:"-"` DeleteURL string `json:"delete_url" datastore:"-"` }
func (*CommonCols) GetCommonCols ¶
func (dbrow *CommonCols) GetCommonCols() *CommonCols
type DeleteTaskRequest ¶
type DeleteTaskRequest struct {
Id int64 `json:"id"`
}
type EditTaskRequest ¶
type EditTaskRequest struct {
Id int64 `json:"id"`
}
type GetTasksResponse ¶
type GetTasksResponse struct { Data interface{} `json:"data"` Permissions []Permissions `json:"permissions"` Pagination *httputils.ResponsePagination `json:"pagination"` IDs []int64 `json:"ids"` }
type Permissions ¶
type QueryParams ¶
type QueryParams struct { // If non-empty, limits to only tasks with the given username. Username string // Include only tasks that have completed successfully. SuccessfulOnly bool // Include only tasks that have completed after the specified timestamp. CompletedAfter int // Include only tasks that are not yet completed. PendingOnly bool // Include only completed tasks that are scheduled to repeat. FutureRunsOnly bool // Exclude tasks where page_sets is PAGESET_TYPE_DUMMY_1k. ExcludeDummyPageSets bool // If true, SELECT COUNT(*). If false, SELECT * and include ORDER BY and LIMIT clauses. CountQuery bool // First term of LIMIT clause; ignored if countQuery is true. Offset int // Second term of LIMIT clause; ignored if countQuery is true. Size int }
type RedoTaskRequest ¶
type RedoTaskRequest struct {
Id int64 `json:"id"`
}
type Task ¶
type Task interface { GetCommonCols() *CommonCols RunsOnGCEWorkers() bool TriggerSwarmingTaskAndMail(ctx context.Context, swarmingClient swarmingv2.SwarmingV2Client, casClient cas.CAS) error SendCompletionEmail(ctx context.Context, completedSuccessfully bool) error GetTaskName() string SetCompleted(success bool) GetDatastoreKind() ds.Kind GetDescription() string // Returns a slice of the struct type. Query(it *datastore.Iterator) (interface{}, error) // Returns the struct type. Get(c context.Context, key *datastore.Key) (Task, error) // Returns the corresponding AddTaskVars instance of this Task. The returned // instance is populated. GetPopulatedAddTaskVars() (AddTaskVars, error) // Returns the results link for this task if it completed successfully and if // the task supports results links. GetResultsLink() string }
func AddTaskToDatastore ¶
func AddTaskToDatastore(ctx context.Context, task AddTaskVars) (Task, error)
func AsTaskSlice ¶
func AsTaskSlice(selectResult interface{}) []Task
Takes the result of Task.Query and returns a slice of Tasks containing the same objects.
type TaskPrioritiesResponse ¶
Click to show internal directories.
Click to hide internal directories.