BUG | When using Aerospike with tumbling windows, the config is not loaded

未关闭
#656 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
databases

调研方向

Start with the traceback: faust/tables/base.py (_new_store_by_url, the data property and on_start) passes the store options to faust/stores/aerospike.py, where get_aerospike_client reads aerospike_config and gets None. Check how a tumbling table's options reach the store compared with a plain table. Done means a tumbling table with Aerospike options starts without the AttributeError, with a test covering that case.

由索引模型根据 Issue 内容生成。

描述

So, I'm using the latest version of Faust with an Aerospike database for persistence. I have followed the instructions in the project's README.md, but I still get this issue with tumbling windows:

Here is my code:

sum_transactions_table = (
    app.Table(
        'transactions-sum',
        default=float,
        partitions=config.faust.partitions,
        on_window_close=window_processor,
        options={'namespace': 'default', 'client': {'hosts': [('127.0.0.1', 3000)]}},
    )
    .tumbling(
        config.faust.window_closing_time,
        expires=timedelta(hours=config.faust.window_expires),
        key_index=True
    )
)

This produces the following error output:

[2025-01-30 12:42:00,764] [10813] [ERROR] Error configuring aerospike client 'NoneType' object has no attribute 'get' 
[2025-01-30 12:42:00,764] [10813] [ERROR] [^Worker]: Error: AttributeError("'NoneType' object has no attribute 'get'") 
Traceback (most recent call last):
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/worker.py", line 277, in execute_from_commandline
    self.loop.run_until_complete(self._starting_fut)
  File "/Users/pedro/.local/share/uv/python/cpython-3.12.7-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 861, in _actually_start
    await child.maybe_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 889, in maybe_start
    await self.start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 861, in _actually_start
    await child.maybe_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 889, in maybe_start
    await self.start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 854, in _actually_start
    await self.on_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/tables/manager.py", line 142, in on_start
    await self._update_channels()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/tables/manager.py", line 158, in _update_channels
    await table.maybe_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 889, in maybe_start
    await self.start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/mode/services.py", line 854, in _actually_start
    await self.on_start()
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/tables/base.py", line 218, in on_start
    await self.add_runtime_dependency(self.data)
                                      ^^^^^^^^^
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/tables/base.py", line 213, in data
    self._data = self._new_store()
                 ^^^^^^^^^^^^^^^^^
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/tables/base.py", line 192, in _new_store
    return self._new_store_by_url(self._store or self.app.conf.store)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/tables/base.py", line 195, in _new_store_by_url
    return stores.by_url(url)(
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/stores/aerospike.py", line 70, in __init__
    raise ex
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/stores/aerospike.py", line 63, in __init__
    self.client = AeroSpikeStore.get_aerospike_client(options)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedro/Projects/poc_faust/.venv/lib/python3.12/site-packages/faust/stores/aerospike.py", line 80, in get_aerospike_client
    client_config: Dict[Any, Any] = aerospike_config.get(
                                    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Note that removing the .tumbling() method makes it work. So looks like it is not loading the config from the table.

主要语言
Python
星标
1.9k
派生
205
平均合并
2 小时 2 分钟
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

faust-streaming/faust 的其他 Issue

查看 faust-streaming/faust 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。