@@ -1224,8 +1224,8 @@ impl Xtasks {
1224
1224
}
1225
1225
1226
1226
fn bench ( app_settings : GlobalArgs , execute : bool ) -> Result < ( ) > {
1227
- // first of all figure out which branch we're on
1228
- // run // git rev-parse --abbrev-ref HEAD
1227
+ // // first of all figure out which branch we're on
1228
+ // // run // git rev-parse --abbrev-ref HEAD
1229
1229
let workspace_dir = Self :: workspace_dir ( & app_settings) . unwrap ( ) ;
1230
1230
let command = Command :: new ( "git" )
1231
1231
. args ( [ "rev-parse" , "--abbrev-ref" , "HEAD" ] )
@@ -1273,8 +1273,8 @@ impl Xtasks {
1273
1273
. args ( [ "--thresholds-reset" ] )
1274
1274
. args ( [ "--err" ] ) ;
1275
1275
1276
- if let Some ( token) = github_token {
1277
- bencher_cmd. args ( [ "--github-actions" , & token] ) ;
1276
+ if let Some ( token) = & github_token {
1277
+ bencher_cmd. args ( [ "--github-actions" , token] ) ;
1278
1278
}
1279
1279
1280
1280
if !is_main || !execute {
@@ -1295,7 +1295,7 @@ impl Xtasks {
1295
1295
}
1296
1296
1297
1297
// if we're on linux and publishing and on main synch graphs
1298
- if os == "linux" && is_main && execute {
1298
+ if os == "linux" && is_main && execute && github_token . is_some ( ) {
1299
1299
Self :: synch_bencher_graphs ( ) ?;
1300
1300
}
1301
1301
@@ -1307,13 +1307,26 @@ impl Xtasks {
1307
1307
// this produces list of objects each containing a `uuid` and `name`
1308
1308
1309
1309
let parse_list_of_dicts = |bytes : Vec < u8 > | {
1310
- serde_json:: from_slice :: < Vec < HashMap < String , String > > > ( & bytes)
1310
+ if bytes. is_empty ( ) {
1311
+ bail ! ( "Empty input" ) ;
1312
+ }
1313
+ serde_json:: from_slice :: < Vec < HashMap < String , serde_json:: Value > > > ( & bytes)
1314
+ . map ( |map| {
1315
+ map. into_iter ( )
1316
+ . map ( |map| {
1317
+ map. into_iter ( )
1318
+ . map ( |( k, v) | ( k, v. as_str ( ) . unwrap_or_default ( ) . to_string ( ) ) )
1319
+ . collect :: < HashMap < _ , _ > > ( )
1320
+ } )
1321
+ . collect :: < Vec < _ > > ( )
1322
+ } )
1311
1323
. with_context ( || "Could not parse bencher output" )
1312
1324
} ;
1313
1325
1314
1326
let token = std:: env:: var ( "BENCHER_API_TOKEN" ) . ok ( ) ;
1315
1327
let mut bencher_cmd = Command :: new ( "bencher" ) ;
1316
1328
let benchmarks = bencher_cmd
1329
+ . stdout ( std:: process:: Stdio :: piped ( ) )
1317
1330
. arg ( "benchmark" )
1318
1331
. args ( [ "list" , "bms" ] )
1319
1332
. args ( [ "--token" , & token. clone ( ) . unwrap_or_default ( ) ] )
@@ -1324,7 +1337,8 @@ impl Xtasks {
1324
1337
}
1325
1338
1326
1339
// parse teh name and uuid pairs
1327
- let benchmarks = parse_list_of_dicts ( benchmarks. stdout ) ?
1340
+ let benchmarks = parse_list_of_dicts ( benchmarks. stdout )
1341
+ . with_context ( || "Reading benchmarks" ) ?
1328
1342
. into_iter ( )
1329
1343
. map ( |p| {
1330
1344
let name = p. get ( "name" ) . expect ( "no name in project" ) ;
@@ -1337,7 +1351,7 @@ impl Xtasks {
1337
1351
// then bencher plot delete bms <uuid>
1338
1352
1339
1353
let bencher_cmd = Command :: new ( "bencher" )
1340
- . stdout ( std:: process:: Stdio :: inherit ( ) )
1354
+ . stdout ( std:: process:: Stdio :: piped ( ) )
1341
1355
. stderr ( std:: process:: Stdio :: inherit ( ) )
1342
1356
. args ( [ "plot" , "list" , "bms" ] )
1343
1357
. args ( [ "--token" , & token. clone ( ) . unwrap_or_default ( ) ] )
@@ -1348,9 +1362,11 @@ impl Xtasks {
1348
1362
bail ! ( "Failed to list plots: {:?}" , bencher_cmd) ;
1349
1363
}
1350
1364
1351
- let plots = parse_list_of_dicts ( bencher_cmd. stdout ) ?
1365
+ let plots = parse_list_of_dicts ( bencher_cmd. stdout )
1366
+ . with_context ( || "reading plots" ) ?
1352
1367
. into_iter ( )
1353
1368
. map ( |p| {
1369
+ log:: info!( "Plot to delete: {:?}" , p) ;
1354
1370
let uuid = p. get ( "uuid" ) . expect ( "no uuid in plot" ) ;
1355
1371
uuid. clone ( )
1356
1372
} )
@@ -1376,11 +1392,15 @@ impl Xtasks {
1376
1392
. output ( )
1377
1393
. with_context ( || "Could not list testbeds" ) ?;
1378
1394
1395
+ const MAIN_BRANCH_UUID : & str = "1d70a4e3-d416-43fc-91bd-4b1c8f9e9580" ;
1396
+ const LATENCY_MEASURE_UUID : & str = "6820b034-5163-4cdd-95f5-5640dd0ff298" ;
1397
+
1379
1398
if !testbeds. status . success ( ) {
1380
1399
bail ! ( "Failed to list testbeds: {:?}" , testbeds) ;
1381
1400
}
1382
1401
1383
- let testbeds = parse_list_of_dicts ( testbeds. stdout ) ?
1402
+ let testbeds = parse_list_of_dicts ( testbeds. stdout )
1403
+ . with_context ( || "reading testbeds" ) ?
1384
1404
. into_iter ( )
1385
1405
. map ( |p| {
1386
1406
let name = p. get ( "name" ) . expect ( "no name in testbed" ) ;
@@ -1409,19 +1429,24 @@ impl Xtasks {
1409
1429
1410
1430
let window_months = 12 ;
1411
1431
let window_seconds = window_months * 30 * 24 * 60 * 60 ;
1412
- let bencher_cmd = Command :: new ( "bencher" )
1432
+ let mut bencher_cmd = Command :: new ( "bencher" ) ;
1433
+ bencher_cmd
1413
1434
. stdout ( std:: process:: Stdio :: inherit ( ) )
1414
1435
. stderr ( std:: process:: Stdio :: inherit ( ) )
1415
1436
. args ( [ "plot" , "create" , "bms" ] )
1416
1437
. args ( [ "--title" , & plot_name] )
1417
- . arg ( "--upper-boundary" )
1418
1438
. args ( [ "--x-axis" , "date_time" ] )
1419
1439
. args ( [ "--window" , & window_seconds. to_string ( ) ] )
1420
- . args ( [ "--branches" , "main" ] )
1440
+ . args ( [ "--branches" , MAIN_BRANCH_UUID ] )
1421
1441
. args ( [ "--testbeds" , testbed_uuid] )
1422
- . args ( [ "--benchmarks" , & uuids. join ( "," ) ] )
1423
- . args ( [ "--measures" , "latency" ] )
1424
- . args ( [ "--token" , & token. clone ( ) . unwrap_or_default ( ) ] )
1442
+ . args ( [ "--measures" , LATENCY_MEASURE_UUID ] )
1443
+ . args ( [ "--token" , & token. clone ( ) . unwrap_or_default ( ) ] ) ;
1444
+
1445
+ for benchmark_uuid in & uuids {
1446
+ bencher_cmd. arg ( "--benchmarks" ) . arg ( benchmark_uuid) ;
1447
+ }
1448
+
1449
+ let bencher_cmd = bencher_cmd
1425
1450
. output ( )
1426
1451
. with_context ( || "Could not create plot" ) ?;
1427
1452
0 commit comments