Celery 1.0 Documentation
delay(comment_id=comment.id, remote_addr=remote_addr) return HttpResponseRedirect(post.get_absolute_url()) else: form = CommentForm() 2.1. Tasks 19 Celery Documentation, Release 1.0.6 (stable) context update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task() def fetch_page(url): return myhttplib.get(url) @task() def parse_page(url parse_page(url, page): return myparser.parse_document(page) @task() def store_page_info(url, info): return PageInfo.objects.create(url, info) Good: from functools import curry @task(ignore_result=True)0 码力 | 123 页 | 400.69 KB | 1 年前3Celery 1.0 Documentation
remote_addr=remote_addr) return HttpResponseRedirect(post.get_absolute_url()) else: form = CommentForm() context = RequestContext(request, {"form": form}) return update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task() def fetch_page(url): return myhttplib.get(url) @task() @task() def parse_page(url, page): return myparser.parse_document(page) @task() def store_page_info(url, info): return PageInfo.objects.create(url, info) Good: from functools import curry @task(ignore_result=True)0 码力 | 221 页 | 283.64 KB | 1 年前3Celery 2.2 Documentation
update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task def fetch_page(url): return myhttplib.get(url) @task def parse_page(url, page): store_page_info(url, info): return PageInfo.objects.create(url, info) Good: @task(ignore_result=True) def update_page_info(url): # fetch_page -> parse_page -> store_page fetch_page.delay(url, callback=subtask(parse_page Celery Documentation, Release 2.2.10 @task(ignore_result=True) def fetch_page(url, callback=None): page = myhttplib.get(url) if callback: # The callback may have been serialized with JSON, # so best practice0 码力 | 314 页 | 1.26 MB | 1 年前3Celery 2.5 Documentation
any additional dependencies or initial configuration, other than the URL location of the broker instance you want to use: >>> BROKER_URL = "amqp://guest:guest@localhost:5672//" For a description of broker set the transport, and configure the location of your Redis database: BROKER_URL = "redis://localhost:6379/0" Where the URL is in the format of: redis://userid:password@hostname:port/db_number Results connection string, but with ‘sqla+’ prepended to it: BROKER_URL = "sqla+sqlite:///celerydb.sqlite" This transport uses only the BROKER_URL setting, which have to be an SQLAlchemy database URI. Please0 码力 | 400 页 | 1.40 MB | 1 年前3Celery 2.1 Documentation
update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task() def fetch_page(url): return myhttplib.get(url) @task() def parse_page(url parse_page(url, page): return myparser.parse_document(page) @task() def store_page_info(url, info): return PageInfo.objects.create(url, info) Good: @task(ignore_result=True) def update_page_info(url): # fetch_page.delay(url, callback=subtask(parse_page, callback=subtask(store_page_info))) 24 Chapter 2. User Guide Celery Documentation, Release 2.1.4 @task(ignore_result=True) def fetch_page(url, callback=None):0 码力 | 285 页 | 1.19 MB | 1 年前3Celery 2.1 Documentation
update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task() def fetch_page(url): return myhttplib.get(url) @task() @task() def parse_page(url, page): return myparser.parse_document(page) @task() def store_page_info(url, info): return PageInfo.objects.create(url, info) Good: @task(ignore_result=True) def update_page_info(url): update_page_info(url): # fetch_page -> parse_page -> store_page fetch_page.delay(url, callback=subtask(parse_page, callback=subtask(store_page_info))) @task(ignore_result=True)0 码力 | 463 页 | 861.69 KB | 1 年前3Celery 2.4 Documentation
any additional dependencies or initial configuration, other than the URL location of the broker instance you want to use: >>> BROKER_URL = "amqp://guest:guest@localhost:5672//" For a description of broker set the transport, and configure the location of your Redis database: BROKER_URL = "redis://localhost:6379/0" Where the URL is in the format of: redis://userid:password@hostname:port/db_number Results Django DATABASE_* settings for database configuration values. 1. Set your broker transport: BROKER_URL = "django://" 2. Add djkombu to INSTALLED_APPS: INSTALLED_APPS = ("djkombu", ) 3. Verify your database0 码力 | 395 页 | 1.54 MB | 1 年前3Celery 2.4 Documentation
any additional dependencies or initial configuration, other than the URL location of the broker instance you want to use: >>> BROKER_URL = "amqp://guest:guest@localhost:5672//" For a description of broker set the transport, and configure the location of your Redis database: BROKER_URL = "redis://localhost:6379/0" Where the URL is in the format of: redis://userid:password@hostname:port/db_number Results Django DATABASE_* settings for database configuration values. 1. Set your broker transport: BROKER_URL = "django://" 2. Add djkombu to INSTALLED_APPS: INSTALLED_APPS = ("djkombu", ) 3. Verify your database0 码力 | 543 页 | 957.42 KB | 1 年前3Celery 2.3 Documentation
update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task def fetch_page(url): return myhttplib.get(url) @task def parse_page(url, page): store_page_info(url, info): return PageInfo.objects.create(url, info) Good: @task(ignore_result=True) def update_page_info(url): # fetch_page -> parse_page -> store_page fetch_page.delay(url, callback=subtask(parse_page callback=subtask(store_page_info))) @task(ignore_result=True) def fetch_page(url, callback=None): page = myhttplib.get(url) if callback: # The callback may have been serialized with JSON, # so best practice0 码力 | 334 页 | 1.25 MB | 1 年前3Celery 2.0 Documentation
delay(comment_id=comment.id, remote_addr=remote_addr) return HttpResponseRedirect(post.get_absolute_url()) else: form = CommentForm() context = RequestContext(request, {"form": form}) return render_to_ update_page_info(url): page = fetch_page.delay(url).get() info = parse_page.delay(url, page).get() store_page_info.delay(url, info) @task() def fetch_page(url): return myhttplib.get(url) @task() def parse_page(url parse_page(url, page): return myparser.parse_document(page) @task() def store_page_info(url, info): return PageInfo.objects.create(url, info) Good: 20 Chapter 2. User Guide Celery Documentation, Release0 码力 | 165 页 | 492.43 KB | 1 年前3
共 51 条
- 1
- 2
- 3
- 4
- 5
- 6