コード例 #1
0
def main():
    concurrency = multiprocessing.cpu_count()
    w = Worker(faktory=URL_FACTORY, queues=['default', 'busy'], concurrency=1)
    w.register('live_see_all', live_see_all)
    w.register('parse_profile', parse_profile)
    w.register('parse_posts', parse_posts)
    w.run()
コード例 #2
0
def main(faktory_url='tcp://localhost:7419', queues=['default'], concurrency=1):
    logging.info('Faktory Instance: {}'.format(faktory_url))
    logging.info('Concurrency: {}'.format(concurrency))
    logging.info('Queues: {}'.format(queues))
    w = Worker(
        faktory=faktory_url,
        queues=queues,
        concurrency=concurrency
    )
    w.register('docker', docker_runner)
    w.run()
コード例 #3
0
import logging

logging.basicConfig(level=logging.INFO)


from faktory import Worker


def your_function(x, y):
    return x + y


w = Worker(faktory="tcp://localhost:7419", queues=["default"], concurrency=1)
w.register("test", your_function)

w.run()  # runs until control-c or worker shutdown from Faktory web UI


# check examples/producer.py for how to submit tasks to be run by faktory
コード例 #4
0
from faktory import Worker
from jobs.master_environments import environments_sync
from jobs.master_facts import facts_sync
from jobs.master_nodes import nodes_sync
from jobs.master_classes import classes_sync
from jobs.matching_nodes import matching_nodes_sync

w = Worker(queues=["default"], concurrency=1)
w.register("master-environments", environments_sync)
w.register("master-facts", facts_sync)
w.register("master-nodes", nodes_sync)
w.register("master-classes", classes_sync)
w.register("group-nodes", matching_nodes_sync)
w.run()