labthings / labthings/python-labthings

Changing `ActionView._deque.maxlen` in subclasses

オープン
#300 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
19
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

説明

Is your feature request related to a problem? Please describe.
I tried to lower the length of the ActionView _deque but could not find a way that would not result in a bug

Describe the solution you'd like

I would like to have a method to specify the ActionView queue length, ideally at the subclass definition level.

Describe alternatives you've considered
I tried:

  1. Changing the class attribute
class MyAction(ActionView):
    args = {
        "averages": fields.Integer(
            missing=20,
            example=20,
            description="Number of images to average over",
        )
    }
    # Marshal the response as a string representation of the array
    schema = fields.String()
    _deque = Deque(maxlen=10)
    ...

I believe this is rendered useless by the __init_subclass__ method.

  1. Overwritting the _deque at init:
class MyAction(ActionView):
    args = {
        "averages": fields.Integer(
            missing=20,
            example=20,
            description="Number of images to average over",
        )
    }
    # Marshal the response as a string representation of the array
    schema = fields.String()
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._deque = Deque(maxlen=10)
    ...

This solution is causing the request to hang.

I also tried subclassing __init_subclass__ (?) but to no avail.

Thanks again for your work, sorry for the spam today :)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず ActionView の実装、特に init_subclass と _deque の初期化経路を読みます。issue にあるサブクラスの例を再現し、リクエスト処理でキューがどのように使われているかを調べます。実装では、リクエストをハングさせずにサブクラスレベルでサポートされるキュー長を提供し、設定された最大値をカバーするテストを含める必要があります。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。