Skip to content

Commit

Permalink
better logname
Browse files Browse the repository at this point in the history
  • Loading branch information
dasbd72 committed Nov 21, 2023
1 parent 30f761a commit d75318e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions benchmark/cmd/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ func init() {
flag.StringVar(&flags.LogDir, "log-dir", "logs", "log directory")

flag.Parse()

if flags.ForceRemote {
flags.LogName = fmt.Sprintf("%s-remote-%s", flags.WorkflowType, time.Now().Format("06010-21504"))
} else {
flags.LogName = fmt.Sprintf("%s-%s", flags.WorkflowType, time.Now().Format("06010-21504"))
}
}

func main() {
Expand All @@ -43,7 +49,7 @@ func main() {
panic(err)
}
// open log file
f, err := os.OpenFile(fmt.Sprintf("%s/%s-%d.log", flags.LogDir, flags.WorkflowType, time.Now().Unix()), os.O_RDWR|os.O_CREATE, 0666)
f, err := os.OpenFile(fmt.Sprintf("%s/%s.log", flags.LogDir, flags.LogName), os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -219,7 +225,7 @@ func benchmark(flags Flags) {
log.Println(string(p))

// Write json file
f, err := os.OpenFile(fmt.Sprintf("%s/%s-%d.json", flags.LogDir, flags.WorkflowType, time.Now().Unix()), os.O_RDWR|os.O_CREATE, 0666)
f, err := os.OpenFile(fmt.Sprintf("%s/%s.json", flags.LogDir, flags.LogName), os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions benchmark/cmd/benchmark/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Flags struct {
Warmup bool `json:"warmup"`
WorkflowType string `json:"workflow_type"`
LogDir string `json:"log_dir"`
LogName string `json:"log_name"`
}

type BenchmarkResult struct {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ go mod download
go run cmd/benchmark/* -tasks 5 -distribution seq -workflow-type ImageProcessing -force-remote -url-postfix default.192.168.100.0.sslip.io
go run cmd/benchmark/* -tasks 5 -distribution seq -workflow-type ImageProcessing -url-postfix default.192.168.100.0.sslip.io
go run cmd/benchmark/* -tasks 5 -distribution seq -workflow-type VideoProcessing -force-remote -url-postfix default.192.168.100.0.sslip.io
go run cmd/benchmark/* -tasks 5 -distribution seq -workflow-type VideoProcessing -url-postfix default.192.168.100.0.sslip.io
go run cmd/benchmark/* -tasks 5 -distribution seq -workflow-type VideoProcessing -url-postfix default.192.168.100.0.sslip.io

0 comments on commit d75318e

Please sign in to comment.