giftsky.blogg.se

Python queue pool example
Python queue pool example





python queue pool example

The worker tells the system that it will begin workīy setting its status to busy and registers job in the StartedJobRegistry.Ī child process (the “work horse”) is forked off to do the actual work in If all queues are empty and the worker is running in burst mode, quit now. A job is popped from any of the given Redis queues. The worker registers itself to the system so it knows The life-cycle of a worker consists of a few phases: -maintenance-interval: defaults to 600 seconds.-max-idle-time: if specified, worker will wait for X seconds for a job to arrive before shuttind down.-dequeue-strategy: The strategy to dequeue jobs from multiple queues (one of default, random or round_robin, defaults to default).-serializer: Path to serializer object (e.g “rq.serializers.DefaultSerializer” or “rq.serializers.JSONSerializer”).-max-jobs: Maximum number of jobs to execute.-disable-job-desc-logging: Turn off job description logging.

python queue pool example

  • -date-format: Datetime format for the worker logs, defaults to '%H:%M:%S'.
  • -log-format: Format for the worker logs, defaults to '%(asctime)s %(message)s'.
  • -connection-class: Redis connection class to use, defaults to redis.StrictRedis.
  • -job-class or -j: RQ Job class to use.
  • -worker-class or -w: RQ Worker class to use (e.g rq worker -worker-class '').
  • -results-ttl: job results will be kept for this number of seconds (defaults to 500).
  • -config or -c: path to module containing RQ settings.
  • -path or -P: multiple import paths are supported (e.g rq worker -path foo -path bar).
  • -burst or -b: run worker in burst mode (stops after all jobs in queue have been processed).
  • -url or -u: URL describing Redis connection details (e.g rq worker -url or rq worker -url unix:///var/run/redis/redis.sock).
  • python queue pool example

    In addition to -burst, rq worker also accepts these arguments: Just to scale up your workers temporarily during peak periods. This can be useful for batch work that needs to be processed periodically, or *** Listening for work on high, default, low







    Python queue pool example