Skip to content

Commit

Permalink
[profiler] apply most of the review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
beroy committed Nov 10, 2023
1 parent 154c0c2 commit 5339583
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/profiler.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: TileDB-SOMA Profiler run

on:
push:
branches:
pull_request:

push:
branches:
- "main"
- main
- 'release-*'
workflow_dispatch:

paths:
- ".github/workflows/profiler"
jobs:

check-links:
Expand Down
5 changes: 2 additions & 3 deletions profiler/ann_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

import tiledbsoma as soma

census_S3_latest = dict(census_version="latest")
census_local_copy = dict(uri="/Users/brobatmili/projects/census_data/")
census_S3_latest = dict(census_version="2023-10-23")


def main():
t1 = perf_counter()
with cellxgene_census.open_soma(**census_local_copy) as census:
with cellxgene_census.open_soma(**census_S3_latest) as census:
with census["census_data"]["homo_sapiens"].axis_query(
measurement_name="RNA",
obs_query=soma.AxisQuery(value_filter="""tissue_general == 'eye'"""),
Expand Down
2 changes: 1 addition & 1 deletion profiler/perf_checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pip install tiledbsoma
pip install cellxgene_census
python -m profiler "python ann_data.py" -t gtime

python ./top_profiler.py
python ./profile_report.py
13 changes: 8 additions & 5 deletions profiler/top_profiler.py → profiler/profile_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@
last_two = dt[-2:]
c = 0

for s in dt:
for s in last_two:
new_db = sorted(dt, key=lambda ProfileData: ProfileData.timestamp)

L = [1, 2]
L[0] = dt[0].user_time_sec
L[1] = dt[1].user_time_sec
L = []
L[0] = dt[0].user_time_sec + dt[0].elapsed_time
L[1] = dt[1].user_time_sec + dt[1].elapsed_time
for i in range(0, len(dt)):
print(f"{i} dt[{i}].user_time_sec = {dt[i].user_time_sec} ts {dt[i].timestamp}")
print(f"L0 = {L[0]} L1 {L[1]}")
print(f"Prev = {L[0]} Curr = {L[1]}")

if threshold * float(L[1]) < float(L[0]) or float(L[1]) > threshold * float(L[0]):
raise SystemExit(f"Potential performance degradation detected {L[0]} va {L[1]}")
print("No recent performance degradation detected")
print(
f"Prev TBD version = {dt[0].tiledbsoma_version} Curr TBD version = {dt[1].tiledbsoma_version}"
)
2 changes: 1 addition & 1 deletion profiler/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
name="soma-profiler",
version="1.0",
packages=find_packages(),
requires=["gitpython", "comacore", "psutil", "tiledbsoma", "cellxgene_census"],
requires=["gitpython", "psutil", "tiledbsoma", "cellxgene_census"],
)

0 comments on commit 5339583

Please sign in to comment.