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

Less aws requests #343

Merged
merged 4 commits into from
Oct 15, 2020
Merged

Less aws requests #343

merged 4 commits into from
Oct 15, 2020

Conversation

evansiroky
Copy link
Contributor

@evansiroky evansiroky commented Oct 3, 2020

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

This PR is built on top of #341.

This PR does a few things to reduce the amount of AWS requests that are performed as follows:

  • Don't include ec2 instance data with OtpServers in API calls to get a Project or Projects
  • Don't include ec2 instance data with OtpServers in API calls to get all servers
  • Add new endpoint for getting a single OtpServer
  • During MonitorServerStatusJobs only check instance health after waiting for 4 seconds instead of both before and after

This PR has a companion PR for the UI here: ibi-group/datatools-ui#615

@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2020

Codecov Report

Merging #343 into dev will decrease coverage by 0.07%.
The diff coverage is 2.60%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #343      +/-   ##
============================================
- Coverage     23.72%   23.65%   -0.08%     
- Complexity      545      547       +2     
============================================
  Files           172      175       +3     
  Lines          8998     9038      +40     
  Branches       1225     1226       +1     
============================================
+ Hits           2135     2138       +3     
- Misses         6654     6692      +38     
+ Partials        209      208       -1     
Flag Coverage Δ Complexity Δ
#unit_tests 23.65% <2.60%> (-0.08%) 547.00 <2.00> (+2.00) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...conveyal/datatools/common/utils/ExpiringAsset.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...l/datatools/common/utils/aws/AWSClientManager.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...atatools/common/utils/aws/CheckedAWSException.java 0.00% <ø> (ø) 0.00 <0.00> (?)
.../conveyal/datatools/common/utils/aws/EC2Utils.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...atatools/common/utils/aws/EC2ValidationResult.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../conveyal/datatools/common/utils/aws/IAMUtils.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...m/conveyal/datatools/common/utils/aws/S3Utils.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...tools/editor/controllers/api/EditorController.java 33.20% <0.00%> (-3.86%) 18.00 <0.00> (ø)
...ols/editor/controllers/api/SnapshotController.java 15.21% <0.00%> (ø) 2.00 <0.00> (ø)
...datatools/editor/jobs/ExportSnapshotToGTFSJob.java 36.95% <0.00%> (ø) 4.00 <0.00> (ø)
... and 23 more

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 3cab4b4...3b5d056. Read the comment docs.

* Usually a mixin would be used on an external class, but since we are changing one thing about a single class, it
* seemed unnecessary to define a new view.
*/
public abstract static class ProjectWithoutOtpServers {
Copy link
Contributor

@landonreed landonreed Oct 5, 2020

Choose a reason for hiding this comment

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

I don't understand why this is needed. Isn't otpServers omitted by default? The Mixin above is only needed to add the otpServers property. Also, the comment is just copy pasta.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, you're right. Not sure why I added it.


/**
* A MixIn to be applied to this OtpServer, for returning a single OtpServer, without EC2InstanceSummaries that
* don't need to be written in JSON output.
Copy link
Contributor

@landonreed landonreed Oct 5, 2020

Choose a reason for hiding this comment

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

This comment is inverted. The mixin is used to return a list of OtpServers.

Copy link
Contributor

@landonreed landonreed left a comment

Choose a reason for hiding this comment

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

Comments need some cleanup and I'm not sure that ProjectWithoutOtpServers needs to exist.

@landonreed landonreed assigned evansiroky and unassigned landonreed Oct 5, 2020
@evansiroky
Copy link
Contributor Author

I made the requested changes.

@evansiroky evansiroky assigned landonreed and unassigned evansiroky Oct 6, 2020
@codecov-io
Copy link

codecov-io commented Oct 6, 2020

Codecov Report

Merging #343 into dev will increase coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##                dev     #343   +/-   ##
=========================================
  Coverage     24.01%   24.02%           
- Complexity      560      561    +1     
=========================================
  Files           175      175           
  Lines          9055     9068   +13     
  Branches       1228     1231    +3     
=========================================
+ Hits           2175     2179    +4     
- Misses         6672     6681    +9     
  Partials        208      208           
Flag Coverage Δ Complexity Δ
#unit_tests 24.02% <50.00%> (+<0.01%) 561.00 <1.00> (+1.00)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...datatools/manager/jobs/MonitorServerStatusJob.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
...m/conveyal/datatools/manager/models/OtpServer.java 6.66% <0.00%> (-0.23%) 2.00 <0.00> (ø)
...com/conveyal/datatools/manager/models/Project.java 66.66% <ø> (ø) 6.00 <0.00> (ø)
...ools/manager/controllers/api/ServerController.java 11.32% <50.00%> (+1.74%) 2.00 <1.00> (+1.00)
...ols/manager/controllers/api/ProjectController.java 13.19% <100.00%> (+0.60%) 2.00 <0.00> (ø)

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 5f6e68e...0f7677a. Read the comment docs.

Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

The incremental changes from #341 to #343 look fine to me.

@binh-dam-ibigroup binh-dam-ibigroup removed their assignment Oct 6, 2020
@landonreed landonreed assigned evansiroky and unassigned landonreed Oct 7, 2020
@evansiroky evansiroky merged commit 6e23715 into dev Oct 15, 2020
@landonreed landonreed mentioned this pull request Oct 30, 2020
8 tasks
@landonreed
Copy link
Contributor

🎉 This PR is included in version 3.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@binh-dam-ibigroup binh-dam-ibigroup deleted the less-aws-requests branch July 10, 2023 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants