Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Improve directional diagram algo #113

Merged
merged 3 commits into from
Aug 17, 2024
Merged

Conversation

nawtrey
Copy link
Collaborator

@nawtrey nawtrey commented Aug 17, 2024

Description

This branch changes the way we generate directional diagrams from partial diagrams. Since the paths for the directional diagrams are known ahead of time, we can use a depth-first-search algorithm to find the directed versions of the paths. NetworkX.dfs_tree returns the correct diagrams but with the edges reversed (our previous algorithm also did this) so we simply reverse the edges like before and voila! The new algorithm is significantly more efficient for larger graphs (see results below) and still noticeably faster for small graphs.

Changes

  • Changes directional diagram algorithm
    to use depth-first-search (i.e. nx.dfs_tree)
    to create the directional diagrams. Also
    uses the nx.DiGraph.reverse method to build
    the directional diagram with reversed edges
    and changes directional diagram return type
    for return_edges=False to a nx.DiGraph.

  • Removes private functions
    diagrams._collect_sources and
    diagrams.get_directional_path_edges

  • Move array-based edge flipping code into
    the return_edges=True code path

  • Addresses the directional diagram
    algo improvement portion of ENH: Update KDA partial and directional diagram generation algorithm #22

Performance changes

On this branch we see a significant increase in performance for many of the benchmarks. Running $ asv continuous master improve_dir_edge_generation showed improvements even for some of the functions from calculations.py because they rely on generating the diagrams to create the expressions.

| Change   | Before [9493049b] <master>   | After [0ae72b58] <improve_dir_edge_generation>   |   Ratio | Benchmark (Parameter)
|----------|------------------------------|--------------------------------------------------|---------|--------------------------------------------------------|
| -        | 3.17±0.3ms                   | 2.22±0.1ms                                       |    0.7  | time_calc_state_probs('3-state', True)
| -        | 83.1±10μs                    | 54.3±2μs                                         |    0.65 | time_calc_sigma('3-state', False)
| -        | 14.4±0.9ms                   | 8.73±0.1ms                                       |    0.61 | time_calc_state_probs('Hill-5-state', True)
| -        | 1.57±0.03ms                  | 807±20μs                                         |    0.51 | time_generate_directional_diagrams('3-state', False)
| -        | 687±40ms                     | 352±2ms                                          |    0.51 | time_generate_directional_diagrams('EmrE-8-state', False)
| -        | 1.47±0.07ms                  | 715±20μs                                         |    0.49 | time_calc_state_probs('3-state', False)
| -        | 9.88±0.2ms                   | 4.89±0.3ms                                       |    0.49 | time_generate_directional_diagrams('Hill-5-state', False)
| -        | 102±0.8ms                    | 49.8±1ms                                         |    0.49 | time_generate_directional_diagrams('Hill-8-state', False)
| -        | 1.29±0.02ms                  | 584±30μs                                         |    0.45 | time_generate_directional_diagrams('3-state', True)
| -        | 495±6ms                      | 199±10ms                                         |    0.4  | time_calc_state_probs('EmrE-8-state', False)
| -        | 8.10±0.3ms                   | 3.23±0.02ms                                      |    0.4  | time_calc_state_probs('Hill-5-state', False)
| -        | 74.6±2ms                     | 28.4±1ms                                         |    0.38 | time_calc_state_probs('Hill-8-state', False)
| -        | 471±4ms                      | 165±3ms                                          |    0.35 | time_generate_directional_diagrams('EmrE-8-state', True)
| -        | 7.38±0.09ms                  | 2.53±0.03ms                                      |    0.34 | time_generate_directional_diagrams('Hill-5-state', True)
| -        | 80.8±20ms                    | 23.2±0.3ms                                       |    0.29 | time_generate_directional_diagrams('Hill-8-state', True)

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

* Changes directional diagram algorithm
to use depth-first-search (i.e. `nx.dfs_tree`)
to generate the directional edges.

* Removes private functions
`diagrams._collect_sources` and
`diagrams.get_directional_path_edges`
@nawtrey nawtrey added enhancement New feature or request performance Performance-improving changes labels Aug 17, 2024
* Use networkx method to build the directional
diagram with reversed edges

* Move array-based edge flipping code into
the `return_edges=True` code path

* Changes directional diagram return type
for `return_edges=False` to a `nx.DiGraph`
@nawtrey
Copy link
Collaborator Author

nawtrey commented Aug 17, 2024

With a little more digging, I found a slightly different way to accomplish the same changes. Since nx.dfs_tree returns a nx.DiGraph we can use one of its methods DiGraph.reverse to make a copy of the graph with the edges reversed (instead of making a new graph and adding the edges from scratch). This does change the return type to nx.DiGraphs but that is actually a change I was considering since directional diagrams are best represented by DiGraph objects.

Here is the performance on the latest commit:

| Change   | Before [9493049b] <master>   | After [5a77ec82] <improve_dir_edge_generation>   |   Ratio | Benchmark (Parameter)
|----------|------------------------------|--------------------------------------------------|---------|---------------------------------------------
| -        | 2.97±0.02ms                  | 2.22±0.1ms                                       |    0.75 | time_calc_state_probs('3-state', True)
| -        | 15.3±1ms                     | 8.79±0.2ms                                       |    0.58 | time_calc_state_probs('Hill-5-state', True)
| -        | 1.47±0.1ms                   | 720±10μs                                         |    0.49 | time_calc_state_probs('3-state', False)
| -        | 686±4ms                      | 324±8ms                                          |    0.47 | time_generate_directional_diagrams('EmrE-8-state', False)
| -        | 1.61±0.02ms                  | 735±20μs                                         |    0.46 | time_generate_directional_diagrams('3-state', False)
| -        | 99.2±2ms                     | 45.7±10ms                                        |    0.46 | time_generate_directional_diagrams('Hill-8-state', False)
| -        | 1.31±0.05ms                  | 568±30μs                                         |    0.43 | time_generate_directional_diagrams('3-state', True)
| -        | 9.87±0.2ms                   | 4.29±0.07ms                                      |    0.43 | time_generate_directional_diagrams('Hill-5-state', False)
| -        | 484±3ms                      | 198±7ms                                          |    0.41 | time_calc_state_probs('EmrE-8-state', False)
| -        | 7.83±0.4ms                   | 3.22±0.2ms                                       |    0.41 | time_calc_state_probs('Hill-5-state', False)
| -        | 70.8±0.8ms                   | 28.5±0.9ms                                       |    0.4  | time_calc_state_probs('Hill-8-state', False)
| -        | 462±3ms                      | 183±20ms                                         |    0.4  | time_generate_directional_diagrams('EmrE-8-state', True)
| -        | 66.7±0.5ms                   | 24.9±0.6ms                                       |    0.37 | time_generate_directional_diagrams('Hill-8-state', True)
| -        | 7.84±1ms                     | 2.52±0.04ms                                      |    0.32 | time_generate_directional_diagrams('Hill-5-state', True)

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

While it is nice to see performance gains on the simpler models, the only test case I am really interested in is the EmrE-8-state case since it is the most complex model, and may result in an actually noticeable change in run time.

On the original commit:

| Change   | Before [9493049b] <master>   | After [0ae72b58] <improve_dir_edge_generation>   |   Ratio | Benchmark (Parameter)
|----------|------------------------------|--------------------------------------------------|---------|---------------------------------------------
| -        | 687±40ms                     | 352±2ms                                          |    0.51 | time_generate_directional_diagrams('EmrE-8-state', False)
| -        | 471±4ms                      | 165±3ms                                          |    0.35 | time_generate_directional_diagrams('EmrE-8-state', True)

On the latest commit:

| Change   | Before [9493049b] <master>   | After [5a77ec82] <improve_dir_edge_generation>   |   Ratio | Benchmark (Parameter)
|----------|------------------------------|--------------------------------------------------|---------|---------------------------------------------
| -        | 686±4ms                      | 324±8ms                                          |    0.47 | time_generate_directional_diagrams('EmrE-8-state', False)
| -        | 66.7±0.5ms                   | 24.9±0.6ms                                       |    0.37 | time_generate_directional_diagrams('Hill-8-state', True)

Since the latest version appears to be at least as good I think I'm happy with the changes here.

@nawtrey
Copy link
Collaborator Author

nawtrey commented Aug 17, 2024

Just as a final performance check, I went ahead and added a new test case for the diagram benchmarks which tests a maximally-connected 7-state diagram. For maximally-connected graphs, there are N^(N-1) directional diagrams, and thus 117649 directional diagrams for a maximally-connected 7-state diagram. For reference, the 8-state EmrE model has 3072 directional diagrams.

Here is the performance comparison with the new test model included for the latest commit:

[58.33%] ··· ...lDiagrams.time_generate_directional_diagrams                ok
[58.33%] ··· ============== ============ ============
             --                    return_edges
             -------------- -------------------------
                 graph          True        False
             ============== ============ ============
                3-state      623±100μs    791±100μs
              Hill-5-state   2.82±0.2ms   4.14±0.4ms
              Hill-8-state   23.0±0.4ms    46.7±2ms
              EmrE-8-state    179±8ms      328±20ms
              Max-7-state    8.28±0.04s   12.7±0.07s
             ============== ============ ============

And for master:

[83.33%] ··· ...lDiagrams.time_generate_directional_diagrams                ok
[83.33%] ··· ============== ============ ============
             --                    return_edges
             -------------- -------------------------
                 graph          True        False
             ============== ============ ============
                3-state      1.31±0.1ms   2.49±0.3ms
              Hill-5-state    7.64±2ms     11.4±2ms
              Hill-8-state   80.3±10ms     104±5ms
              EmrE-8-state    478±70ms    785±200ms
              Max-7-state    19.9±0.9s    25.4±0.1s
             ============== ============ ============

It appears for diagrams this complex there is also a benefit for peak memory (probably due to the use of the less complex nx.DiGraph objects):

| Change   | Before [9493049b] <master>   | After [5a5a77b0] <improve_dir_edge_generation>   |   Ratio | Benchmark (Parameter)
|----------|------------------------------|--------------------------------------------------|---------|----------------------------------
| -        | 1.05G                        | 818M                                             |    0.78 | peakmem_generate_directional_diagrams('Max-7-state', False)

I don't think I will be adding the 7-state test case to the benchmark suite due to the long run time of 12.7 seconds, but I think it is useful to see what kind of performance we get for such an extreme case (i.e. 12.7s run time with 0.82 GB used). I think it is impressive that I'm able to build ~9300 directional diagrams per second on my laptop.

For future reference I will paste the benchmark output with the 7-state case included:

Benchmarks ran with Max-7-state
$ asv continuous master improve_dir_edge_generation -b bench_diagrams*
Couldn't load asv.plugins._mamba_helpers because
No module named 'libmambapy'
· Creating environments
· Discovering benchmarks
·· Uninstalling from conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
·· Building 5a5a77b0 <improve_dir_edge_generation> for conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
·· Installing 5a5a77b0 <improve_dir_edge_generation> into conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
· Running 12 total benchmarks (2 commits * 1 environments * 6 benchmarks)
[ 0.00%] · For kda commit 9493049b <master> (round 1/2):
[ 0.00%] ·· Building for conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[ 0.00%] ·· Benchmarking conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[ 8.33%] ··· Running (bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams--).
[16.67%] ··· Running (bench_diagrams.FluxDiagrams.time_generate_flux_diagrams--)..
[25.00%] · For kda commit 5a5a77b0 <improve_dir_edge_generation> (round 1/2):
[25.00%] ·· Building for conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[25.00%] ·· Benchmarking conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[33.33%] ··· Running (bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams--).
[41.67%] ··· Running (bench_diagrams.FluxDiagrams.time_generate_flux_diagrams--)..
[50.00%] · For kda commit 5a5a77b0 <improve_dir_edge_generation> (round 2/2):
[50.00%] ·· Benchmarking conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[54.17%] ··· ...agrams.peakmem_generate_directional_diagrams                ok
[54.17%] ··· ============== ======= =======
             --               return_edges
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      80.4M   80.5M
              Hill-5-state   80.7M   80.9M
              Hill-8-state   80.9M   83.5M
              EmrE-8-state   82.5M    102M
              Max-7-state     152M    818M
             ============== ======= =======

[58.33%] ··· ...lDiagrams.time_generate_directional_diagrams                ok
[58.33%] ··· ============== ============ ============
             --                    return_edges
             -------------- -------------------------
                 graph          True        False
             ============== ============ ============
                3-state      623±100μs    791±100μs
              Hill-5-state   2.82±0.2ms   4.14±0.4ms
              Hill-8-state   23.0±0.4ms    46.7±2ms
              EmrE-8-state    179±8ms      328±20ms
              Max-7-state    8.28±0.04s   12.7±0.07s
             ============== ============ ============

[62.50%] ··· ....FluxDiagrams.peakmem_generate_flux_diagrams                ok
[62.50%] ··· ============== =======
                 graph
             -------------- -------
                3-state      80.3M
              Hill-5-state   80.7M
              Hill-8-state   81.1M
              EmrE-8-state   84.6M
             ============== =======

[66.67%] ··· ...ams.FluxDiagrams.time_generate_flux_diagrams                ok
[66.67%] ··· ============== =============
                 graph
             -------------- -------------
                3-state        809±10μs
              Hill-5-state   2.14±0.06ms
              Hill-8-state    14.9±0.3ms
              EmrE-8-state     152±1ms
             ============== =============

[70.83%] ··· ...alDiagrams.peakmem_generate_partial_diagrams                ok
[70.83%] ··· ============== ======= =======
             --               return_edges
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      80.3M   80.3M
              Hill-5-state   80.4M   80.4M
              Hill-8-state   80.6M   80.5M
              EmrE-8-state   80.6M   82.1M
              Max-7-state    81.3M    138M
             ============== ======= =======

[75.00%] ··· ...rtialDiagrams.time_generate_partial_diagrams                ok
[75.00%] ··· ============== ============= ============
             --                    return_edges
             -------------- --------------------------
                 graph           True        False
             ============== ============= ============
                3-state        225±9μs      215±3μs
              Hill-5-state     459±10μs     435±20μs
              Hill-8-state   2.69±0.02ms   2.94±0.2ms
              EmrE-8-state     16.7±1ms    15.3±0.1ms
              Max-7-state     1.07±0.05s    960±10ms
             ============== ============= ============

[75.00%] · For kda commit 9493049b <master> (round 2/2):
[75.00%] ·· Building for conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[75.00%] ·· Benchmarking conda-py3.11-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[79.17%] ··· ...agrams.peakmem_generate_directional_diagrams                ok
[79.17%] ··· ============== ======= =======
             --               return_edges
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      80.4M   80.8M
              Hill-5-state   80.6M   80.8M
              Hill-8-state   80.7M   84.9M
              EmrE-8-state   82.2M    109M
              Max-7-state     150M   1.05G
             ============== ======= =======

[83.33%] ··· ...lDiagrams.time_generate_directional_diagrams                ok
[83.33%] ··· ============== ============ ============
             --                    return_edges
             -------------- -------------------------
                 graph          True        False
             ============== ============ ============
                3-state      1.31±0.1ms   2.49±0.3ms
              Hill-5-state    7.64±2ms     11.4±2ms
              Hill-8-state   80.3±10ms     104±5ms
              EmrE-8-state    478±70ms    785±200ms
              Max-7-state    19.9±0.9s    25.4±0.1s
             ============== ============ ============

[87.50%] ··· ....FluxDiagrams.peakmem_generate_flux_diagrams                ok
[87.50%] ··· ============== =======
                 graph
             -------------- -------
                3-state      80.5M
              Hill-5-state   80.8M
              Hill-8-state   81.1M
              EmrE-8-state   84.7M
             ============== =======

[91.67%] ··· ...ams.FluxDiagrams.time_generate_flux_diagrams                ok
[91.67%] ··· ============== =============
                 graph
             -------------- -------------
                3-state        803±10μs
              Hill-5-state   2.14±0.05ms
              Hill-8-state     15.5±2ms
              EmrE-8-state     151±2ms
             ============== =============

[95.83%] ··· ...alDiagrams.peakmem_generate_partial_diagrams                ok
[95.83%] ··· ============== ======= =======
             --               return_edges
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      80.7M   80.9M
              Hill-5-state   80.6M   80.5M
              Hill-8-state   80.4M   80.7M
              EmrE-8-state   80.6M   81.9M
              Max-7-state    81.3M    138M
             ============== ======= =======

[100.00%] ··· ...rtialDiagrams.time_generate_partial_diagrams                ok
[100.00%] ··· ============== ============= =============
              --                     return_edges
              -------------- ---------------------------
                  graph           True         False
              ============== ============= =============
                 3-state        235±10μs      216±2μs
               Hill-5-state     455±30μs      434±3μs
               Hill-8-state   2.72±0.05ms   2.52±0.04ms
               EmrE-8-state    17.4±0.9ms     15.5±2ms
               Max-7-state     1.05±0.03s     961±10ms
              ============== ============= =============

| Change   | Before [9493049b] <master>   | After [5a5a77b0] <improve_dir_edge_generation>   |   Ratio | Benchmark (Parameter)                                                                          |
|----------|------------------------------|--------------------------------------------------|---------|------------------------------------------------------------------------------------------------|
| -        | 1.05G                        | 818M                                             |    0.78 | bench_diagrams.DirectionalDiagrams.peakmem_generate_directional_diagrams('Max-7-state', False) |
| -        | 1.31±0.1ms                   | 623±100μs                                        |    0.48 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('3-state', True)         |
| -        | 104±5ms                      | 46.7±2ms                                         |    0.45 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('Hill-8-state', False)   |
| -        | 785±200ms                    | 328±20ms                                         |    0.42 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('EmrE-8-state', False)   |
| -        | 478±70ms                     | 179±8ms                                          |    0.37 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('EmrE-8-state', True)    |
| -        | 7.64±2ms                     | 2.82±0.2ms                                       |    0.37 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('Hill-5-state', True)    |
| -        | 11.4±2ms                     | 4.14±0.4ms                                       |    0.36 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('Hill-5-state', False)   |
| -        | 2.49±0.3ms                   | 791±100μs                                        |    0.32 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('3-state', False)        |
| -        | 80.3±10ms                    | 23.0±0.4ms                                       |    0.29 | bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams('Hill-8-state', True)    |

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

@nawtrey
Copy link
Collaborator Author

nawtrey commented Aug 17, 2024

I re-ran the Python 3.11 runner in an attempt to get a codecov report (I anticipate a small reduction in overall coverage) but there is still an issue. I'll paste the error below, but it seems there is a new issue open for this (codecov/codecov-action#1547). I'll probably merge anyways, the code coverage here is not super important.

Codecov output
Run codecov/codecov-action@v4
evenName: pull_request
baseRef: Becksteinlab:master | headRef: Becksteinlab:improve_dir_edge_generation
evenName: pull_request
baseRef: Becksteinlab:master | headRef: Becksteinlab:improve_dir_edge_generation
evenName: pull_request
baseRef: Becksteinlab:master | headRef: Becksteinlab:improve_dir_edge_generation
==> linux OS detected
https://cli.codecov.io/latest/linux/codecov.SHA256SUM
Received SHA256SUM eb902009cb800fdefbce291c1357953f80e29382f43c7a98cce3b57d2b4d8cec  codecov
Received SHA256SUM signature -----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEJwNOf9uFDgu8LGL/gGuyiu13mGkFAma/32IACgkQgGuyiu13
mGn0oRAAknbxxCw++AHhcXgs/+YTAh7n9MBt7Yw2eVaWBu1vvkxnQpyj5L9hHATy
D8vlvaxH5uuTZWRhPborSu/2EW6Aw3pPnTQLjANLEfZrxUPhGP/l8K/UaC/m8D4w
YstXKgUXPME4+uv8LIL//9b1sUtgtfYxSgMbdNtyxNXJMkywadxRQojjZgkGjC41
rRJPWALDwfx+2FGSA3BahbDX4zyxz8Nzk2S4JAvV5dvoVsjmk1+3/IwzQEonrr7Z
QkX3ibIAgeg9fRRfZbucNk29tb7y1uz1jx5Y4ZLKGwkxHP7zV1+S5xq15aHcRxZR
eLV0r9UUG9SrCWQx3i4fY22KI5M3dUmU5M4rggcwP21pH3MoD7JWc07B2G5V8D2p
tYCpdmZ1Hvq2QChQyX1y7VvSK8E2kgMHcF/JVHSVZ8rVEnoaBiEDVQWSGeEDvep1
7YN0iVqPxi6ItN0TnqYB7AavdIVf6DOy+S7ZTq9lvxoQ6fPKS4pP8WqF0tx7Wz61
GfGe0UJ/1UYseo/hkV+tn6HfUokNHxHRP7gCw6XCpORKPwoX0S+FJ/k7bgHVFkwa
o5AuJKRD0HCUETmkfy5cE623rNeAZTc[10](https://github.com/Becksteinlab/kda/actions/runs/10428286101/job/28885604136?pr=113#step:7:11)Z8+bkRZYqv+dlaoGuldxITiERWqTKOK
NVb2u5O2eFQrxTRRCwHDPgg4ZEFwEcJFtFhucTU52j86ZsOlENI=
=icgL
-----END PGP SIGNATURE-----

gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key 806BB28AED779869: public key "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Fri Aug 16 23:23:14 2024 UTC
gpg:                using RSA key 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2703 4E7F DB85 0E0B BC2C  62FF 806B B28A ED77 9869
==> Uploader SHASUM verified (eb902009cb800fdefbce291c1357953f80e29382f43c7a98cce3b57d2b4d8cec  codecov)
==> Running version latest
==> Running version v0.7.4
==> Running git config --global --add safe.directory /home/runner/work/kda/kda
/usr/bin/git config --global --add safe.directory /home/runner/work/kda/kda
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov -v create-commit'
/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov -v create-commit --git-service github -C 5a77ec825bc97685dad1641bc797223c49f528bb
info - 2024-08-17 02:39:34,442 -- ci service found: github-actions
debug - 2024-08-17 02:39:34,444 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.GitVersioningSystem'>
debug - 2024-08-17 02:39:34,447 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.GitVersioningSystem'>
debug - 2024-08-17 02:39:34,449 -- Loading config from /home/runner/work/kda/kda/.codecov.yml
debug - 2024-08-17 02:39:34,451 -- Starting create commit process --- {"commit_sha": "5a77ec825bc97685dad1641bc797223c49f528bb", "parent_sha": null, "pr": "[11](https://github.com/Becksteinlab/kda/actions/runs/10428286101/job/28885604136?pr=113#step:7:12)3", "branch": "improve_dir_edge_generation", "slug": "Becksteinlab/kda", "token": "4******************", "service": "github", "enterprise_url": null}
warning - 2024-08-17 02:39:34,559 -- Response status code was 500. --- {"retry": 0}
warning - 2024-08-17 02:39:34,559 -- Request failed. Retrying --- {"retry": 0}
warning - 2024-08-17 02:39:35,192 -- Response status code was 500. --- {"retry": 1}
warning - 2024-08-17 02:39:35,193 -- Request failed. Retrying --- {"retry": 1}
warning - 2024-08-17 02:39:36,305 -- Response status code was 500. --- {"retry": 2}
warning - 2024-08-17 02:39:36,305 -- Request failed. Retrying --- {"retry": 2}
Traceback (most recent call last):
  File "codecov_cli/main.py", line 85, in <module>
  File "codecov_cli/main.py", line 81, in run
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line [14](https://github.com/Becksteinlab/kda/actions/runs/10428286101/job/28885604136?pr=113#step:7:15)34, in invoke
  File "click/core.py", line 783, in invoke
  File "click/decorators.py", line 33, in new_func
  File "codecov_cli/commands/commit.py", line 64, in create_commit
  File "codecov_cli/services/commit/__init__.py", line 28, in create_commit_logic
  File "codecov_cli/services/commit/__init__.py", line 65, in send_commit_data
  File "codecov_cli/helpers/request.py", line 82, in wrapper
Exception: Request failed after too many retries
[PYI-[20](https://github.com/Becksteinlab/kda/actions/runs/10428286101/job/28885604136?pr=113#step:7:21)30:ERROR] Failed to execute script 'main' due to unhandled exception!
Warning: Codecov: Failed to properly create commit: The process '/home/runner/work/_actions/codecov/codecov-action/v4/dist/codecov' failed with exit code 1

@nawtrey
Copy link
Collaborator Author

nawtrey commented Aug 17, 2024

Alright, everything looks good here (except codecov).

I'll just note that the depth-first-search algorithm time complexity is O(V + E), which means we should see the performance scale as 2V-1 for our directional diagrams.

The generate_directional_diagrams function does include the time complexity of generate_partial_diagrams, so that will factor in of course. But my guess is it will be hard to beat 2V-1 scaling without writing our own custom depth-first-search function (though unlikely).

@nawtrey nawtrey merged commit 61a1fcb into master Aug 17, 2024
4 checks passed
@nawtrey nawtrey deleted the improve_dir_edge_generation branch August 17, 2024 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Performance-improving changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant