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

🐛 [On call / 171] Source Salesforce: fixed the bug when Bulk fetch took all memory of kube pods #11692

Merged
merged 17 commits into from
Apr 13, 2022

Conversation

bazarnov
Copy link
Collaborator

@bazarnov bazarnov commented Apr 4, 2022

What

Resolving: https://github.com/airbytehq/oncall/issues/171

How

  • refactored download_data method to write the response by chunks into tmp file
  • added read_with_chunks method to read the data from tmp file by chunks (lines)
  • added test_memory unit_test to cover the case
  • edited Dockerfile to support native installation of pandas and numpy frameworks

🚨 User Impact 🚨

No impact expected.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Updating a connector

Community member or Airbyter

  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

@bazarnov bazarnov self-assigned this Apr 4, 2022
@github-actions github-actions bot added the area/connectors Connector related issues label Apr 4, 2022
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Apr 4, 2022
@bazarnov bazarnov temporarily deployed to more-secrets April 4, 2022 11:45 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 4, 2022 11:45 Inactive
@bazarnov bazarnov changed the title 🐛 [On call / 171] Source Salesforce: fixed the bug when Bulk fetch took all memory of kube pods. 🐛 [On call / 171] Source Salesforce: fixed the bug when Bulk fetch took all memory of kube pods Apr 4, 2022
@bazarnov bazarnov requested review from grubberr and annalvova05 April 4, 2022 12:03
@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@1f6eff7). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 6beb666 differs from pull request most recent head 8ce95f5. Consider uploading reports for the commit 8ce95f5 to get more accurate results

@@            Coverage Diff            @@
##             master   #11692   +/-   ##
=========================================
  Coverage          ?   88.11%           
=========================================
  Files             ?        7           
  Lines             ?      547           
  Branches          ?        0           
=========================================
  Hits              ?      482           
  Misses            ?       65           
  Partials          ?        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 1f6eff7...8ce95f5. Read the comment docs.

@bazarnov bazarnov requested a review from midavadim April 4, 2022 13:39
@bazarnov
Copy link
Collaborator Author

bazarnov commented Apr 4, 2022

/test connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/2090450627
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/2090450627
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              275    106    61%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  876    259    70%
Name                                 Stmts   Miss  Cover
--------------------------------------------------------
source_salesforce/exceptions.py          2      0   100%
source_salesforce/__init__.py            2      0   100%
source_salesforce/api.py               150     19    87%
source_salesforce/streams.py           262     54    79%
source_salesforce/rate_limiting.py      22      6    73%
source_salesforce/source.py             75     33    56%
source_salesforce/utils.py               8      7    12%
--------------------------------------------------------
TOTAL                                  521    119    77%
Name                                 Stmts   Miss  Cover
--------------------------------------------------------
source_salesforce/utils.py               8      0   100%
source_salesforce/exceptions.py          2      0   100%
source_salesforce/__init__.py            2      0   100%
source_salesforce/source.py             75      6    92%
source_salesforce/api.py               150     14    91%
source_salesforce/rate_limiting.py      22      3    86%
source_salesforce/streams.py           262     39    85%
--------------------------------------------------------
TOTAL                                  521     62    88%

@bazarnov bazarnov temporarily deployed to more-secrets April 4, 2022 14:17 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 4, 2022 14:18 Inactive
@grubberr grubberr temporarily deployed to more-secrets April 5, 2022 20:07 Inactive
@grubberr grubberr temporarily deployed to more-secrets April 5, 2022 20:07 Inactive
@grubberr
Copy link
Contributor

grubberr commented Apr 5, 2022

I have added unit_tests/test_memory.py file PLEASE REMOVE !!!

in really I still cannot see any difference

git checkout bazrnov/171-source-salesforce-oom-issue
pytest -s unit_tests/test_memory.py
first_size = 0.10 Mb, first_peak = 16.71 Mb

git checkout master
pytest -s unit_tests/test_memory.py
first_size = 0.10 Mb, first_peak = 16.71 Mb

@grubberr grubberr temporarily deployed to more-secrets April 5, 2022 20:16 Inactive
@grubberr grubberr temporarily deployed to more-secrets April 5, 2022 20:16 Inactive
github-actions bot referenced this pull request Apr 5, 2022
Signed-off-by: Sergey Chvalyuk <[email protected]>
@bazarnov
Copy link
Collaborator Author

bazarnov commented Apr 5, 2022 via email

@bazarnov bazarnov force-pushed the bazrnov/171-source-salesforce-oom-issue branch from 2885769 to 804b5f1 Compare April 8, 2022 23:22
@bazarnov bazarnov temporarily deployed to more-secrets April 8, 2022 23:24 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 12, 2022 22:45 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 12, 2022 22:45 Inactive
@bazarnov
Copy link
Collaborator Author

bazarnov commented Apr 12, 2022

/test connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/2158014423
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/2158014423
Python tests coverage:

Name                                                 Stmts   Miss  Cover
------------------------------------------------------------------------
source_acceptance_test/utils/__init__.py                 6      0   100%
source_acceptance_test/tests/__init__.py                 4      0   100%
source_acceptance_test/__init__.py                       2      0   100%
source_acceptance_test/tests/test_full_refresh.py       52      2    96%
source_acceptance_test/utils/asserts.py                 37      2    95%
source_acceptance_test/config.py                        74      6    92%
source_acceptance_test/utils/json_schema_helper.py     105     13    88%
source_acceptance_test/utils/common.py                  70     17    76%
source_acceptance_test/utils/compare.py                 62     23    63%
source_acceptance_test/tests/test_core.py              285    106    63%
source_acceptance_test/base.py                          10      4    60%
source_acceptance_test/utils/connector_runner.py       110     48    56%
source_acceptance_test/tests/test_incremental.py        69     38    45%
------------------------------------------------------------------------
TOTAL                                                  886    259    71%
Name                                 Stmts   Miss  Cover
--------------------------------------------------------
source_salesforce/__init__.py            2      0   100%
source_salesforce/exceptions.py          8      1    88%
source_salesforce/api.py               150     19    87%
source_salesforce/streams.py           282     60    79%
source_salesforce/rate_limiting.py      22      6    73%
source_salesforce/source.py             75     33    56%
source_salesforce/utils.py               8      7    12%
--------------------------------------------------------
TOTAL                                  547    126    77%
Name                                 Stmts   Miss  Cover
--------------------------------------------------------
source_salesforce/utils.py               8      0   100%
source_salesforce/__init__.py            2      0   100%
source_salesforce/source.py             75      6    92%
source_salesforce/api.py               150     14    91%
source_salesforce/exceptions.py          8      1    88%
source_salesforce/rate_limiting.py      22      3    86%
source_salesforce/streams.py           282     41    85%
--------------------------------------------------------
TOTAL                                  547     65    88%

@bazarnov bazarnov temporarily deployed to more-secrets April 12, 2022 23:02 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 12, 2022 23:02 Inactive
@bazarnov bazarnov requested a review from girarda April 13, 2022 09:15
Copy link
Contributor

@girarda girarda left a comment

Choose a reason for hiding this comment

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

small question around the TmpFileIOError's constructor, but looks good otherwise

@bazarnov bazarnov temporarily deployed to more-secrets April 13, 2022 16:59 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 13, 2022 16:59 Inactive
@bazarnov
Copy link
Collaborator Author

bazarnov commented Apr 13, 2022

/publish connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/2162692116
🚀 Successfully published connectors/source-salesforce
🚀 Auto-bumped version for connectors/source-salesforce
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/2162692116

@bazarnov bazarnov temporarily deployed to more-secrets April 13, 2022 17:14 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 13, 2022 17:14 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets April 13, 2022 17:32 Inactive
@octavia-squidington-iii octavia-squidington-iii temporarily deployed to more-secrets April 13, 2022 17:32 Inactive
@bazarnov bazarnov force-pushed the bazrnov/171-source-salesforce-oom-issue branch from cb15d1c to 8ce95f5 Compare April 13, 2022 17:33
@bazarnov bazarnov merged commit 644ace4 into master Apr 13, 2022
@bazarnov bazarnov deleted the bazrnov/171-source-salesforce-oom-issue branch April 13, 2022 17:35
@bazarnov bazarnov temporarily deployed to more-secrets April 13, 2022 17:35 Inactive
@bazarnov bazarnov temporarily deployed to more-secrets April 13, 2022 17:35 Inactive
suhomud pushed a commit that referenced this pull request May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants