我有一个需要访问django模型的芹菜任务。我在tasks.py中的代码是
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SQLite;
namespace StoreFront.Models {
public class Product {
[PrimaryKey, AutoIncrement]
public int Id { get; set;}
public string ItemName { get; set;}
public double Price { get; set;}
public int BrandInfoFK { get; set;}
}
}
我从views.py代码中调用它
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SQLite;
namespace StoreFront.Models {
public class BrandInfo {
[PrimaryKey, AutoIncrement]
public int Id { get; set;}
public string BrandName { get; set;}
public string Description { get; set;}
}
}
当我这样做时,我收到此错误
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
如果我注释掉任何对象的访问权限,例如删除以下行
@app.task
def crawlweb(listing_file_obj, marketplace):
logger = logging.getLogger("gbp_web.odsa")
logger.info('Started the task')
listing_file_obj.status="In Progress"
listing_file_obj.save()
任务正常。每次我尝试访问django模型时,都会过早存在。我尝试运行代码而不是任务,并且不使用芹菜,它工作正常。
以下是我的芹菜设置的样子
def prepare_urls_to_scrap(listing_file_obj, marketplace):
crawlweb.delay(listing_file_obj, marketplace)
logger.info('Submitted a crawling task')
这是celery.py文件
[2016-04-27 17:41:34,792: ERROR/MainProcess] Process 'Worker-5' pid:7362 exited with 'signal 11 (SIGSEGV)'
[2016-04-27 17:41:34,804: ERROR/MainProcess] Task odsa.tasks.crawlweb[ad90ca39-488e-4c94-ac28-88740562e934] raised unexpected: WorkerLostError('Worker exited prematurely: signal 11 (SIGSEGV).',)
Traceback (most recent call last):
File "/Users/amer/repository/gbp_web/env/lib/python2.7/site- packages/billiard/pool.py", line 1175, in mark_as_worker_lost
human_status(exitcode)),
我使用的是Mac El Capitan,redis经纪人,django 1.9.2 scrapy 1.0.5和芹菜3.1.23
感谢您的帮助