Skip to content

feat: task supervisor - #2408

Merged
Sehat1137 merged 15 commits into
ag2ai:mainfrom
fil1n:iss_1656_v2
Sep 7, 2025
Merged

Sehat1137 merged 15 commits into
ag2ai:mainfrom
fil1n:iss_1656_v2

Conversation

@fil1n

@fil1n fil1n commented Aug 3, 2025 •

Copy link
Copy Markdown
Contributor

Description

Fixes #1656

Type of change

  • New feature (a non-breaking change that adds functionality)

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
  • I have included code examples to illustrate the modifications

MISC.

PR was tested using following snippet

import asyncio
import sys
from random import randint

from pydantic import BaseModel

from faststream import FastStream
from faststream.kafka import KafkaBroker


class Message(BaseModel):
    content: str
    seconds_slept: float


broker = KafkaBroker("localhost:9092")
app = FastStream(broker)


@broker.subscriber("test-topic")
async def handle_message(msg: Message):
    print(f"test topic: {msg.content}, slept {msg.seconds_slept}")


@broker.subscriber("another-topic")
async def handle_raw_message(msg: str):
    print(f"another topic: {msg}")


@app.after_startup
async def produce_periodic_messages():
    for _ in range(10):
        seconds = 1 / randint(1, 10)
        await asyncio.sleep(seconds)
        await broker.publish(
            Message(content="test msg", seconds_slept=seconds), topic="test-topic"
        )

        seconds = 1 / randint(1, 10)
        await asyncio.sleep(seconds)
        await broker.publish(
            f"another test message {seconds} seconds", topic="another-topic"
        )


app.run()

@fil1n
fil1n requested a review from Lancetnik as a code owner August 3, 2025 17:04
@github-actions github-actions Bot added Confluent Issues related to `faststream.confluent` module AioKafka Issues related to `faststream.kafka` module NATS Issues related to `faststream.nats` module and NATS broker features Redis Issues related to `faststream.redis` module and Redis features labels Aug 3, 2025
@fil1n

fil1n commented Aug 3, 2025

Copy link
Copy Markdown
Contributor Author

Hi, @Lancetnik! I've created a new PR. Also, I’ve noticed that the test "test_logging:test_duplicates_set_formatter" sometimes fails when running all tests together, but it passes when run separately. I guess the issue is related to capturing stdout.

@Sehat1137
Sehat1137 self-requested a review August 5, 2025 09:37
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/mixins.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
Comment thread faststream/_internal/endpoint/subscriber/supervisor.py Outdated
@fil1n
fil1n requested a review from Sehat1137 August 13, 2025 16:49
@Sehat1137
Sehat1137 changed the base branch from main to dev August 22, 2025 19:03
@Sehat1137

Copy link
Copy Markdown
Collaborator

Hi, thank you. Please, rebase your changes with upstream/dev and run just mypy

@fil1n

fil1n commented Aug 24, 2025

Copy link
Copy Markdown
Contributor Author

@Sehat1137 No errors from "just mypy"

@Sehat1137 Sehat1137 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@fil1n Hi, sorry for the long replies. GitHub doesn't send me any notifications. Can we move our communication somewhere to messenger?
btw my telegram: @smqwe12

If you prefer use different channel of communication, pls share for me. We ready merge this, but i have a few questions which we can quickly resolve

@Lancetnik
Lancetnik changed the base branch from dev to main September 4, 2025 20:52
Sehat1137
Sehat1137 previously approved these changes Sep 7, 2025
Sehat1137
Sehat1137 previously approved these changes Sep 7, 2025
@Sehat1137
Sehat1137 added this pull request to the merge queue Sep 7, 2025
Merged via the queue into ag2ai:main with commit ff3ebc4 Sep 7, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AioKafka Issues related to `faststream.kafka` module Confluent Issues related to `faststream.confluent` module NATS Issues related to `faststream.nats` module and NATS broker features Redis Issues related to `faststream.redis` module and Redis features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: endless asyncio tasks hypervisor

3 participants