Skip to content

Commit

Permalink
Merge pull request #2955 from h-mayorquin/add_errors_to_import_time
Browse files Browse the repository at this point in the history
Improve profile imports test
  • Loading branch information
samuelgarcia authored Jun 5, 2024
2 parents bd59976 + 26bb45a commit ae9b902
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 9 additions & 2 deletions .github/import_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

n_samples = 10
# Note that the symbols at the end are for centering the table
markdown_output = f"## \n\n| Imported Module ({n_samples=}) | Importing Time (seconds) | Standard Deviation (seconds) |\n| :--: | :--------------: | :------------------: |\n"
markdown_output = f"## \n\n| Imported Module ({n_samples=}) | Importing Time (seconds) | Standard Deviation (seconds) | Times List (seconds) |\n| :--: | :--------------: | :------------------: | :-------------: |\n"

exceptions = []

Expand All @@ -45,10 +45,17 @@
time_taken = float(result.stdout.strip())
time_taken_list.append(time_taken)

# for time in time_taken_list:
# Uncomment once exporting import is fixed
# if time > 2.5:
# exceptions.append(f"Importing {import_statement} took too long: {time:.2f} seconds")
# break

if time_taken_list:
avg_time_taken = sum(time_taken_list) / len(time_taken_list)
std_dev_time_taken = math.sqrt(sum((x - avg_time_taken) ** 2 for x in time_taken_list) / len(time_taken_list))
markdown_output += f"| `{import_statement}` | {avg_time_taken:.2f} | {std_dev_time_taken:.2f} |\n"
times_list_str = ", ".join(f"{time:.2f}" for time in time_taken_list)
markdown_output += f"| `{import_statement}` | {avg_time_taken:.2f} | {std_dev_time_taken:.2f} | {times_list_str} |\n"

if exceptions:
raise Exception("\n".join(exceptions))
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test_imports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Install Spikeinterface with only core dependencies
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI Almighty"
python -m pip install -U pip # Official recommended way
pip install -e . # This should install core only
pip install . # This should install core only
- name: Profile Imports
run: |
echo "## OS: ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY
Expand All @@ -38,8 +38,7 @@ jobs:
shell: bash # Necessary for pipeline to work on windows
- name: Install in full mode
run: |
python -m pip install -U pip # Official recommended way
pip install -e .[full]
pip install .[full]
- name: Profile Imports with full
run: |
# Add a header to separate the two profiles
Expand Down

0 comments on commit ae9b902

Please sign in to comment.