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

Add factories #349

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

dima-dmytruk23
Copy link

No description provided.

@@ -32,7 +34,21 @@ def from_cli(cls, args: Optional[Sequence[str]] = None) -> "SchedulerArgs":
formatter_class=ArgumentDefaultsHelpFormatter,
description="Subcommand to run scheduler",
)
parser.add_argument("scheduler", help="Path to scheduler")
parser.add_argument(
Copy link
Member

Choose a reason for hiding this comment

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

We don't need two parameters. Specify only factory. We can check if the imported scheduler is a factory after we import it.

from taskiq.abc.broker import AsyncBroker


class BrokerFactory(ABC):
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a class for that? Shouldn't just path to function be enough?

@@ -59,13 +60,24 @@ def from_cli(
"""
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument(
"broker",
"--broker",
Copy link
Member

Choose a reason for hiding this comment

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

Same question as for the scheduler.

from taskiq import TaskiqScheduler


class TaskiqSchedulerFactory(ABC):
Copy link
Member

Choose a reason for hiding this comment

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

Same question.

@dima-dmytruk23 dima-dmytruk23 marked this pull request as draft August 18, 2024 14:08
@dima-dmytruk23 dima-dmytruk23 marked this pull request as ready for review August 18, 2024 14:56
@dima-dmytruk23
Copy link
Author

@s3rius fixed

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

Successfully merging this pull request may close these issues.

2 participants