From b73c30a8bf4458cf9c6e06cc7d64fa00dbf482d2 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Tue, 3 Jan 2017 20:30:21 -0500 Subject: [PATCH] Implemented a scheduling tracer. Logs time date and host:task-ID. Made log prefix more global since it needs to be constant for all log files generated. --- README.md | 1 + pcp/loganddynamiccap.go | 3 +-- pcp/pcp.go | 3 +-- scheduler.go | 10 ++++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f50fbc7..5fd1f54 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ To Do: * Write test code for each scheduler (This should be after the design change) * Some of the constants in constants/constants.go can vary based on the environment. Possible to setup the constants at runtime based on the environment? + * Retrofit schedulers for scheduling tracing **Requires [Performance Co-Pilot](http://pcp.io/) tool pmdumptext to be installed on the diff --git a/pcp/loganddynamiccap.go b/pcp/loganddynamiccap.go index 4b17fb5..a9a3f1f 100644 --- a/pcp/loganddynamiccap.go +++ b/pcp/loganddynamiccap.go @@ -61,13 +61,12 @@ func StartLogAndDynamicCap(quit chan struct{}, logging *bool, prefix string, hiT const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c config" cmd := exec.Command("sh", "-c", pcpCommand) cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} - startTime := time.Now().Format("20060102150405") if hiThreshold < loThreshold { log.Println("High threshold is lower than low threshold!") } - logFile, err := os.Create("./" + prefix + startTime + ".pcplog") + logFile, err := os.Create("./" + prefix + ".pcplog") if err != nil { log.Fatal(err) } diff --git a/pcp/pcp.go b/pcp/pcp.go index 3e65a70..edc60a9 100644 --- a/pcp/pcp.go +++ b/pcp/pcp.go @@ -13,9 +13,8 @@ func Start(quit chan struct{}, logging *bool, prefix string) { const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c config" cmd := exec.Command("sh", "-c", pcpCommand) cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} - startTime := time.Now().Format("20060102150405") - logFile, err := os.Create("./" + prefix + startTime + ".pcplog") + logFile, err := os.Create("./" + prefix + ".pcplog") if err != nil { log.Fatal(err) } diff --git a/scheduler.go b/scheduler.go index bd7c943..e9a944d 100644 --- a/scheduler.go +++ b/scheduler.go @@ -55,8 +55,10 @@ func main() { for _, task := range tasks { fmt.Println(task) } + startTime := time.Now().Format("20060102150405") + logPrefix := *pcplogPrefix + "_" + startTime - scheduler := schedulers.NewPistonCapper(tasks, *ignoreWatts) + scheduler := schedulers.NewBPMaxMinWatts(tasks, *ignoreWatts, logPrefix) driver, err := sched.NewMesosSchedulerDriver(sched.DriverConfig{ Master: *master, Framework: &mesos.FrameworkInfo{ @@ -70,9 +72,9 @@ func main() { return } - go pcp.Start(scheduler.PCPLog, &scheduler.RecordPCP, *pcplogPrefix) - //go pcp.StartLogAndDynamicCap(scheduler.PCPLog, &scheduler.RecordPCP, *pcplogPrefix, *hiThreshold, *loThreshold) - time.Sleep(1 * time.Second) + go pcp.Start(scheduler.PCPLog, &scheduler.RecordPCP, logPrefix) + //go pcp.StartLogAndDynamicCap(scheduler.PCPLog, &scheduler.RecordPCP, logPrefix, *hiThreshold, *loThreshold) + time.Sleep(1 * time.Second) //Log for a second since the first second is garbage values from PCP // Attempt to handle signint to not leave pmdumptext running // Catch interrupt