workload validation before registering elektron. (#19)

Added a utility to help with validating structs. This utility accepts
validators and runs them. If any of the validators fail, then the
error is wrapped with a given base message and returned.

Added validators for checking different attributes of a task
definition.

Added test code to test task validators.

Retrofitted scheduler.go to just log the task validation error and
terminate. If task validation does not report any error, then the
tasks are provided to the scheduler and elektron registers itself
with Mesos.
This commit is contained in:
PRADYUMNA KAUSHIK 2019-11-26 03:08:12 -05:00 committed by GitHub
parent e3caa90c31
commit 9977251c14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 220 additions and 1 deletions

View file

@ -208,7 +208,7 @@ func main() {
}
tasks, err := def.TasksFromJSON(*tasksFile)
if err != nil || len(tasks) == 0 {
log.Fatal("Invalid tasks specification file provided.")
log.Fatal(err)
}
schedOptions = append(schedOptions, schedulers.WithTasks(tasks))