Specify files for port detection for every detector#28
Specify files for port detection for every detector#28thepetk merged 31 commits intodevfile:mainfrom
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 67.89% 70.48% +2.59%
==========================================
Files 11 11
Lines 1523 1555 +32
==========================================
+ Hits 1034 1096 +62
+ Misses 423 393 -30
Partials 66 66
☔ View full report in Codecov by Sentry. |
|
Updates on commenting & documentation have been added. The |
ba40f40 to
67644fa
Compare
There was a problem hiding this comment.
I was just benchmarking the performance improvements locally (using the same hypershift repo) and noticed a strange behavior.
When running from the Alizer source code:
☸ ~/w/p/d/alizer on 1151_ft/specific_port_detection [$!?] via 🐹 v1.19.12
$ go build -o alizer alizer.go
☸ ~/w/p/d/alizer on 1151_ft/specific_port_detection [$!?] via 🐹 v1.19.12
$ time ./alizer component /home/asoro/work/tmp/hypershift
[...]
./alizer component /home/asoro/work/tmp/hypershift 18.74s user 1.82s system 123% cpu 16.644 total
But when running the same Alizer binary from the hypershift repo directory, it takes very long:
☸ ~/w/t/hypershift on main via 🐹 v1.21.0
$ time /home/asoro/work/projects/devfile/alizer/alizer component .
[...]
/home/asoro/work/projects/devfile/alizer/alizer component . 142.18s user 3.05s system 111% cpu 2:10.65 total
Do you have the same issue? Or am I missing something?
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]> Co-authored-by: Armel Soro <[email protected]> Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]> Co-authored-by: Armel Soro <[email protected]> Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]> Co-authored-by: Armel Soro <[email protected]> Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
2c1124f to
c1d3f23
Compare
@rm3l no locally I have ~5secs if I run it from the directory of Hypershift and ~3secs if I run it from alizer dir |
Ok, never mind. Fine then if it is okay on your end. It looks like I am experiencing similar issues with other tools. Thanks for checking! |
np @rm3l! Feel free to ltgm :) |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rm3l, thepetk The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What does this PR do?
This PR introduces new functionality for every detector in order to ensure a consistent way of picking files for port detection. It also adds more comments, the required unit tests and updates to the documentation.
Updates
[Consistency]
The
ApplicationFileInfomodel is expanded to contain the component path and the context. That way it can be the main model used to identify files that may contain information about port detection.In every
detectorwe add theGetApplicationFileInfoswhich will return specificApplicationFileInfofor every framework.[Performance]
GenerateApplicationFileFromFiltersfunc has been created. This way we are passing a search keyword in order to go through specific files. For example, we are passing".go"for all golang frameworks as, for port detection, we are interested only for golang files.[Other Updates]
GetApplicationFileContentsandGetApplicationFileBytesin order to fetch the content of each application file asstringorbytes.typesfrom detector have been moved tomodel.goand sorted by name. This way we have a specific place to store all model's code and not have them spread around different modules.flaskdetectoranddjangodetectorto ensure that we are looping through application files and not picking them one by one.Results
With the new way of defining potential application files we need only to add an item to every detector's
GetApplicationFileInfosand not update the wholeDoPortDetectionfunc.Ensuring that all models are stored in the same place and they have detailed naming. For example, the
ServerXmlfromOpenLibertyDetectorhas been moved tomodel.goand renamed toOpenLibertyServerXml, in order to be easier identified and found.Which issue(s) does this PR fix
fixes devfile/api#1151
PR acceptance criteria
Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.
Unit/Functional tests
Documentation
How to test changes / Special notes to the reviewer