Commit Graph

1159 Commits

Author SHA1 Message Date
virusdefender
5f8f2acf82 修复代码输出重定向错误的问题 增加了输出结果判断
lrun在运行的时候,输入输出重定向的context是当前的shell,所以不能重定向到进程的tmpfs中。考虑在docker中开辟tmpfs缓存空间。
输出结果比较是采用的md5,暂时没考虑格式错误的情况。
2015-07-06 18:59:30 +08:00
virusdefender
f1915a8b33 使用更好的办法修复Python2不能pickle实例方法的问题
详见 https://virusdefender.net/index.php/archives/318/
2015-07-03 20:10:38 +08:00
virusdefender
b9143c6408 修复子进程中引发的异常无法捕获的bug
多进程中子进程引发异常之后并不会直接显示,而是在get()方法被访问的时候再次引发异常。参考http://stackoverflow.com/questions/22094852/how-to-catch-exceptions-in-workers-in-multiprocessing
2015-07-03 16:56:40 +08:00
virusdefender
a26757916e 删除多线程库 2015-07-03 16:02:23 +08:00
virusdefender
ae931b4dba 将判题控制器由多线程修改为多进程
我一定是sb了,使用Python的多线程跑cpu密集型的应用。
由于Python的GIL的存在,导致在cpu上每次只能有一个线程在运行。如果一个线程运行,而且cpu时间是3秒的话,那实际运行时间将大约3秒。如果两个线程同时在进行,那总运行时间几乎要翻倍。

而换用多进程之后,单个进行运行实际时间只是稍微大于cpu时间,两个进程同时运行的时候,总的时间也是cpu时间稍微增加。

同时Python2在多进程之间运行类方法的时候存在bug,使用了 http://stackoverflow.com/questions/1816958/cant-pickle-type-instancemethod-when-using-pythons-multiprocessing-pool-ma/7309686#7309686 的方法进行patch。然后不同进程之间共享的时候,要防止循环依赖,参考 http://stackoverflow.com/questions/25382455/python-notimplementederror-pool-objects-cannot-be-passed-between-processes
2015-07-03 16:01:53 +08:00
virusdefender
b43dfe37c8 judge在ubuntu上暂时能跑起来了 2015-07-02 23:39:18 +08:00
virusdefender
8f67c37d0c 调用lrun判题和解析判题结果的框架代码完成
使用Python代码调用lrun,然后解析结果。还没有完成,剩下输出对比。
2015-07-02 17:23:42 +08:00
virusdefender
592720dd01 增加用户登录
包括用户model、用户登录模板、登录api和测试。
2015-06-29 12:43:17 +08:00
virusdefender
00052d8e9b 创建新工程 添加了一些通用代码和数据库模型 2015-06-26 15:59:53 +08:00