Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Last active September 29, 2022 13:49
Show Gist options
  • Save JohnL4/023a210d6dcd83b1c2fe9f2eca0eaa08 to your computer and use it in GitHub Desktop.
Save JohnL4/023a210d6dcd83b1c2fe9f2eca0eaa08 to your computer and use it in GitHub Desktop.
Get the time it takes to distribute cubes out of the log files generated by each distribution job
# Skip short files (assumed error outputs), files that contain "already begin built".
# Parse timestamp out of filename (YYYY-MM-DD-HHMMSS).
# Drop first component of "cube name" (the "Build_" part of "Build_Cube_Name")
ls *-2022-09-*.txt `
| ? {$_.Length -gt 1000} `
| ? {-not (sls -list 'already being built' $_)} `
| sls "Finished '(.*)' after (([0-9\.]+) [a-zA-Z]+)" `
| sel -fir 1000 `
| sel @{Name="Timestamp";Expr={if ($_.Filename -match "(?<timestamp>20\d+-\d+-\d+-\d+)") {$Matches.timestamp} else {""}}} `
, @{Name="Filename";Expr={$_.Filename}} `
, @{Name="Cube";Expr={($_.Matches.Groups[1].Value -split "_")[1..99] -join "_"}} `
, @{Name="ElapsedTime";Expr={$_.Matches.Groups[2].Value}} `
| sel Timestamp,Cube,ElapsedTime `
| ft -au -wr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment