Code formatting
This commit is contained in:
parent
ef8bd6ac1f
commit
4d15e59d4c
41 changed files with 472 additions and 475 deletions
|
@ -25,9 +25,9 @@ import (
|
||||||
|
|
||||||
"github.com/mash/gokmeans"
|
"github.com/mash/gokmeans"
|
||||||
"github.com/montanaflynn/stats"
|
"github.com/montanaflynn/stats"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Information about a cluster of tasks.
|
// Information about a cluster of tasks.
|
||||||
|
|
|
@ -3,9 +3,9 @@ package elektronLogging
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ElektronFormatter struct {
|
type ElektronFormatter struct {
|
||||||
|
@ -47,7 +47,6 @@ func (f ElektronFormatter) Format(entry *log.Entry) ([]byte, error) {
|
||||||
strings.Join([]string{key, fmt.Sprintf("%s", value)}, "="))
|
strings.Join([]string{key, fmt.Sprintf("%s", value)}, "="))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
b.WriteString(message)
|
b.WriteString(message)
|
||||||
b.WriteString(strings.Join(formattedFields, ", "))
|
b.WriteString(strings.Join(formattedFields, ", "))
|
||||||
b.WriteByte('\n')
|
b.WriteByte('\n')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClsfnTaskDistOverheadLogger struct {
|
type ClsfnTaskDistOverheadLogger struct {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConsoleLogger struct {
|
type ConsoleLogger struct {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
logrus "github.com/sirupsen/logrus"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
logrus "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var logDir string
|
var logDir string
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
|
||||||
. "github.com/spdfg/elektron/elektronLogging/types"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
. "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var config LoggerConfig
|
var config LoggerConfig
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
"io/ioutil"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
elekEnv "github.com/spdfg/elektron/environment"
|
elekEnv "github.com/spdfg/elektron/environment"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
"io/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoggerConfig struct {
|
type LoggerConfig struct {
|
||||||
|
|
||||||
SchedTraceConfig struct {
|
SchedTraceConfig struct {
|
||||||
Enabled bool `yaml:"enabled"`
|
Enabled bool `yaml:"enabled"`
|
||||||
FilenameExtension string `yaml:"filenameExtension"`
|
FilenameExtension string `yaml:"filenameExtension"`
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PcpLogger struct {
|
type PcpLogger struct {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SchedPolicySwitchLogger struct {
|
type SchedPolicySwitchLogger struct {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SchedTraceLogger struct {
|
type SchedTraceLogger struct {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SchedWindowLogger struct {
|
type SchedWindowLogger struct {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package elektronLogging
|
package elektronLogging
|
||||||
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ERROR = iota
|
ERROR = iota
|
||||||
WARNING = iota
|
WARNING = iota
|
||||||
|
@ -13,4 +12,3 @@ const (
|
||||||
SCHED_WINDOW = iota
|
SCHED_WINDOW = iota
|
||||||
CLSFN_TASKDIST_OVERHEAD = iota
|
CLSFN_TASKDIST_OVERHEAD = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Start(quit chan struct{}, logging *bool, pcpConfigFile string) {
|
func Start(quit chan struct{}, logging *bool, pcpConfigFile string) {
|
||||||
|
|
|
@ -29,11 +29,11 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spdfg/elektron/pcp"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/rapl"
|
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
"github.com/spdfg/elektron/pcp"
|
||||||
|
"github.com/spdfg/elektron/rapl"
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThreshold, loThreshold float64, pcpConfigFile string) {
|
func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThreshold, loThreshold float64, pcpConfigFile string) {
|
||||||
|
|
|
@ -30,13 +30,13 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/constants"
|
"github.com/spdfg/elektron/constants"
|
||||||
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
"github.com/spdfg/elektron/pcp"
|
"github.com/spdfg/elektron/pcp"
|
||||||
"github.com/spdfg/elektron/rapl"
|
"github.com/spdfg/elektron/rapl"
|
||||||
"github.com/spdfg/elektron/utilities"
|
"github.com/spdfg/elektron/utilities"
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func round(num float64) int {
|
func round(num float64) int {
|
||||||
|
|
|
@ -28,13 +28,13 @@ import (
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
||||||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/def"
|
"github.com/spdfg/elektron/def"
|
||||||
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
"github.com/spdfg/elektron/pcp"
|
"github.com/spdfg/elektron/pcp"
|
||||||
"github.com/spdfg/elektron/powerCap"
|
"github.com/spdfg/elektron/powerCap"
|
||||||
"github.com/spdfg/elektron/schedulers"
|
"github.com/spdfg/elektron/schedulers"
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var master = flag.String("master", "", "Location of leading Mesos master -- <mesos-master>:<port>")
|
var master = flag.String("master", "", "Location of leading Mesos master -- <mesos-master>:<port>")
|
||||||
|
|
|
@ -28,12 +28,12 @@ import (
|
||||||
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
||||||
"github.com/mesos/mesos-go/api/v0/mesosutil"
|
"github.com/mesos/mesos-go/api/v0/mesosutil"
|
||||||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/def"
|
"github.com/spdfg/elektron/def"
|
||||||
"github.com/spdfg/elektron/utilities"
|
|
||||||
"github.com/spdfg/elektron/utilities/schedUtils"
|
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
"github.com/spdfg/elektron/utilities"
|
||||||
|
"github.com/spdfg/elektron/utilities/schedUtils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BaseScheduler struct {
|
type BaseScheduler struct {
|
||||||
|
|
|
@ -23,13 +23,13 @@ import (
|
||||||
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
||||||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/constants"
|
"github.com/spdfg/elektron/constants"
|
||||||
"github.com/spdfg/elektron/def"
|
"github.com/spdfg/elektron/def"
|
||||||
"github.com/spdfg/elektron/utilities"
|
|
||||||
"github.com/spdfg/elektron/utilities/mesosUtils"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
|
"github.com/spdfg/elektron/utilities"
|
||||||
|
"github.com/spdfg/elektron/utilities/mesosUtils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func coLocated(tasks map[string]bool, s BaseScheduler) {
|
func coLocated(tasks map[string]bool, s BaseScheduler) {
|
||||||
|
|
|
@ -24,10 +24,10 @@ import (
|
||||||
|
|
||||||
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
||||||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/def"
|
"github.com/spdfg/elektron/def"
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SchedPolicyContext interface {
|
type SchedPolicyContext interface {
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
package offerUtils
|
package offerUtils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/constants"
|
"github.com/spdfg/elektron/constants"
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func OfferAgg(offer *mesos.Offer) (float64, float64, float64) {
|
func OfferAgg(offer *mesos.Offer) (float64, float64, float64) {
|
||||||
|
|
|
@ -20,11 +20,11 @@ package schedUtils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spdfg/elektron/def"
|
"github.com/spdfg/elektron/def"
|
||||||
"github.com/spdfg/elektron/utilities"
|
|
||||||
"github.com/spdfg/elektron/elektronLogging"
|
"github.com/spdfg/elektron/elektronLogging"
|
||||||
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
elekLogT "github.com/spdfg/elektron/elektronLogging/types"
|
||||||
log "github.com/sirupsen/logrus"
|
"github.com/spdfg/elektron/utilities"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Criteria for resizing the scheduling window.
|
// Criteria for resizing the scheduling window.
|
||||||
|
|
Reference in a new issue