bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def __init__(self, processes=None, initializer=None, initargs=(), maxtasksperchild=None, timeout=None, soft_timeout=None): self._setup_queues() self._taskqueue = Queue.Queue() self._cache = {} self._state = RUN self.timeout = timeout self.soft_timeout = soft_timeout self._maxtasksperchild = maxtasksperchild self._initi... | def __init__(self, processes=None, initializer=None, initargs=(), maxtasksperchild=None, timeout=None, soft_timeout=None): self._setup_queues() self._taskqueue = Queue.Queue() self._cache = {} self._state = RUN self.timeout = timeout self.soft_timeout = soft_timeout self._maxtasksperchild = maxtasksperchild self._initi... | 445,600 |
def __init__(self, processes=None, initializer=None, initargs=(), maxtasksperchild=None, timeout=None, soft_timeout=None): self._setup_queues() self._taskqueue = Queue.Queue() self._cache = {} self._state = RUN self.timeout = timeout self.soft_timeout = soft_timeout self._maxtasksperchild = maxtasksperchild self._initi... | def __init__(self, processes=None, initializer=None, initargs=(), maxtasksperchild=None, timeout=None, soft_timeout=None): self._setup_queues() self._taskqueue = Queue.Queue() self._cache = {} self._state = RUN self.timeout = timeout self.soft_timeout = soft_timeout self._maxtasksperchild = maxtasksperchild self._initi... | 445,601 |
def _create_worker_process(self): w = self.Process( target=worker, args=(self._inqueue, self._outqueue, self._ackqueue, self._initializer, self._initargs, self._maxtasksperchild), ) self._pool.append(w) w.name = w.name.replace('Process', 'PoolWorker') w.daemon = True w.start() return w | def _create_worker_process(self): w = self.Process( target=worker, args=(self._inqueue, self._outqueue, self._initializer, self._initargs, self._maxtasksperchild), ) self._pool.append(w) w.name = w.name.replace('Process', 'PoolWorker') w.daemon = True w.start() return w | 445,602 |
def _join_exited_workers(self): """Cleanup after any worker processes which have exited due to reaching their specified lifetime. Returns True if any workers were cleaned up. """ for i in reversed(range(len(self._pool))): worker = self._pool[i] if worker.exitcode is not None: # worker exited debug('cleaning up worker %... | def _join_exited_workers(self): """Cleanup after any worker processes which have exited due to reaching their specified lifetime. Returns True if any workers were cleaned up. """ for i in reversed(range(len(self._pool))): worker = self._pool[i] if worker.exitcode is not None: # worker exited debug('cleaning up worker %... | 445,603 |
def _setup_queues(self): from multiprocessing.queues import SimpleQueue self._inqueue = SimpleQueue() self._outqueue = SimpleQueue() self._ackqueue = SimpleQueue() self._quick_put = self._inqueue._writer.send self._quick_get = self._outqueue._reader.recv self._quick_get_ack = self._ackqueue._reader.recv | def _setup_queues(self): from multiprocessing.queues import SimpleQueue self._inqueue = SimpleQueue() self._outqueue = SimpleQueue() self._quick_put = self._inqueue._writer.send self._quick_get = self._outqueue._reader.recv self._quick_get_ack = self._ackqueue._reader.recv | 445,604 |
def _setup_queues(self): from multiprocessing.queues import SimpleQueue self._inqueue = SimpleQueue() self._outqueue = SimpleQueue() self._ackqueue = SimpleQueue() self._quick_put = self._inqueue._writer.send self._quick_get = self._outqueue._reader.recv self._quick_get_ack = self._ackqueue._reader.recv | def _setup_queues(self): from multiprocessing.queues import SimpleQueue self._inqueue = SimpleQueue() self._outqueue = SimpleQueue() self._ackqueue = SimpleQueue() self._quick_put = self._inqueue._writer.send self._quick_get = self._outqueue._reader.recv self._quick_get_ack = self._ackqueue._reader.recv | 445,605 |
def join(self): assert self._state in (CLOSE, TERMINATE) self._worker_handler.join() self._task_handler.join() self._result_handler.join() for p in self._pool: p.join() debug('after join()') | def join(self): assert self._state in (CLOSE, TERMINATE) self._worker_handler.join() self._task_handler.join() self._result_handler.join() for i, p in enumerate(self._pool): debug('joining worker %s/%s (%r)' % (i, len(self._pool), p, )) p.join() debug('after join()') | 445,606 |
def join(self): assert self._state in (CLOSE, TERMINATE) self._worker_handler.join() self._task_handler.join() self._result_handler.join() for p in self._pool: p.join() debug('after join()') | def join(self): assert self._state in (CLOSE, TERMINATE) self._worker_handler.join() self._task_handler.join() self._result_handler.join() for p in self._pool: p.join() debug('after join()') | 445,607 |
def _terminate_pool(cls, taskqueue, inqueue, outqueue, ackqueue, pool, ack_handler, worker_handler, task_handler, result_handler, cache, timeout_handler): | def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, worker_handler, task_handler, result_handler, cache, timeout_handler): | 445,608 |
def _terminate_pool(cls, taskqueue, inqueue, outqueue, ackqueue, pool, ack_handler, worker_handler, task_handler, result_handler, cache, timeout_handler): | def _terminate_pool(cls, taskqueue, inqueue, outqueue, ackqueue, pool, ack_handler, worker_handler, task_handler, result_handler, cache, timeout_handler): | 445,609 |
def _terminate_pool(cls, taskqueue, inqueue, outqueue, ackqueue, pool, ack_handler, worker_handler, task_handler, result_handler, cache, timeout_handler): | def _terminate_pool(cls, taskqueue, inqueue, outqueue, ackqueue, pool, ack_handler, worker_handler, task_handler, result_handler, cache, timeout_handler): | 445,610 |
def __init__(self, cache, callback, accept_callback=None, timeout_callback=None, error_callback=None): self._cond = threading.Condition(threading.Lock()) self._job = job_counter.next() self._cache = cache self._accepted = False self._accept_pid = None self._time_accepted = None self._ready = False self._callback = call... | def __init__(self, cache, callback, accept_callback=None, timeout_callback=None, error_callback=None): self._cond = threading.Condition(threading.Lock()) self._job = job_counter.next() self._cache = cache self._ready = False self._callback = callback self._errback = error_callback self._accept_callback = accept_callbac... | 445,611 |
def __init__(self, cache, callback, accept_callback=None, timeout_callback=None, error_callback=None): self._cond = threading.Condition(threading.Lock()) self._job = job_counter.next() self._cache = cache self._accepted = False self._accept_pid = None self._time_accepted = None self._ready = False self._callback = call... | def __init__(self, cache, callback, accept_callback=None, timeout_callback=None, error_callback=None): self._cond = threading.Condition(threading.Lock()) self._job = job_counter.next() self._cache = cache self._accepted = False self._accept_pid = None self._time_accepted = None self._ready = False self._callback = call... | 445,612 |
def _set(self, i, obj): self._success, self._value = obj if self._callback and self._success: self._callback(self._value) if self._errback and not self._success: self._errback(self._value) self._cond.acquire() try: self._ready = True self._cond.notify() finally: self._cond.release() if self._accepted: del self._cache[s... | def _set(self, i, obj): self._success, self._value = obj if self._callback and self._success: self._callback(self._value) if self._errback and not self._success: self._errback(self._value) self._cond.acquire() try: self._ready = True self._cond.notify() finally: self._cond.release() if self._accepted: del self._cache[s... | 445,613 |
def _ack(self, i, time_accepted, pid): self._accepted = True self._time_accepted = time_accepted self._accept_pid = pid if self._accept_callback: self._accept_callback() if self._ready: del self._cache[self._job] | def _ack(self, i, time_accepted, pid): self._accepted = True self._time_accepted = time_accepted self._worker_pid = pid if self._accept_callback: self._accept_callback() if self._ready: del self._cache[self._job] | 445,614 |
def _ack(self, i, time_accepted, pid): self._accepted = True self._time_accepted = time_accepted self._accept_pid = pid if self._accept_callback: self._accept_callback() if self._ready: del self._cache[self._job] | def _ack(self, i, time_accepted, pid): self._accepted = True self._time_accepted = time_accepted self._accept_pid = pid if self._accept_callback: self._accept_callback() if self._ready: del self._cache[self._job] | 445,615 |
def _set(self, i, success_result): success, result = success_result if success: self._value[i*self._chunksize:(i+1)*self._chunksize] = result self._number_left -= 1 if self._number_left == 0: if self._callback: self._callback(self._value) del self._cache[self._job] self._cond.acquire() try: self._ready = True self._con... | def _set(self, i, success_result): success, result = success_result if success: self._value[i*self._chunksize:(i+1)*self._chunksize] = result self._number_left -= 1 if self._number_left == 0: if self._callback: self._callback(self._value) if self._accepted: self._cache.pop(self._job, None) self._cond.acquire() try: sel... | 445,616 |
def _set(self, i, success_result): success, result = success_result if success: self._value[i*self._chunksize:(i+1)*self._chunksize] = result self._number_left -= 1 if self._number_left == 0: if self._callback: self._callback(self._value) del self._cache[self._job] self._cond.acquire() try: self._ready = True self._con... | def _set(self, i, success_result): success, result = success_result if success: self._value[i*self._chunksize:(i+1)*self._chunksize] = result self._number_left -= 1 if self._number_left == 0: if self._callback: self._callback(self._value) if self._accepted: self._cache.pop(self._job, None) self._cond.acquire() try: sel... | 445,617 |
def _setup_queues(self): self._inqueue = Queue.Queue() self._outqueue = Queue.Queue() self._ackqueue = Queue.Queue() self._quick_put = self._inqueue.put self._quick_get = self._outqueue.get self._quick_get_ack = self._ackqueue.get | def _setup_queues(self): self._inqueue = Queue.Queue() self._outqueue = Queue.Queue() self._quick_put = self._inqueue.put self._quick_get = self._outqueue.get self._quick_get_ack = self._ackqueue.get | 445,618 |
def _setup_queues(self): self._inqueue = Queue.Queue() self._outqueue = Queue.Queue() self._ackqueue = Queue.Queue() self._quick_put = self._inqueue.put self._quick_get = self._outqueue.get self._quick_get_ack = self._ackqueue.get | def _setup_queues(self): self._inqueue = Queue.Queue() self._outqueue = Queue.Queue() self._ackqueue = Queue.Queue() self._quick_put = self._inqueue.put self._quick_get = self._outqueue.get self._quick_get_ack = self._ackqueue.get | 445,619 |
def maybe_conn_error(self, predicate, fun): if predicate: try: fun() except Exception: # TODO kombu.connection_errors pass | def maybe_conn_error(self, predicate, fun): if predicate: try: fun() except Exception: # TODO kombu.connection_errors pass | 445,620 |
def close_connection(self): self.logger.debug("CarrotListener: " "Closing consumer channel...") self.task_consumer = self.maybe_conn_error(self.task_consumer, self.task_consumer.close) self.logger.debug("CarrotListener: " "Closing connection to broker...") self.connection = self.maybe_conn_error(self.connection, self.c... | def close_connection(self): self.logger.debug("CarrotListener: " "Closing consumer channel...") if self.task_consumer: self.task_consumer = \ self.maybe_conn_error(self.task_consumer.close) self.logger.debug("CarrotListener: " "Closing connection to broker...") self.connection = self.maybe_conn_error(self.connection, s... | 445,621 |
def close_connection(self): self.logger.debug("CarrotListener: " "Closing consumer channel...") self.task_consumer = self.maybe_conn_error(self.task_consumer, self.task_consumer.close) self.logger.debug("CarrotListener: " "Closing connection to broker...") self.connection = self.maybe_conn_error(self.connection, self.c... | def close_connection(self): self.logger.debug("CarrotListener: " "Closing consumer channel...") self.task_consumer = self.maybe_conn_error(self.task_consumer, self.task_consumer.close) self.logger.debug("CarrotListener: " "Closing connection to broker...") self.connection = self.maybe_conn_error(self.connection, self.c... | 445,622 |
def stop_consumers(self, close=True): """Stop consuming.""" if not self._state == RUN: return self._state = CLOSE | def stop_consumers(self, close=True): """Stop consuming.""" if not self._state == RUN: return self._state = CLOSE | 445,623 |
def stop_consumers(self, close=True): """Stop consuming.""" if not self._state == RUN: return self._state = CLOSE | def stop_consumers(self, close=True): """Stop consuming.""" if not self._state == RUN: return self._state = CLOSE | 445,624 |
def send(self, type, **fields): """Send event. | def send(self, type, **fields): """Send event. | 445,625 |
def __iter__(self): """The iterator yields the time to sleep for between runs.""" | def __iter__(self): """The iterator yields the time to sleep for between runs.""" | 445,626 |
def ghdocs(options): builtdocs = sphinx_builddir(options) sh("sphinx-to-github", cwd=builtdocs) sh("git checkout gh-pages && \ cp -r '%s/*' . && \ git commit . -m 'Rendered documentation for Github Pages.' && \ git push origin gh-pages && \ git checkout master" % builtdocs) | def ghdocs(options): builtdocs = sphinx_builddir(options) sh("sphinx-to-github", cwd=builtdocs) sh("git checkout gh-pages && \ cp -r %s/* . && \ git commit . -m 'Rendered documentation for Github Pages.' && \ git push origin gh-pages && \ git checkout master" % builtdocs) | 445,627 |
def run_clockservice(loglevel=conf.CELERYBEAT_LOG_LEVEL, logfile=conf.CELERYBEAT_LOG_FILE, schedule=conf.CELERYBEAT_SCHEDULE_FILENAME, **kwargs): """Starts the celerybeat clock server.""" print("celerybeat %s is starting." % __version__) # Setup logging if not isinstance(loglevel, int): loglevel = conf.LOG_LEVELS[log... | def run_clockservice(loglevel=conf.CELERYBEAT_LOG_LEVEL, logfile=conf.CELERYBEAT_LOG_FILE, schedule=conf.CELERYBEAT_SCHEDULE_FILENAME, **kwargs): """Starts the celerybeat clock server.""" print("celerybeat %s is starting." % __version__) # Setup logging if not isinstance(loglevel, int): loglevel = conf.LOG_LEVELS[log... | 445,628 |
def update(self, fields, **extra): for field_name, field_value in dict(fields, **extra).items(): setattr(self, field_name, field_value) | def update(self, fields, **extra): for field_name, field_value in dict(fields, **extra).items(): setattr(self, field_name, field_value) | 445,629 |
def alive(self): return (self.heartbeats and time.time() < self.heartbeats[0] + HEARTBEAT_EXPIRE) | def alive(self): return (self.heartbeats and time.time() < self.heartbeats[0] + HEARTBEAT_EXPIRE) | 445,630 |
def set_process_status(self, prog, info=""): prog = "%s:%s" % (self.prog_name, prog) info = "%s %s" % (info, platforms.strargv(sys.argv)) return platform.set_process_title(prog, info=info) | def set_process_status(self, prog, info=""): prog = "%s:%s" % (self.prog_name, prog) info = "%s %s" % (info, platforms.strargv(sys.argv)) return platform.set_process_title(prog, info=info) | 445,631 |
def callback(message_data, message): results.append(message_data) | def callback(message_data, message): results.append(message_data) | 445,632 |
def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None): assert maxtasks is None or (type(maxtasks) == int and maxtasks > 0) pid = os.getpid() put = outqueue.put get = inqueue.get if hasattr(inqueue, '_writer'): inqueue._writer.close() outqueue._reader.close() if initializer is not None: initialize... | def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None): assert maxtasks is None or (type(maxtasks) == int and maxtasks > 0) pid = os.getpid() put = outqueue.put get = inqueue.get if hasattr(inqueue, '_writer'): inqueue._writer.close() outqueue._reader.close() if initializer is not None: initialize... | 445,633 |
def format_declare_queue(ret): return "ok. queue:%s messages:%s consumers:%s." % ret | def format_declare_queue(ret): return "ok. queue:%s messages:%s consumers:%s." % ret | 445,634 |
def parseline(self, line): """Parse input line. | def parseline(self, line): """Parse input line. | 445,635 |
def prompt(self): return self.prompt_fmt % self.counter() | def prompt(self): return self.prompt_fmt % self.counter() | 445,636 |
def upgrade_and_install(install): def run(self, *args, **kwargs): Upgrade().run() install.run(self, *args, **kwargs) | class upgrade_and_install(install): def run(self, *args, **kwargs): Upgrade().run() install.run(self, *args, **kwargs) | 445,637 |
def remaining(start, ends_in, now=None, relative=True): """Calculate the remaining time for a start date and a timedelta. E.g. "how many seconds left for 30 seconds after ``start``?" :param start: Start :class:`datetime.datetime`. :param ends_in: The end delta as a :class:`datetime.timedelta`. :keyword relative: If ... | def remaining(start, ends_in, now=None, relative=True): """Calculate the remaining time for a start date and a timedelta. E.g. "how many seconds left for 30 seconds after ``start``?" :param start: Start :class:`datetime.datetime`. :param ends_in: The end delta as a :class:`datetime.timedelta`. :keyword relative: If ... | 445,638 |
def _repopulate_pool(self): """Bring the number of pool processes up to the specified number, for use after reaping workers which have exited. """ debug('repopulating pool') for i in range(self._processes - len(self._pool)): if self._state != RUN: return self._create_worker_process() debug('added worker') | def _repopulate_pool(self): """Bring the number of pool processes up to the specified number, for use after reaping workers which have exited. """ for i in range(self._processes - len(self._pool)): if self._state != RUN: return self._create_worker_process() debug('added worker') | 445,639 |
def test_gt(self): self.assertGreater(states.SUCCESS, states.PENDING) self.assertGreater(states.FAILURE, states.RECEIVED) self.assertGreater(states.REVOKED, states.STARTED) self.assertGreater(states.SUCCESS, states.state("CRASHED")) self.assertGreater(states.FAILURE, states.state("CRASHED")) self.assertFalse(states.REV... | def test_gt(self): self.assertGreater(states.SUCCESS, states.PENDING) self.assertGreater(states.FAILURE, states.RECEIVED) self.assertGreater(states.REVOKED, states.STARTED) self.assertGreater(states.SUCCESS, states.state("CRASHED")) self.assertGreater(states.FAILURE, states.state("CRASHED")) self.assertFalse(states.REV... | 445,640 |
def test_freeze_thaw__buffering(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) self.assertTrue(s._buffering) | def test_freeze_thaw__buffering(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) self.assertTrue(s._buffering) | 445,641 |
def test_thaw__no_replay(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) | def test_thaw__no_replay(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) | 445,642 |
def work(): r.play() self.assertStateEmpty(s) | def work(): r.play() self.assertStateEmpty(s) | 445,643 |
def wait_for(self, task_id, timeout=None, cache=True): if task_id in self._cache: cached_meta = self._cache[task_id] | def wait_for(self, task_id, timeout=None, cache=True): if task_id in self._cache: cached_meta = self._cache[task_id] | 445,644 |
def import_from_cwd(self, module, imp=import_module): """Import module, but make sure it finds modules located in the current directory. | def import_from_cwd(self, module, imp=None): """Import module, but make sure it finds modules located in the current directory. | 445,645 |
def test_regular_task(self): T1 = self.createTaskCls("T1", "c.unittest.t.t1") self.assertIsInstance(T1(), T1) self.assertTrue(T1().run()) self.assertTrue(callable(T1()), "Task class is callable()") self.assertTrue(T1()(), "Task class runs run() when called") | def test_regular_task(self): T1 = self.createTaskCls("T1", "c.unittest.t.t1") self.assertIsInstance(T1(), T1) self.assertTrue(T1().run()) self.assertTrue(callable(T1()), "Task class is callable()") self.assertTrue(T1()(), "Task class runs run() when called") | 445,646 |
def test_regular_task(self): T1 = self.createTaskCls("T1", "c.unittest.t.t1") self.assertIsInstance(T1(), T1) self.assertTrue(T1().run()) self.assertTrue(callable(T1()), "Task class is callable()") self.assertTrue(T1()(), "Task class runs run() when called") | def test_regular_task(self): T1 = self.createTaskCls("T1", "c.unittest.t.t1") self.assertIsInstance(T1(), T1) self.assertTrue(T1().run()) self.assertTrue(callable(T1()), "Task class is callable()") self.assertTrue(T1()(), "Task class runs run() when called") | 445,647 |
def test_regular_task(self): T1 = self.createTaskCls("T1", "c.unittest.t.t1") self.assertIsInstance(T1(), T1) self.assertTrue(T1().run()) self.assertTrue(callable(T1()), "Task class is callable()") self.assertTrue(T1()(), "Task class runs run() when called") | def test_regular_task(self): T1 = self.createTaskCls("T1", "c.unittest.t.t1") self.assertIsInstance(T1(), T1) self.assertTrue(T1().run()) self.assertTrue(callable(T1()), "Task class is callable()") self.assertTrue(T1()(), "Task class runs run() when called") | 445,648 |
def _stop(signum, frame): if multiprocessing.current_process().name == 'MainProcess': worker.logger.warn("celeryd: Cold shutdown (%s)" % \ (current_process().name)) worker.terminate() raise SystemExit() | def _stop(signum, frame): process_name = multiprocessing.current_process().name if process_name == "MainProcess": worker.logger.warn("celeryd: Cold shutdown (%s)" % ( process_name)) worker.terminate() raise SystemExit() | 445,649 |
def test_route_for_task_expanded_route(self): expand = E(conf.QUEUES) route = routes.MapRoute({"celery.ping": "foo"}) self.assertDictContainsSubset(a_queue, expand(route.route_for_task("celery.ping"))) self.assertIsNone(route.route_for_task("celery.awesome")) | def test_route_for_task_expanded_route(self): expand = E(conf.QUEUES) route = routes.MapRoute({"celery.ping": {"queue": "foo"}}) self.assertDictContainsSubset(a_queue, expand(route.route_for_task("celery.ping"))) self.assertIsNone(route.route_for_task("celery.awesome")) | 445,650 |
def test_expand_route_not_found(self): expand = E(conf.QUEUES) route = routes.MapRoute({"a": "x"}) self.assertRaises(QueueNotFound, expand, route.route_for_task("a")) | def test_expand_route_not_found(self): expand = E(conf.QUEUES) route = routes.MapRoute({"a": {"queue": "x"}}) self.assertRaises(QueueNotFound, expand, route.route_for_task("a")) | 445,651 |
def test_lookup_takes_first(self): R = routes.prepare(({"celery.ping": "bar"}, {"celery.ping": "foo"})) router = routes.Router(R, conf.QUEUES) self.assertDictContainsSubset(b_queue, router.route({}, "celery.ping", args=[1, 2], kwargs={})) | def test_lookup_takes_first(self): R = routes.prepare(({"celery.ping": {"queue": "bar"}}, {"celery.ping": {"queue": "foo"}})) router = routes.Router(R, conf.QUEUES) self.assertDictContainsSubset(b_queue, router.route({}, "celery.ping", args=[1, 2], kwargs={})) | 445,652 |
def test_lookup_paths_traversed(self): R = routes.prepare(({"celery.xaza": "bar"}, {"celery.ping": "foo"})) router = routes.Router(R, conf.QUEUES) self.assertDictContainsSubset(a_queue, router.route({}, "celery.ping", args=[1, 2], kwargs={})) self.assertEqual(router.route({}, "celery.poza"), {}) | def test_lookup_paths_traversed(self): R = routes.prepare(({"celery.xaza": {"queue": "bar"}}, {"celery.ping": {"queue": "foo"}})) router = routes.Router(R, conf.QUEUES) self.assertDictContainsSubset(a_queue, router.route({}, "celery.ping", args=[1, 2], kwargs={})) self.assertEqual(router.route({}, "celery.poza"), {}) | 445,653 |
def _set_query(self, query): self._query = query | def _set_query(self, query): self._query = query | 445,654 |
def run(self): print("celery@%s v%s is starting." % (self.hostname, celery.__version__)) | def run(self): print("celery@%s v%s is starting." % (self.hostname, celery.__version__)) | 445,655 |
def apply(self, args=None, kwargs=None, **options): """Execute this task at once, by blocking until the task has finished executing. | def apply(self, args=None, kwargs=None, **options): """Execute this task locally, by blocking until the task has finished executing. | 445,656 |
def __init__(self, expires=conf.TASK_RESULT_EXPIRES, backend=conf.CELERY_CACHE_BACKEND, options={}, **kwargs): super(CacheBackend, self).__init__(self, **kwargs) if isinstance(expires, timedelta): expires = timeutils.timedelta_seconds(expires) self.expires = expires self.options = dict(conf.CELERY_CACHE_BACKEND_OPTIONS... | def __init__(self, expires=conf.TASK_RESULT_EXPIRES, backend=conf.CELERY_CACHE_BACKEND, options={}, **kwargs): super(CacheBackend, self).__init__(self, **kwargs) if isinstance(expires, timedelta): expires = timeutils.timedelta_seconds(expires) self.expires = expires self.options = dict(conf.CELERY_CACHE_BACKEND_OPTIONS... | 445,657 |
def apply_async(self, connect_timeout=conf.BROKER_CONNECTION_TIMEOUT): """Run all tasks in the taskset. | def apply_async(self, connect_timeout=conf.BROKER_CONNECTION_TIMEOUT): """Run all tasks in the taskset. | 445,658 |
def map(cls, func, args, timeout=None): """Distribute processing of the arguments and collect the results.""" remote_task = cls.remote_execute(func, args) return remote_task.run().join(timeout=timeout) | def map(cls, func, args, timeout=None): """Distribute processing of the arguments and collect the results.""" remote_task = cls.remote_execute(func, args) return remote_task.run().join(timeout=timeout) | 445,659 |
def send(self, type, **fields): """Send event. | def send(self, type, **fields): """Send event. | 445,660 |
def is_due(self, last_run_at): """Returns tuple of two items ``(is_due, next_time_to_run)``, where next time to run is in seconds. | def is_due(self, last_run_at): """Returns tuple of two items ``(is_due, next_time_to_run)``, where next time to run is in seconds. | 445,661 |
def eventtop(): sys.stderr.write("-> celeryev: starting capture...\n") state = State() cam = ModelCamera(state) cam.install() display = CursesMonitor(state) display.init_screen() refresher = DisplayThread(display) refresher.start() conn = establish_connection() recv = EventReceiver(conn, handlers={"*": state.event}) tr... | def eventtop(): sys.stderr.write("-> celeryev: starting capture...\n") state = State() display = CursesMonitor(state) display.init_screen() refresher = DisplayThread(display) refresher.start() conn = establish_connection() recv = EventReceiver(conn, handlers={"*": state.event}) try: recv.capture(limit=None) except Exce... | 445,662 |
def dump_message(message): if message is None: return "No messages in queue. basic.publish something." return {"body": message.body, "properties": message.properties, "delivery_info": message.delivery_info} | def dump_message(message): if message is None: return "No messages in queue. basic.publish something." return {"body": message.body, "properties": message.properties, "delivery_info": message.delivery_info} | 445,663 |
def dump_message(message): if message is None: return "No messages in queue. basic.publish something." return {"body": message.body, "properties": message.properties, "delivery_info": message.delivery_info} | def dump_message(message): if message is None: return "No messages in queue. basic.publish something." return {"body": message.body, "properties": message.properties, "delivery_info": message.delivery_info} | 445,664 |
def multi_args(p, cmd="celeryd", prefix="", suffix=""): names = p.values options = dict(p.options) ranges = len(names) == 1 if ranges: names = map(str, range(1, int(names[0]) + 1)) prefix = "celery" cmd = options.pop("--cmd", cmd) hostname = options.pop("--hostname", options.pop("-n", socket.gethostname())) prefix = op... | def multi_args(p, cmd="celeryd", cmd_suffix="", prefix="", suffix=""): names = p.values options = dict(p.options) ranges = len(names) == 1 if ranges: names = map(str, range(1, int(names[0]) + 1)) prefix = "celery" cmd = options.pop("--cmd", cmd) hostname = options.pop("--hostname", options.pop("-n", socket.gethostname(... | 445,665 |
def multi_args(p, cmd="celeryd", prefix="", suffix=""): names = p.values options = dict(p.options) ranges = len(names) == 1 if ranges: names = map(str, range(1, int(names[0]) + 1)) prefix = "celery" cmd = options.pop("--cmd", cmd) hostname = options.pop("--hostname", options.pop("-n", socket.gethostname())) prefix = op... | def multi_args(p, cmd="celeryd", prefix="", suffix=""): names = p.values options = dict(p.options) ranges = len(names) == 1 if ranges: names = map(str, range(1, int(names[0]) + 1)) prefix = "celery" cmd = options.pop("--cmd", cmd) hostname = options.pop("--hostname", options.pop("-n", socket.gethostname())) prefix = op... | 445,666 |
def alert_callback(my, mx): y = count(2).next task = self.state.tasks[self.selected_task] for line in task.traceback.split("\n"): self.win.addstr(y(), 3, line) | def alert_callback(my, mx): y = count(2).next task = self.state.tasks[self.selected_task] result = getattr(task, "result", None) or getattr(task, "exception", None) for line in wrap(result, mx - 2): self.win.addstr(y(), 3, line) | 445,667 |
def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | 445,668 |
def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | 445,669 |
def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | 445,670 |
def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | 445,671 |
def run(self): debug('ack handler starting') get = self.get cache = self.cache | def run(self): debug('ack handler starting') get = self.get cache = self.cache | 445,672 |
def run(self): debug('ack handler starting') get = self.get cache = self.cache | def run(self): debug('ack handler starting') get = self.get cache = self.cache | 445,673 |
def run(self): debug('ack handler starting') get = self.get cache = self.cache | def run(self): debug('ack handler starting') get = self.get cache = self.cache | 445,674 |
def enter(self, entry, eta, priority=None): if not self.running: self.start() return self.schedule.enter(entry, eta, priority) | def enter(self, entry, eta, priority=None): if not self.running and not self.is_alive(): self.start() return self.schedule.enter(entry, eta, priority) | 445,675 |
def upgrade_and_install(install): def run(self, *args, **kwargs): Upgrade().run() install.run(self, *args, **kwargs) | class upgrade_and_install(install): def run(self, *args, **kwargs): Upgrade().run() install.run(self, *args, **kwargs) | 445,676 |
def resolve_loader(loader): loader = LOADER_ALIASES.get(loader, loader) loader_module_name, _, loader_cls_name = rpartition(loader, ".") if first_letter(loader_cls_name) not in string.uppercase: warnings.warn(DeprecationWarning( "CELERY_LOADER now needs loader class name, e.g. %s.%s" % ( loader, DEFAULT_LOADER_CLASS_NA... | def resolve_loader(loader): loader = LOADER_ALIASES.get(loader, loader) loader_module_name, _, loader_cls_name = rpartition(loader, ".") if first_letter(loader_cls_name) not in string.uppercase: warnings.warn(DeprecationWarning( "CELERY_LOADER now needs loader class name, e.g. %s.%s" % ( loader, _DEFAULT_LOADER_CLASS_N... | 445,677 |
def utf8dict(self, tup): """With a dict's items() tuple return a new dict with any utf-8 keys/values encoded.""" return dict((key.encode("utf-8"), maybe_utf8(value)) for key, value in tup) | def utf8dict(tup): """With a dict's items() tuple return a new dict with any utf-8 keys/values encoded.""" return dict((key.encode("utf-8"), maybe_utf8(value)) for key, value in tup) | 445,678 |
def start_scheduler(self): from celery.log import setup_logger logger = setup_logger(self.loglevel, self.logfile) beat = ClockService(logger, schedule_filename=self.schedule) | def start_scheduler(self): from celery.log import setup_logger logger = setup_logger(self.loglevel, self.logfile) beat = ClockService(logger, schedule_filename=self.schedule) | 445,679 |
def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | 445,680 |
def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | 445,681 |
def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | def remaining_estimate(self, last_run_at): """Returns when the periodic task should run next as a timedelta.""" weekday = last_run_at.isoweekday() execute_this_hour = (weekday in self.day_of_week and last_run_at.hour in self.hour and last_run_at.minute < max(self.minute)) | 445,682 |
def registered_tasks(self): return self._request("dump_registered_tasks") | def registered_tasks(self): return self._request("dump_registered_tasks") | 445,683 |
def __init__(self, *args, **kwargs): pass | def __init__(self, *args, **kwargs): pass | 445,684 |
def test_set_process_status(self): prev1, sys.argv = sys.argv, ["Arg0"] try: st = cd.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running", st) prev2, sys.argv = sys.argv, ["Arg0", "Arg1"] try: st = cd.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running", st) s... | def test_set_process_status(self): prev1, sys.argv = sys.argv, ["Arg0"] try: st = worker.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running", st) prev2, sys.argv = sys.argv, ["Arg0", "Arg1"] try: st = worker.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running... | 445,685 |
def test_set_process_status(self): prev1, sys.argv = sys.argv, ["Arg0"] try: st = cd.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running", st) prev2, sys.argv = sys.argv, ["Arg0", "Arg1"] try: st = cd.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running", st) s... | def test_set_process_status(self): prev1, sys.argv = sys.argv, ["Arg0"] try: st = worker.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running", st) prev2, sys.argv = sys.argv, ["Arg0", "Arg1"] try: st = worker.set_process_status("Running") self.assertIn("celeryd", st) self.assertIn("Running... | 445,686 |
def test_freeze_thaw__buffering(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) self.assertTrue(s._buffering) | def test_freeze_thaw__buffering(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) self.assertTrue(s._buffering) | 445,687 |
def test_thaw__no_replay(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) | def test_thaw__no_replay(self): s = State() r = ev_snapshot(s) s.freeze(buffer=True) | 445,688 |
def work(): r.play() self.assertStateEmpty(s) | def work(): r.play() self.assertStateEmpty(s) | 445,689 |
def delay_task(task_name, *args, **kwargs): """Delay a task for execution by the ``celery`` daemon. :param task_name: the name of a task registered in the task registry. :param \*args: positional arguments to pass on to the task. :param \*\*kwargs: keyword arguments to pass on to the task. :raises celery.exceptions.N... | def delay_task(task_name, *args, **kwargs): """Delay a task for execution by the ``celery`` daemon. :param task_name: the name of a task registered in the task registry. :param \*args: positional arguments to pass on to the task. :param \*\*kwargs: keyword arguments to pass on to the task. :raises celery.exceptions.N... | 445,690 |
def __init__(self, expires=conf.TASK_RESULT_EXPIRES, backend=conf.CACHE_BACKEND, options={}, **kwargs): super(CacheBackend, self).__init__(self, **kwargs) if isinstance(expires, timedelta): expires = timeutils.timedelta_seconds(expires) self.expires = expires self.options = dict(conf.CACHE_BACKEND_OPTIONS, options) sel... | def __init__(self, expires=conf.TASK_RESULT_EXPIRES, backend=conf.CACHE_BACKEND, options={}, **kwargs): super(CacheBackend, self).__init__(self, **kwargs) if isinstance(expires, timedelta): expires = timeutils.timedelta_seconds(expires) self.expires = expires self.options = dict(conf.CACHE_BACKEND_OPTIONS, **options) s... | 445,691 |
def coerce(self, index, value): """Coerce value for argument at index. | def coerce(self, index, value): """Coerce value for argument at index. | 445,692 |
def test_expands_queue_in_options(self): R = routes.prepare(()) router = routes.Router(R, conf.QUEUES, create_missing=True) # apply_async forwards all arguments, even exchange=None etc, # so need to make sure it's merged correctly. route = router.route({"queue": "testq", "exchange": None, "routing_key": None, "immediat... | def test_expands_queue_in_options(self): R = routes.prepare(()) router = routes.Router(R, app_or_default().conf.CELERY_QUEUES, create_missing=True) # apply_async forwards all arguments, even exchange=None etc, # so need to make sure it's merged correctly. route = router.route({"queue": "testq", "exchange": None, "routi... | 445,693 |
def display_width(self): _, mx = self.win.getmaxyx() return mx - BORDER_SPACING | def display_width(self): _, mx = self.win.getmaxyx() return mx - BORDER_SPACING | 445,694 |
def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | def draw(self): win = self.win self.handle_keypress() x = LEFT_BORDER_OFFSET y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK... | 445,695 |
def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | 445,696 |
def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | 445,697 |
def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | def draw(self): win = self.win self.handle_keypress() x = 3 y = blank_line = count(2).next my, mx = win.getmaxyx() win.erase() win.bkgd(" ", curses.color_pair(1)) win.border() win.addstr(1, x, self.greet, curses.A_DIM | curses.color_pair(5)) blank_line() win.addstr(y(), x, self.format_row("UUID", "TASK", "WORKER", "TIM... | 445,698 |
def setup_logging(self): handled = self.app.log.setup_logging_subsystem(loglevel=self.loglevel, logfile=self.logfile) if not handled: logger = self.app.log.get_default_logger(name="celery.beat") if self.redirect_stdouts: self.app.log.redirect_stdouts_to_logger(logger, loglevel=self.redirect_stdouts_level) return logger | def setup_logging(self): handled = self.app.log.setup_logging_subsystem(loglevel=self.loglevel, logfile=self.logfile) if not handled: if self.redirect_stdouts: self.app.log.redirect_stdouts_to_logger(logger, loglevel=self.redirect_stdouts_level) return logger | 445,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.