Skip to content

Commit e38d1ea

Browse files
committed
Change Clean() behaviour to always clean output paths.
Move definitions for index and type to top of file so they are easier to read.
1 parent 7158bed commit e38d1ea

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

build/scripts/Benchmarking.fsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ open Git.Branches
2525

2626
module Benchmarker =
2727

28+
let pipelineName = "benchmark-pipeline"
29+
let indexName = IndexName.op_Implicit("benchmark-reports")
30+
let typeName = TypeName.op_Implicit("report")
31+
2832
type ProcessorName(isValueCreated:bool, value:string) =
2933
member val IsValueCreated=isValueCreated with get, set
3034
member val Value=value with get, set
@@ -123,7 +127,7 @@ module Benchmarker =
123127
DotNetCli.RunCommand(fun p ->
124128
{ p with
125129
WorkingDir = testsProjectDirectory
126-
}) "run -f net46 -c Release Benchmark"
130+
}) "run -f net46 -c Release -- Benchmark --namespace Tests"
127131
finally
128132
let benchmarkOutputFiles =
129133
let output = combinePaths testsProjectDirectory "BenchmarkDotNet.Artifacts"
@@ -135,13 +139,15 @@ module Benchmarker =
135139

136140
let IndexResult (client:ElasticClient, file:string, date:DateTime, commit:string, indexName, typeName) =
137141

142+
trace ("Indexing report " + file + " into Elasticsearch")
143+
138144
let document = JsonConvert.DeserializeObject<Report>(File.ReadAllText(file))
139145
document.Date <- date
140146
document.Commit <- commit
141147

142148
let indexRequest = new IndexRequest<Report>(indexName, typeName)
143149
indexRequest.Document <- document
144-
indexRequest.Pipeline <- "benchmark-pipeline"
150+
indexRequest.Pipeline <- pipelineName
145151

146152
let indexResponse = client.Index(indexRequest)
147153

@@ -162,8 +168,6 @@ module Benchmarker =
162168
let uri = new Uri(url)
163169
let client = new ElasticClient(uri)
164170

165-
let indexName = IndexName.op_Implicit("reports")
166-
let typeName = TypeName.op_Implicit("report")
167171
let indexExists = client.IndexExists(Indices.op_Implicit(indexName)).Exists
168172

169173
if indexExists = false then
@@ -183,18 +187,15 @@ module Benchmarker =
183187
if createIndex.IsValid = false then
184188
raise (Exception("Unable to create index into Elasticsearch"))
185189

186-
//let pipelineExists = client.GetPipeline(new GetPipelineRequest(Id.op_Implicit("benchmark-pipeline")))
187-
188-
//if pipelineExists.IsValid = false then
189-
let forEachProcessor = new ForeachProcessor()
190190
let processor = new GrokProcessor();
191191
processor.Field <- new Field("_ingest._value.displayInfo")
192192
processor.Patterns <- ["%{WORD:_ingest._value.class}.%{WORD:_ingest._value.method}: Job-%{WORD:_ingest._value.jobName}\\(Jit=%{WORD:_ingest._value.jit}, Runtime=%{WORD:_ingest._value.clr}, LaunchCount=%{NUMBER:_ingest._value.launchCount}, RunStrategy=%{WORD:_ingest._value.runStrategy}, TargetCount=%{NUMBER:_ingest._value.targetCount}, UnrollFactor=%{NUMBER:_ingest._value.unrollFactor}, WarmupCount=%{NUMBER:_ingest._value.warmupCount}\\)"]
193-
193+
194+
let forEachProcessor = new ForeachProcessor()
194195
forEachProcessor.Field <- new Field("benchmarks")
195196
forEachProcessor.Processor <- processor
196197

197-
let request = new PutPipelineRequest(Id.op_Implicit("benchmark-pipeline"))
198+
let request = new PutPipelineRequest(Id.op_Implicit(pipelineName))
198199
request.Description <- "Grok benchmark settings"
199200
request.Processors <- [forEachProcessor]
200201

build/scripts/Building.fsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,8 @@ module Build =
7272
compileCore incremental
7373

7474
let Clean() =
75-
match (quickBuild, getBuildParam "target" = "clean") with
76-
| (false, _)
77-
| (_, true) ->
78-
tracefn "Cleaning known output folders"
79-
CleanDir Paths.BuildOutput
80-
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(3.) }) "clean src/Elasticsearch.sln -c Release" |> ignore
81-
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))
82-
| (_, _) ->
83-
tracefn "Skipping clean target only run when calling 'release', 'canary', 'clean' as targets directly"
75+
tracefn "Cleaning known output folders"
76+
CleanDir Paths.BuildOutput
77+
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(3.) }) "clean src/Elasticsearch.sln -c Release" |> ignore
78+
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))
79+

build/scripts/Commandline.fsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ module Commandline =
8080
| ["benchmark"; IsUrl elasticsearch] ->
8181
setBuildParam "elasticsearch" elasticsearch
8282

83+
| ["profile"; IsUrl elasticsearch] ->
84+
setBuildParam "elasticsearch" elasticsearch
85+
8386
| ["profile"; esVersions] ->
8487
setBuildParam "esversions" esVersions
88+
8589
| ["profile"; esVersions; testFilter] ->
8690
setBuildParam "esversions" esVersions
8791
setBuildParam "testfilter" testFilter

build/scripts/Profiling.fsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ open Tooling
3232

3333
module Profiler =
3434

35+
let indexName = IndexName.op_Implicit("profiling-reports")
36+
let typeName = TypeName.op_Implicit("report")
37+
3538
type Profile = XmlProvider<"../../build/profiling/profile-example.xml">
3639

3740
type Function(id:string, fqn:string, totalTime:int, ownTime:int, calls:int, instances:int) =
@@ -123,8 +126,6 @@ module Profiler =
123126

124127
let reportDoc = new Report(report.Name, report.Date, report.Commit, functions)
125128

126-
let indexName = IndexName.op_Implicit("reports")
127-
let typeName = TypeName.op_Implicit("report")
128129
let indexExists = client.IndexExists(Indices.op_Implicit(indexName)).Exists
129130

130131
if indexExists = false then

src/Tests/Framework/Benchmarks/BenchmarkConfig.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using BenchmarkDotNet.Configs;
33
using BenchmarkDotNet.Environments;
4-
using BenchmarkDotNet.Exporters;
54
using BenchmarkDotNet.Exporters.Json;
65
using BenchmarkDotNet.Jobs;
76

0 commit comments

Comments
 (0)