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

🩹 Fix result data overwritten when using multiple dataset_groups #1147

Merged

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Oct 16, 2022

This fixes a bug when using multiple dataset_groups, where each OptimizationGroup (one per dataset_group) overwrites previous results from different dataset_group with the input data.

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🚧 Added changes to changelog (mandatory for all PR's)
  • 🧪 Adds new tests for the feature (mandatory for ✨ feature and 🩹 bug fix PR's)

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/fix-result-data-overwrite-multiple-groups

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 16, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.77%.

Quality metrics Before After Change
Complexity 6.36 ⭐ 6.48 ⭐ 0.12 👎
Method Length 95.80 🙂 98.80 🙂 3.00 👎
Working memory 9.25 🙂 9.27 🙂 0.02 👎
Quality 58.26% 🙂 57.49% 🙂 -0.77% 👎
Other metrics Before After Change
Lines 256 264 8
Changed files Quality Before Quality After Quality Change
glotaran/optimization/optimization_group.py 59.12% 🙂 58.95% 🙂 -0.17% 👎
glotaran/optimization/test/test_multiple_goups.py 54.83% 🙂 52.52% 🙂 -2.31% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
glotaran/optimization/optimization_group.py OptimizationGroup.create_result_data 12 🙂 277 ⛔ 12 😞 38.91% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/optimization/test/test_multiple_goups.py test_multiple_groups 4 ⭐ 228 ⛔ 10 😞 52.52% 🙂 Try splitting into smaller methods. Extract out complex expressions
glotaran/optimization/optimization_group.py OptimizationGroup.__init__ 6 ⭐ 152 😞 10 😞 56.78% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@s-weigand s-weigand requested a review from jsnel October 16, 2022 15:37
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.8% 0.8% Duplication

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2022

Benchmark is done. Checkout the benchmark result page.
Benchmark differences below 5% might be due to CI noise.

Benchmark diff v0.6.0 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [6c3c390e]       [69bb7dc0]
     <v0.6.0>                   
+      62.8±0.3ms          107±1ms     1.71  BenchmarkOptimize.time_optimize(False, False, False)
        67.4±30ms          128±1ms    ~1.90  BenchmarkOptimize.time_optimize(False, False, True)
+        62.0±1ms        106±0.8ms     1.71  BenchmarkOptimize.time_optimize(False, True, False)
         65.6±2ms          127±1ms    ~1.94  BenchmarkOptimize.time_optimize(False, True, True)
+      74.1±0.5ms        183±0.7ms     2.48  BenchmarkOptimize.time_optimize(True, False, False)
+       78.7±30ms        204±0.9ms     2.59  BenchmarkOptimize.time_optimize(True, False, True)
+        74.0±3ms          185±1ms     2.50  BenchmarkOptimize.time_optimize(True, True, False)
+       78.8±40ms        204±0.7ms     2.59  BenchmarkOptimize.time_optimize(True, True, True)
             201M             209M     1.04  IntegrationTwoDatasets.peakmem_optimize
-      1.96±0.07s       1.62±0.06s     0.82  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [69bb7dc0]       [3dbd9ddf]
          107±1ms        107±0.2ms     1.00  BenchmarkOptimize.time_optimize(False, False, False)
          128±1ms        127±0.8ms     0.99  BenchmarkOptimize.time_optimize(False, False, True)
        106±0.8ms          106±2ms     1.00  BenchmarkOptimize.time_optimize(False, True, False)
          127±1ms          128±1ms     1.00  BenchmarkOptimize.time_optimize(False, True, True)
        183±0.7ms          186±1ms     1.01  BenchmarkOptimize.time_optimize(True, False, False)
        204±0.9ms        205±0.7ms     1.00  BenchmarkOptimize.time_optimize(True, False, True)
          185±1ms        185±0.7ms     1.00  BenchmarkOptimize.time_optimize(True, True, False)
        204±0.7ms          205±2ms     1.01  BenchmarkOptimize.time_optimize(True, True, True)
             209M             209M     1.00  IntegrationTwoDatasets.peakmem_optimize
       1.62±0.06s       1.64±0.03s     1.01  IntegrationTwoDatasets.time_optimize

Copy link
Member

@joernweissenborn joernweissenborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@codecov
Copy link

codecov bot commented Oct 16, 2022

Codecov Report

Base: 87.2% // Head: 87.2% // No change to project coverage 👍

Coverage data is based on head (3dbd9dd) compared to base (69bb7dc).
Patch coverage: 100.0% of modified lines in pull request are covered.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1147   +/-   ##
=====================================
  Coverage   87.2%   87.2%           
=====================================
  Files        103     103           
  Lines       5274    5274           
  Branches     916     916           
=====================================
  Hits        4599    4599           
  Misses       527     527           
  Partials     148     148           
Impacted Files Coverage Δ
glotaran/optimization/optimization_group.py 95.2% <100.0%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jsnel jsnel merged commit 2e5df6e into glotaran:main Oct 16, 2022
@s-weigand s-weigand deleted the fix-result-data-overwrite-multiple-groups branch October 16, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants