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: Fix reflective class loading in IntelliJ #1456

Merged
merged 6 commits into from
Mar 30, 2022

Conversation

svotaw
Copy link
Collaborator

@svotaw svotaw commented Mar 26, 2022

Summary

Some tests rely on the ability to reflect all classes in the synpaseml package (e.g. to filter to a set of all classes derived from a particular parent class). The current implementation uses ClassPath.from() from a spark utility package. However, this utility only works for ClassLoaders derived from UrlClassLoader (not well documented limitation). In the context of sbt, this is true, so things work in pipelines and such. In IntelliJ, the ClassLoaders are the standard App/Ext/Boot trio, which are not, so any test using this pathway fails since ClassPath.from() returns an empty list.

This PR adds a double check so that if the reflected class list from ClassPath comes back empty, it falls back to a manual lookup. This lookup is slower, so the choice was to not replace it, but instead add a path that should only run when a test is run from inside IntelliJ. Caching was added so the lookup is only done once in either case.

Tests

Some tests that were failing before in IntelliJ now work (used first FuzzingTest as a canary). Due to the nature of the fix, there is no way to test this in the pipelines since they use sbt.

Dependency chances

N/A

@svotaw svotaw changed the title Fix reflective class loading in IntelliJ fix: Fix reflective class loading in IntelliJ Mar 26, 2022
Copy link
Collaborator

@mhamilton723 mhamilton723 left a comment

Choose a reason for hiding this comment

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

THis is such an difficult problem you fixed. Just a few things for mutability reduction

@svotaw
Copy link
Collaborator Author

svotaw commented Mar 29, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@svotaw
Copy link
Collaborator Author

svotaw commented Mar 29, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2022

Codecov Report

Merging #1456 (78af409) into master (e5605af) will decrease coverage by 0.08%.
The diff coverage is 42.85%.

@@            Coverage Diff             @@
##           master    #1456      +/-   ##
==========================================
- Coverage   84.39%   84.31%   -0.09%     
==========================================
  Files         284      284              
  Lines       14427    14439      +12     
  Branches      718      722       +4     
==========================================
- Hits        12176    12174       -2     
- Misses       2251     2265      +14     
Impacted Files Coverage Δ
.../azure/synapse/ml/core/utils/JarLoadingUtils.scala 58.62% <33.33%> (-35.50%) ⬇️
...oft/azure/synapse/ml/lightgbm/swig/SwigUtils.scala 88.88% <100.00%> (ø)
...osoft/azure/synapse/ml/core/utils/AsyncUtils.scala 75.00% <0.00%> (-5.00%) ⬇️
...ft/azure/synapse/ml/cognitive/ComputerVision.scala 73.04% <0.00%> (-1.31%) ⬇️
...zure/synapse/ml/stages/PartitionConsolidator.scala 95.74% <0.00%> (+2.12%) ⬆️

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 e5605af...78af409. Read the comment docs.

@svotaw
Copy link
Collaborator Author

svotaw commented Mar 30, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@svotaw
Copy link
Collaborator Author

svotaw commented Mar 30, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@svotaw
Copy link
Collaborator Author

svotaw commented Mar 30, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@svotaw svotaw self-assigned this Mar 30, 2022
@mhamilton723 mhamilton723 merged commit b734132 into microsoft:master Mar 30, 2022
@svotaw svotaw deleted the fix-idea-tests branch May 12, 2022 17:32
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.

None yet

3 participants