Skip to content

Commit

Permalink
Early changes
Browse files Browse the repository at this point in the history
  • Loading branch information
beroy committed Oct 28, 2023
1 parent 4a003c6 commit bd6fbea
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/profiler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: TileDB-SOMA Profiler run

on:
push:
branches:
- main

pull_request:

permissions:
contents: read
pull-requests: read

jobs:

check-links:

name: Setup profiler

run: pip install profiler

name: Run profiler test

run: |
./profiler/perf_checker.sh
21 changes: 21 additions & 0 deletions profiler/ann_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import cellxgene_census
import tiledbsoma as soma
from time import perf_counter

census_S3_latest = dict(census_version="latest")
census_local_copy = dict(uri="/Users/brobatmili/projects/census_data/")


def main():
t1 = perf_counter()
with cellxgene_census.open_soma(**census_local_copy) as census:
with census["census_data"]["homo_sapiens"].axis_query(
measurement_name="RNA", obs_query=soma.AxisQuery(
value_filter="""tissue_general == 'eye'""")

) as query:
query.to_anndata(X_name="raw")
t2 = perf_counter()
print(f"End to end time {t2 - t1}")

main()
5 changes: 5 additions & 0 deletions profiler/perf_checker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

#python -m profiler "python ann_data.py" -t gtime

python ./top_profiler.py
34 changes: 34 additions & 0 deletions profiler/top_profiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from subprocess import PIPE
import subprocess
import data

threshold = 1.10 # Percent difference

db = data.FileBasedProfileDB()

dt = db.find('python ann_data.py')
last_two = dt[-2:]

for s in dt:
second_max_ts: float = 0;
max_ts: float = 0;
l = 0
for ii in dt:
if ii.timestamp > max_ts:
second_max_ts = max_ts
max_ts = l;
l = l + 1;
print(f"max_ts {max_ts} second_max_ts {second_max_ts}")
print(s.user_time_sec)
last_index = -1

print(f"Found indexes are {max_ts} {second_max_ts}")
L = [1, 2]
L[0] = dt[max_ts].user_time_sec
L[1] = dt[second_max_ts].user_time_sec
print(f"{L[0]} {L[1]}")
for i in range(0, 8):
print(f"{i} dt[i].user_time_sec = {dt[i].user_time_sec}")

if threshold * float(L[0]) > float(L[1]) or threshold * float(L[1]) > float(L[0]):
raise SystemExit(f"Potential performance degradation detected {L[0]} va {L[1]}")

0 comments on commit bd6fbea

Please sign in to comment.