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

Faust shouldn't force an origin and/or re-attempt autodiscovery #737

Open
2 tasks done
kurtrwall opened this issue Sep 2, 2021 · 1 comment
Open
2 tasks done

Comments

@kurtrwall
Copy link

kurtrwall commented Sep 2, 2021

Checklist

  • I have included information about relevant versions
  • I have verified that the issue persists when using the master branch of Faust.

Steps to reproduce

I have figured out that the autodiscover feature option of passing a list of modules to find has a bug in the _finalize_concrete_app method. When that method is invoked, the app has already loaded the autodiscovery modules given. More to the bug, that method uses the sys.argv[0] argument as the origin of the App. When the App is loaded again, it has the origin set which triggers the behavior of autodiscovery at the origin. In the following case, that means I cannot narrow down what subpackages I want to load from where the App lives.

  1. Create a package with a module that has a __main__.py that passes a list of modules for the Faust app to autodiscover.
    # directory structure
    # pkg
    # | __init__.py
    # | __main__.py
    # | subpkg1
    # | | __init__.py
    # | | agent.py
    # | | models.py
    # | subpkg2
    # | | __init__.py
    # | | agent.py
    # | | models.py
    
    # __main__.py
    from faust import App
    subpkgs = get_subpkgs()  # returns subpackages to load
    app = App(..., autodiscover=subpkgs)
    app.main()
  2. Invoke the pkg for a specific subpackage to load
    $ python -m pkg --subpkg subpkg1 agents
  3. You should see all the agents from every subpackage print out, indicating it's loading everything.

Expected behavior

I expect that only the subpackages I give to the autodiscover parameter of App will be loaded.

Actual behavior

Everything under pkg is loaded.

Versions

  • Python version 3.8.5
  • Faust version 1.10.4
  • Operating system Mac OSX 11.5.2
  • Kafka version 2.5.0
  • RocksDB version (if applicable)
@bobh66
Copy link
Contributor

bobh66 commented Sep 4, 2021

This project appears to have been abandoned.

You might want to check out the fork of this project - https://github.com/faust-streaming/faust

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants