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

Get busy workers #244

Open
github-actions bot opened this issue Jan 17, 2023 · 0 comments
Open

Get busy workers #244

github-actions bot opened this issue Jan 17, 2023 · 0 comments
Assignees
Labels

Comments

@github-actions
Copy link
Contributor

Get busy workers

Seems to be a glitch getting busy workers in this version of Celery.

Fix planned for next release Feb or March.

This might work, but isn't yet:

# TODO: Get busy workers

        return idle_workers_info

    def get_busy_workers(self) -> list[_WorkerInfo]:
        """
        Gets a WorkerInfo object for all busy workers.

        This uses Celery's API to poll active queues.
        Use the `busy_workers` property to avoid re-polling.

        Returns:
            list: List of WorkerInfo objects for all idle workers.
        """

        # TODO: Get busy workers
        # Seems to be a glitch getting busy workers in this version of Celery.
        # Fix planned for next release Feb or March.
        # This might work, but isn't yet:
        i = celery_app.control.inspect(timeout=10)
        i.pattern = self.vc_key + "*"
        i.limit = 1
        logger.debug(f"[magenta]Active: {i.active_queues()}")

        busy_workers_info = []
        return busy_workers_info

        if not busy_workers:
            return busy_workers_info

        for worker, attributes in busy_workers.items():

            worker_vc_key = attributes[0]["routing_key"]

            worker_info = _WorkerInfo(
                name=worker,
                host=str(worker).split("@")[1],
                version_constraint_key=worker_vc_key,
                compatible=worker_vc_key == self.vc_key,
            )
            busy_workers_info.append(worker_info)

        return busy_workers_info


class AppStatus:
    def __init__(self, package_name: str):

26e24bda85ba6727e5cc66313769425c999e9de8

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

No branches or pull requests

1 participant