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 save_result crashes on Windows if input data are on a different drive than result #931

Merged
merged 3 commits into from
Dec 5, 2021

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Dec 3, 2021

This fixes the crash of save_result when the original data and the result path are on different drives on windows.

The commit e431760 is optional.

Change summary

  • 🩹 Made 'relative_posix_path' more stable on windows
    - ♻️ Changed save_result folder to use the result.data for scheme.data

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 👌 Closes issue (mandatory for ✨ feature and 🩹 bug fix PR's)

Closes issues

closes #924

On windows if ``source_path`` and ``base_path`` are on different drives, it will return the absolute posix path to the file.
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2021

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/fix-save_result-win-driff-drives

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2021

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

Benchmark diff v0.5.0 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [89046e0a]       [46859f47]
     <v0.5.0>                   
       48.2±0.9ms         50.3±3ms     1.04  BenchmarkOptimize.time_optimize(False, False, False)
         50.8±1ms         54.6±4ms     1.08  BenchmarkOptimize.time_optimize(False, False, True)
       47.7±0.2ms         53.2±4ms    ~1.12  BenchmarkOptimize.time_optimize(False, True, False)
         51.9±1ms         55.9±5ms     1.08  BenchmarkOptimize.time_optimize(False, True, True)
         56.9±1ms         65.0±7ms    ~1.14  BenchmarkOptimize.time_optimize(True, False, False)
        65.1±40ms        79.5±30ms    ~1.22  BenchmarkOptimize.time_optimize(True, False, True)
         56.7±1ms         66.9±5ms    ~1.18  BenchmarkOptimize.time_optimize(True, True, False)
        63.1±40ms        71.8±50ms    ~1.14  BenchmarkOptimize.time_optimize(True, True, True)
             188M             190M     1.01  IntegrationTwoDatasets.peakmem_optimize
       1.77±0.02s       1.73±0.06s     0.98  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [89046e0a]       [46859f47]
     <v0.5.0>                   
       48.2±0.9ms         50.3±3ms     1.04  BenchmarkOptimize.time_optimize(False, False, False)
         50.8±1ms         54.6±4ms     1.08  BenchmarkOptimize.time_optimize(False, False, True)
       47.7±0.2ms         53.2±4ms    ~1.12  BenchmarkOptimize.time_optimize(False, True, False)
         51.9±1ms         55.9±5ms     1.08  BenchmarkOptimize.time_optimize(False, True, True)
         56.9±1ms         65.0±7ms    ~1.14  BenchmarkOptimize.time_optimize(True, False, False)
        65.1±40ms        79.5±30ms    ~1.22  BenchmarkOptimize.time_optimize(True, False, True)
         56.7±1ms         66.9±5ms    ~1.18  BenchmarkOptimize.time_optimize(True, True, False)
        63.1±40ms        71.8±50ms    ~1.14  BenchmarkOptimize.time_optimize(True, True, True)
             188M             190M     1.01  IntegrationTwoDatasets.peakmem_optimize
       1.77±0.02s       1.73±0.06s     0.98  IntegrationTwoDatasets.time_optimize

@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #931 (46859f4) into main (89046e0) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #931   +/-   ##
=====================================
  Coverage   85.1%   85.1%           
=====================================
  Files         85      85           
  Lines       4796    4799    +3     
  Branches     921     921           
=====================================
+ Hits        4082    4085    +3     
  Misses       562     562           
  Partials     152     152           
Impacted Files Coverage Δ
glotaran/utils/io.py 100.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89046e0...46859f4. Read the comment docs.

@joernweissenborn
Copy link
Member

Using result.data will crash in future.

@s-weigand s-weigand force-pushed the fix-save_result-win-driff-drives branch from e431760 to 9e3a581 Compare December 3, 2021 21:52
@s-weigand
Copy link
Member Author

I dropped e431760 since it causes the examples to fail when reoptimizing a result for some reason.
Since the result contains the original data, this needs some more investigation!

@jsnel jsnel modified the milestone: v0.5.0 Dec 3, 2021
Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

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

Some typos to correct and suggest to do some sanity investigation on the other platforms we target.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 4, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.56%.

Quality metrics Before After Change
Complexity 2.30 ⭐ 2.33 ⭐ 0.03 👎
Method Length 51.70 ⭐ 51.14 ⭐ -0.56 👍
Working memory 6.79 🙂 6.69 🙂 -0.10 👍
Quality 74.71% 🙂 75.27% 0.56% 👍
Other metrics Before After Change
Lines 309 324 15
Changed files Quality Before Quality After Quality Change
glotaran/utils/io.py 75.08% ⭐ 75.10% ⭐ 0.02% 👍
glotaran/utils/test/test_io.py 74.50% 🙂 75.36% ⭐ 0.86% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/utils/io.py _load_datasets 15 🙂 156 😞 12 😞 44.60% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/utils/test/test_io.py test_load_datasets_single_dataset 0 ⭐ 208 ⛔ 7 🙂 64.44% 🙂 Try splitting into smaller methods

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!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2021

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
1.5% 1.5% Duplication

@jsnel jsnel self-requested a review December 5, 2021 21:36
@jsnel jsnel merged commit 2c2c605 into glotaran:main Dec 5, 2021
@jsnel jsnel deleted the fix-save_result-win-driff-drives branch December 5, 2021 21:39
jsnel added a commit to jsnel/pyglotaran that referenced this pull request Dec 31, 2021
⬆️ Update version number to 0.5.1

Prepare patch release fixing two bugs:
 - 🩹 Bugfix Use normalized initial_concentrations in result creation for decay megacomplex (glotaran#927)
 - 🩹 Fix save_result crashes on Windows if input data are on a different drive than result (glotaran#931)
@jsnel jsnel mentioned this pull request Dec 31, 2021
1 task
jsnel added a commit to jsnel/pyglotaran that referenced this pull request Dec 31, 2021
⬆️ Update version number to 0.5.1

Prepare patch release fixing two bugs:
 - 🩹 Bugfix Use normalized initial_concentrations in result creation for decay megacomplex (glotaran#927)
 - 🩹 Fix save_result crashes on Windows if input data are on a different drive than result (glotaran#931)
jsnel added a commit that referenced this pull request Dec 31, 2021
⬆️ Update version number to 0.5.1

Patch release fixing two bugs:
 - 🩹 Bugfix Use normalized initial_concentrations in result creation for decay megacomplex (#927)
 - 🩹 Fix save_result crashes on Windows if input data are on a different drive than result (#931)
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.

🐛 save_result crashes on Windows if input data are on a different drive than result
3 participants