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: Always use buffered producers to allow multiple concurrent flow paths to use the same products #29

Merged
merged 17 commits into from
Jul 24, 2024

Conversation

j-ittner
Copy link
Member

@j-ittner j-ittner commented Jul 18, 2024

Summary

This pull request refactors the concurrent producer and transformer classes to improve the handling of shared conduits.

The refactoring ensures that shared conduits always use buffered producers to allow multiple concurrent flow paths to use the same products without re-producing them, which is essential for efficient concurrent processing.

This PR also removes the (functionally redundant) iter() and aiter() methods from the SerialTransformer class. This change simplifies the Transformer API, directing users towards the transform() and atransform() methods for data processing.

The changes include renaming methods for clarity, adding new properties, and updating the logic for iterating over concurrent producers and transformers.

Changes

  1. Method Renaming:

    • Renamed iter_concurrent_conduits to iter_concurrent_producers.
    • Renamed aiter_concurrent_conduits to aiter_concurrent_producers.
  2. Refactored Logic:

    • Updated the logic for iterating over concurrent producers and transformers to ensure proper handling of shared conduits.
    • Use _BufferedProducer and _AsyncBufferedProducer classes more widely to materialize or buffer products and allow concurrent paths use the same product instances where possible.

@j-ittner j-ittner added bug Something isn't working refactor labels Jul 18, 2024
@j-ittner j-ittner added this to the 1.0.3 milestone Jul 18, 2024
@j-ittner j-ittner self-assigned this Jul 18, 2024
Copy link
Contributor

@AlexanderLontke AlexanderLontke left a comment

Choose a reason for hiding this comment

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

Looks good to me! Behaviour is as expected.

@j-ittner j-ittner merged commit 6815c08 into 1.0.x Jul 24, 2024
11 checks passed
@j-ittner j-ittner deleted the api/transform-only-once branch July 24, 2024 13:15
breakbotz pushed a commit that referenced this pull request Jul 29, 2024
* BUILD: require unit tests and veracode to pass before release

* FIX: Always use buffered producers to allow multiple concurrent flow paths to use the same products (#29)

* API: make properties source and processor public

* API: rename attribute transformer_group to transformer

* CODE: mark true start of private definitions section

* REFACTOR: make SerialConduit.chained_conduits abstract

* REFACTOR: don't use iter_concurrent_conduits in is_valid_source()

* REFACTOR: don't use iter_concurrent_conduits in product_type

* REFACTOR: don't use iter_concurrent_conduits in is_chained

* REFACTOR: don't use iter_concurrent_conduits in FlowGraph

* API: replace (a)iter_concurrent_conduits() to …_concurrent_producers()

* TEST: add unit test ensuring conduits shared between paths run only once

* REFACTOR: move buffered producer classes to _simple.py

* DOC: remove obsolete @inheritdoc decorators

* BUILD: upgrade mypy to 1.11

* REFACTOR: eliminate aiter_concurrent_producers()

* DOC: remove an obsolete inline comment

* API: remove SerialTransformer.[a]iter()

* REFACTOR: remove obsolete [a]iter_concurrent_conduits()

* DOC: update release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants