Skip to content
Snippets Groups Projects
Select Git revision
  • 36e9b3433b488d7c3bcb65fc76553ed3bc736398
  • develop default protected
  • feature/nat-1829-fix-scoped-commercial-peers
  • release/4.28
  • validate_l2_circuit
  • master protected
  • feature/NAT-1797-netbox-migration
  • authorship-fix-from-develop
  • 1048-service-config-backfilling
  • feature/nat-1211-edgeport-lacp-xmit
  • fix/nat-1120-sdp-validation
  • NAT-1154-import-edge-port-update
  • fix/l3-imports
  • feature/10GGBS-NAT-980
  • fix/NAT-1009/fix-redeploy-base-config-if-there-is-a-vprn
  • 4.27
  • 4.26
  • 4.25
  • 4.24
  • 4.23
  • 4.22
  • 4.21
  • 4.20
  • 4.19
  • 4.18
  • 4.17
  • 4.16
  • 4.15
  • 4.14
  • 4.13
  • 4.12
  • 4.11
  • 4.10
  • 4.8
  • 4.5
35 results

worker.py

Blame
  • worker.py 887 B
    """Module that sets up :term:`GSO` as a Celery worker. This will allow for the scheduling of regular task workflows."""
    
    from celery import Celery
    
    from gso import init_worker_app
    from gso.settings import load_oss_params
    
    
    class OrchestratorCelery(Celery):
        """A :term:`GSO` instance that functions as a Celery worker."""
    
        def on_init(self) -> None:  # noqa: PLR6301
            """Initialise a new Celery worker."""
            init_worker_app()
    
    
    settings = load_oss_params()
    
    celery = OrchestratorCelery(
        "worker",
        broker=settings.CELERY.broker_url,
        backend=settings.CELERY.result_backend,
        include=[
            "gso.schedules.task_vacuum",
            "gso.schedules.validate_products",
            "gso.schedules.validate_subscriptions",
        ],
    )
    
    celery.conf.update(result_expires=settings.CELERY.result_expires)
    celery.conf.update(redbeat_redis_url=settings.CELERY.broker_url)