Documentation
¶
Index ¶
- Constants
- func CheckPassword(plaintext, hashed string) bool
- func FetchWorkersForWatchdog(ctx context.Context, db *sql.DB) ([]watchdog.WorkerInfo, error)
- func HttpServer(cfg config.Config) (tls.Certificate, string, http.Handler, error)
- func IsAdmin(ctx context.Context) bool
- func LoadEmbeddedCertificates() (tls.Certificate, string, error)
- func LogoutHandler(w http.ResponseWriter, r *http.Request)
- func NewLogin(s *taskQueueServer) http.HandlerFunc
- func Serve(cfg config.Config, ctx context.Context, cancel context.CancelFunc) error
- type Accumulator
- type AuthenticatedUser
- type Job
- type ParamSpec
- type StepAgg
- type StepStatsAgg
- type TaskUpdateBroadcast
Constants ¶
const DefaultAssignTrigger int32 = 500 // 5 sec
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
func FetchWorkersForWatchdog ¶
FetchWorkersForWatchdog reads workers and builds WorkerInfo list
func HttpServer ¶
func LoadEmbeddedCertificates ¶
func LoadEmbeddedCertificates() (tls.Certificate, string, error)
func LogoutHandler ¶
func LogoutHandler(w http.ResponseWriter, r *http.Request)
LogoutHandler clears the session_token cookie to log out the user.
func NewLogin ¶
func NewLogin(s *taskQueueServer) http.HandlerFunc
NewLogin returns an HTTP handler function to process login requests.
Types ¶
type Accumulator ¶
In-memory aggregation types for step/workflow stats Accumulator holds aggregation stats for durations/counts.
type AuthenticatedUser ¶
func GetUserFromContext ¶
func GetUserFromContext(ctx context.Context) *AuthenticatedUser
type Job ¶
type Job struct {
JobID int32
WorkerID int32
WorkerName string
ProviderID int32
Region string
Flavor string
Action rune // "C", "D", "R"
Retry int
Timeout time.Duration
FromRecruiter bool
}
Job represents a task to be executed.
type StepAgg ¶
type StepAgg struct {
// Task status counters
Waiting int32
Pending int32
Accepted int32
Running int32
Uploading int32
Succeeded int32
Failed int32
ReallyFailed int32 // tasks that have exhausted all retries and are failed
Total int32
// Accumulators for durations
Download Accumulator
Upload Accumulator
SuccessRun Accumulator
FailRun Accumulator
// RunningTasks maps taskID to start time
RunningTasks map[int32]time.Time
// Time bounds (epoch seconds)
StartTime *int64
EndTime *int64
}
StepAgg aggregates statistics for a step within a workflow.
func NewStepAgg ¶
func NewStepAgg() *StepAgg
NewStepAgg creates a new StepAgg with sensible defaults.
type StepStatsAgg ¶
type StepStatsAgg struct {
// contains filtered or unexported fields
}
StepStatsAgg holds in-memory aggregated statistics for steps in workflows.
func NewStepStatsAgg ¶
func NewStepStatsAgg(db *sql.DB) (*StepStatsAgg, error)
NewStepStatsAgg creates a new StepStatsAgg with initialized internal maps.
func (*StepStatsAgg) EnsureStep ¶
func (a *StepStatsAgg) EnsureStep(workflowID, stepID int32)
EnsureStep guarantees an entry exists for (workflowID, stepID).
func (*StepStatsAgg) RemoveStep ¶
func (a *StepStatsAgg) RemoveStep(stepID int32) int32
RemoveStep deletes a step entry by its stepID, scanning all workflows to locate it.
func (*StepStatsAgg) RemoveWorkflow ¶
func (a *StepStatsAgg) RemoveWorkflow(workflowID int32)