ocean
ocean copied to clipboard
[Core] added multiprocessing
User description
Description
What - Process each kind in a separate process.
Why -
As we can see when we run ocean with limited resources, it cannot even start to process the big amount of data - it gets terminated for OOM.
How -
Use multiprocessing module.
We can enable the multiprocessing by setting a flag. Then we Ocean loads and start a resync we can see the we get batches of data until it get terminated for OOM.
We see that the process is terminated for OOM, but the resync continues, it processing the next kind. we can also notice the RAM usage in docker and the drop when the process was terminated.
Notice that even though we had OOM events the resync completed gracefully and didnt delete entities due to the deletion threshold. We can trigger a new resync from the UI and see how it begins. Also we can notice the RAM usage drop in the docker container when a resync is finished and the spike when it begins.
Type of change
Please leave one option from the following and delete the rest:
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] New Integration (non-breaking change which adds a new integration)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Non-breaking change (fix of existing functionality that will not change current behavior)
- [ ] Documentation (added/updated documentation)
All tests should be run against the port production environment(using a testing org).
Core testing checklist
- [ ] Integration able to create all default resources from scratch
- [ ] Resync finishes successfully
- [ ] Resync able to create entities
- [ ] Resync able to update entities
- [ ] Resync able to detect and delete entities
- [ ] Scheduled resync able to abort existing resync and start a new one
- [ ] Tested with at least 2 integrations from scratch
- [ ] Tested with Kafka and Polling event listeners
- [ ] Tested deletion of entities that don't pass the selector
Integration testing checklist
- [ ] Integration able to create all default resources from scratch
- [ ] Resync able to create entities
- [ ] Resync able to update entities
- [ ] Resync able to detect and delete entities
- [ ] Resync finishes successfully
- [ ] If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the
examplesfolder in the integration directory. - [ ] If resource kind is updated, run the integration with the example data and check if the expected result is achieved
- [ ] If new resource kind is added or updated, validate that live-events for that resource are working as expected
- [ ] Docs PR link here
Preflight checklist
- [ ] Handled rate limiting
- [ ] Handled pagination
- [ ] Implemented the code in async
- [ ] Support Multi account
Screenshots
Include screenshots from your environment showing how the resources of the integration will look.
API Documentation
Provide links to the API documentation used for this integration.
PR Type
Enhancement, Tests
Description
-
Introduced multiprocessing for resource processing in sync_raw_all
- Added
run_taskandOceanTaskfor isolated resource execution - Modified resource loop to use multiprocessing.Process
- Added
-
Added new event listener type: TASK
- Implemented
TaskEventListenerand settings - Integrated into event listener factory and context
- Implemented
-
Added memory leak test for JQ processing
- Includes data generation, memory tracking, and result analysis
-
Updated fake integration to use new test server and endpoints
- Adjusted client/server ports and endpoints for isolation
Changes walkthrough 📝
| Relevant files | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 14 files
| ||||||||||||||||||||||||||||
| Tests | |||||||||||||||||||||||||||||
| Miscellaneous | 1 files
| ||||||||||||||||||||||||||||
| Additional files |
Need help?
Type /help how to ...in the comments thread for any questions about Qodo Merge usage.Check out the documentation for more information.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪ |
| 🧪 PR contains tests |
| 🔒 No security concerns identified |
⚡ Recommended focus areas for reviewProcess Management
|
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
✅
| High |
✅
| Medium | |
✅
| Low | |
| ||
This pull request is automatically being deployed by Amplify Hosting (learn more).
Access this pull request here: https://pr-1620.d1ftd8v2gowp8w.amplifyapp.com
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15142150379/artifacts/3161522054
Code Coverage Total Percentage: 80.36%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15143045705/artifacts/3161884139
Code Coverage Total Percentage: 80.35%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15143808564/artifacts/3162163307
Code Coverage Total Percentage: 80.35%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15143991869/artifacts/3162226798
Code Coverage Total Percentage: 80.35%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15144690974/artifacts/3162502172
Code Coverage Total Percentage: 80.37%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15191552762/artifacts/3178722903
Code Coverage Total Percentage: 80.57%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15235678682/artifacts/3192423348
Code Coverage Total Percentage: 80.57%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15235848135/artifacts/3192476787
Code Coverage Total Percentage: 80.57%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15250084165/artifacts/3196018289
Code Coverage Total Percentage: 80.43%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15251800566/artifacts/3196498113
Code Coverage Total Percentage: 80.4%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15251838312/artifacts/3196514421
Code Coverage Total Percentage: 80.43%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15251885354/artifacts/3196529228
Code Coverage Total Percentage: 80.43%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15256104866/artifacts/3197932764
Code Coverage Total Percentage: 80.45%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15257143292/artifacts/3198283334
Code Coverage Total Percentage: 80.46%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15257716644/artifacts/3198463579
Code Coverage Total Percentage: 80.45%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15267010023/artifacts/3201010450
Code Coverage Total Percentage: 80.41%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15267391198/artifacts/3201117473
Code Coverage Total Percentage: 80.41%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15267516459/artifacts/3201150849
Code Coverage Total Percentage: 80.41%
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/15268477340/artifacts/3201443116
Code Coverage Total Percentage: 80.41%