Skip to content

Commit

Permalink
fix timestamp format in common
Browse files Browse the repository at this point in the history
  • Loading branch information
ianayl committed Sep 18, 2024
1 parent f1d3a7f commit 652667f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion devops/scripts/benchmarking/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def csv_samples() -> list[str]:
with Path(f"{common.PERF_RES_PATH}/{benchmark}") as cache_dir:
# TODO check for time range; What time range do I want?
return filter(lambda f: f.is_file() and
common.valid_timestamp(str(f)[-17:-4]) and str(f)[-17:-4] > cutoff,
common.valid_timestamp(str(f)[-19:-4]) and str(f)[-19:-4] > cutoff,
cache_dir.glob(f"{benchmark}-*_*.csv"))

# Calculate median of every desired metric:
Expand Down
4 changes: 2 additions & 2 deletions devops/scripts/benchmarking/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def load_configs():

def valid_timestamp(timestamp: str) -> bool:
timestamp_re = re.compile(
# YYMMDD_HHMMSS
'^\d{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])_(0[0-9]|1[0-9]|2[0-3])[0-5][0-9][0-5][0-9]$'
# YYYYMMDD_HHMMSS
'^\d{4}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])_(0[0-9]|1[0-9]|2[0-3])[0-5][0-9][0-5][0-9]$'
)
return timestamp_re.match(timestamp) is not None

0 comments on commit 652667f

Please sign in to comment.