Bug #114

contracts and marketorders won't update

Added by macros about 1 year ago. Updated about 1 year ago.

Status:Closed Start date:Apr 23, 2012
Priority:High Due date:
Assignee:tash % Done:

100%

Category:app-accounting Spent time: -
Target version:2.0.4.1
Detected Version:2.0.0 Python Version:2.7 Windows 32bit

Description

When attemtping to run scheduled tasks, the following errors occur, causing erros in Scheduled Tasks under the last result column.

Server is win2008r2 running MySQL 5.5.16. Running ECM in a gevent server and IIS as a proxy and serving static requests.

[16:34] <Macros> 2012-04-22 16:28:11,694 [INFO ] ecm.plugins.accounting.tasks.marketorders - fetching /corp/MarketOrders.xml.aspx...
[16:34] <Macros> 2012-04-22 16:28:12,755 [ERROR] ecm.apps.scheduler.models -
[16:34] <Macros> Traceback (most recent call last):
[16:34] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\apps\scheduler\models.py", line 112, in run
[16:34] <Macros> func(**args)
[16:34] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\plugins\accounting\tasks\marketorders.py", line 47, in update
[16:34] <Macros> processOrders(ordersApi.orders, api_conn)
[16:34] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\plugins\accounting\tasks\marketorders.py", line 63, in processOrders
[16:34] <Macros> write_orders(added_orders, removed_orders)
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\transaction.py", line 209, in inner
[16:34] <Macros> return func(*args, **kwargs)
[16:34] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\plugins\accounting\tasks\marketorders.py", line 75, in write_orders
[16:34] <Macros> order.save()
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\base.py", line 463, in save
[16:34] <Macros> self.save_base(using=using, force_insert=force_insert, force_update=force_update)
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\base.py", line 551, in save_base
[16:34] <Macros> result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\manager.py", line 203, in _insert
[16:34] <Macros> return insert_query(self.model, objs, fields, **kwargs)
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\query.py", line 1576, in insert_query
[16:34] <Macros> return query.get_compiler(using=using).execute_sql(return_id)
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\sql\compiler.py", line 910, in execute_sql
[16:34] <Macros> cursor.execute(sql, params)
[16:34] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\backends\mysql\base.py", line 114, in execute
[16:34] <Macros> return self.cursor.execute(query, args)
[16:34] <Macros> File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 174, in execute
[16:34] <Macros> self.errorhandler(self, exc, value)
[16:34] <Macros> File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
[16:34] <Macros> raise errorclass, errorvalue
[16:34] <Macros> DatabaseError: (1264, "Out of range value for column 'range' at row 1")

[16:37] <Macros> 2012-04-22 16:28:34,282 [ERROR] ecm.apps.scheduler.models -
[16:37] <Macros> Traceback (most recent call last):
[16:37] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\apps\scheduler\models.py", line 112, in run
[16:37] <Macros> func(**args)
[16:37] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\plugins\accounting\tasks\contracts.py", line 54, in update
[16:37] <Macros> process_contracts(contractsApi.contractList, api_conn)
[16:37] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\plugins\accounting\tasks\contracts.py", line 114, in process_contracts
[16:37] <Macros> write_contract_items(new_items, removed_items)
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\transaction.py", line 209, in inner
[16:37] <Macros> return func(*args, **kwargs)
[16:37] <Macros> File "C:\Python27\lib\site-packages\ecm-2.0.1-py2.7.egg\ecm\plugins\accounting\tasks\contracts.py", line 140, in write_contract_items
[16:37] <Macros> item.save()
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\base.py", line 463, in save
[16:37] <Macros> self.save_base(using=using, force_insert=force_insert, force_update=force_update)
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\base.py", line 551, in save_base
[16:37] <Macros> result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\manager.py", line 203, in _insert
[16:37] <Macros> return insert_query(self.model, objs, fields, **kwargs)
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\query.py", line 1576, in insert_query
[16:37] <Macros> return query.get_compiler(using=using).execute_sql(return_id)
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\models\sql\compiler.py", line 910, in execute_sql
[16:37] <Macros> cursor.execute(sql, params)
[16:37] <Macros> File "C:\Python27\lib\site-packages\django-1.4-py2.7.egg\django\db\backends\mysql\base.py", line 114, in execute
[16:37] <Macros> return self.cursor.execute(query, args)
[16:37] <Macros> File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 174, in execute
[16:37] <Macros> self.errorhandler(self, exc, value)
[16:37] <Macros> File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
[16:37] <Macros> raise errorclass, errorvalue
[16:37] <Macros> IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`corpname_ecm`.`accounting_contractitem`, CONSTRAINT `contract_id_refs_id_69660584` FOREIGN KEY (`contract_id`) REFERENCES `accounting_contract` (`id`))')


Subtasks

Bug #123: Market Orders: MySQL wrong data type in range... Closedtash

Bug #124: Contracts: MySQL ForeignKey errorClosedtash

History

#1 Updated by tash about 1 year ago

MarketOrders: I prolly need to change the range field from PositiveIntegers to something else.
Contracts: who needs ref integrity :D

Will test both fixes this evening when i come home

#2 Updated by ajurna about 1 year ago

im also getting an error on contracts.

Traceback (most recent call last):

File "/var/www/eve-corp-management/ecm/apps/scheduler/models.py", line 112, in run
func(**args)
File "/var/www/eve-corp-management/ecm/plugins/accounting/tasks/contracts.py", line 54, in update
process_contracts(contractsApi.contractList, api_conn)
File "/var/www/eve-corp-management/ecm/plugins/accounting/tasks/contracts.py", line 112, in process_contracts
write_contracts(added_contracts, removed_contracts)
File "/usr/local/lib/python2.7/site-packages/django/db/transaction.py", line 209, in inner
return func(*args, **kwargs)
File "/var/www/eve-corp-management/ecm/plugins/accounting/tasks/contracts.py", line 123, in write_contracts
old_contracts.delete()

AttributeError: 'list' object has no attribute 'delete'

#3 Updated by tash about 1 year ago

@Ajurna: added that bug as Bug #125

I couldnt reproduce the contract issue. Since we ruled out different storage engines, Im unsure what might cause this problem...
You could try to add the following to settings.py located in your instance folder:

DATABASES = {
'default': {
    ...         
    'OPTIONS': {
         "init_command": "SET foreign_key_checks = 0;",
    },
 }
}

Django 1.4 should do that by default though...

#4 Updated by diabeteman about 1 year ago

  • Target version set to 2.0.2

#5 Updated by diabeteman about 1 year ago

  • Target version changed from 2.0.2 to 2.0.3

#6 Updated by diabeteman about 1 year ago

  • Assignee set to tash

#7 Updated by diabeteman about 1 year ago

  • Target version changed from 2.0.3 to 2.0.4.1

#8 Updated by tash about 1 year ago

  • Status changed from New to Resolved

#9 Updated by diabeteman about 1 year ago

  • Category set to app-accounting

#10 Updated by diabeteman about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF