Steve Kieu | 6 Jan 2011 14:12
Picon

what causes: storm.exceptions.LostObjectError: Can't obtain values from the database

Hello,


I have a simple script (attached to this email )- and evrytime I run, i got


stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
  return function(*args, **kwargs)
Traceback (most recent call last):
  File "bulk_price_update.py", line 137, in <module>
    process()
  File "bulk_price_update.py", line 129, in process
    new_pt.product_discount_id = new_pd.id; store.flush()
  File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
    return obj_info.variables[column].get()
  File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
    self.event.emit("resolve-lazy-value", self, self._lazy_value)
  File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
    if callback(owner, *(args+data)) is False:
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
    result, result.get_one())
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
    raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)

I am stuck at new idea to fix it, please help

If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the  pt object, but then try to get a product again using pt.id, however it does not help in both cases.

The DB is VirutalMart DB if it helps

Many thanks in advance



--
Steve Kieu
Attachment (bulk_price_update.py): text/x-python, 4492 bytes
<div>
<p>Hello,</p>
<div><br></div>
<div>I&nbsp;have&nbsp;a simple script (attached to this email )- and evrytime I run, i got</div>
<div><br></div>
<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div>&nbsp;&nbsp;return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 137, in &lt;module&gt;</div>
<div>&nbsp;&nbsp; &nbsp;process()</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 129, in process</div>
<div>&nbsp;&nbsp; &nbsp;new_pt.product_discount_id = <a href="http://new_pd.id">new_pd.id</a>; store.flush()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div>&nbsp;&nbsp; &nbsp;return obj_info.variables[column].get()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>
<div>&nbsp;&nbsp; &nbsp;self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div>&nbsp;&nbsp; &nbsp;if callback(owner, *(args+data)) is False:</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div>&nbsp;&nbsp; &nbsp;result, result.get_one())</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>
<div>&nbsp;&nbsp; &nbsp;raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>
<div><br></div>
<div>If I do not modify the&nbsp;product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the &nbsp;pt object, but then try to get a product again using <a href="http://pt.id">pt.id</a>, however it does not help in both cases.</div>
<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
</div>
Gerdus van Zyl | 6 Jan 2011 21:00
Picon
Gravatar

Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database

in ProductDiscount
you have both:
__storm_primary__ = 'amount', 'is_percent', 'start_date'
and
id = Int(name='discount_id', primary=True)

I don't think that you can have two definition of the primary key that are different;

and then in ProductDiscount.getone
you use
one = store.get(ProductDiscount, (amount, is_percent, start_date) )
according to me you need to use find


On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello,

I have a simple script (attached to this email )- and evrytime I run, i got


stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
  return function(*args, **kwargs)
Traceback (most recent call last):
  File "bulk_price_update.py", line 137, in <module>
    process()
  File "bulk_price_update.py", line 129, in process
    new_pt.product_discount_id = new_pd.id; store.flush()
  File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
    return obj_info.variables[column].get()
  File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
    self.event.emit("resolve-lazy-value", self, self._lazy_value)
  File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
    if callback(owner, *(args+data)) is False:
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
    result, result.get_one())
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
    raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)

I am stuck at new idea to fix it, please help

If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the  pt object, but then try to get a product again using pt.id, however it does not help in both cases.

The DB is VirutalMart DB if it helps

Many thanks in advance



--
Steve Kieu

--
storm mailing list
storm-33AaDErTWvAAkhNd+W/JZ0EOCMrvLtNR@public.gmane.org
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm




--
Gerdus van Zyl
http://about.me/gerdus
<div>
<p>in ProductDiscount<br>you have both:<br>__storm_primary__ = 'amount', 'is_percent', 'start_date'<br>and<br>id = Int(name='discount_id', primary=True)<br><br>I don't think that you can have two definition of the primary key that are different; <br><br>and then in ProductDiscount.getone<br>you use <br>one = store.get(ProductDiscount, (amount, is_percent, start_date) ) <br>according to me you need to use find <br><br><br></p>
<div class="gmail_quote">On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing <at> gmail.com">msh.computing@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">Hello,<div><br></div>
<div>I&nbsp;have&nbsp;a simple script (attached to this email )- and evrytime I run, i got</div>
<div><br></div>

<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div>&nbsp;&nbsp;return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>

<div>&nbsp;&nbsp;File "bulk_price_update.py", line 137, in &lt;module&gt;</div>
<div>&nbsp;&nbsp; &nbsp;process()</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 129, in process</div>
<div>&nbsp;&nbsp; &nbsp;new_pt.product_discount_id = <a href="http://new_pd.id" target="_blank">new_pd.id</a>; store.flush()</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div>&nbsp;&nbsp; &nbsp;return obj_info.variables[column].get()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>

<div>&nbsp;&nbsp; &nbsp;self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div>&nbsp;&nbsp; &nbsp;if callback(owner, *(args+data)) is False:</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div>&nbsp;&nbsp; &nbsp;result, result.get_one())</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>

<div>&nbsp;&nbsp; &nbsp;raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>

<div><br></div>
<div>If I do not modify the&nbsp;product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the &nbsp;pt object, but then try to get a product again using <a href="http://pt.id" target="_blank">pt.id</a>, however it does not help in both cases.</div>

<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
<br>--<br>
storm mailing list<br><a href="mailto:storm@...">storm@...</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank">https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</div>
Steve Kieu | 7 Jan 2011 00:13
Picon

Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database

I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.

If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.

I tried to use find in getone method - no change

Tried to invalidate the pt  after saving the id key, then get the Product using that id key and change its product_discount_id, - no change

Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error

Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem



Cheers,



On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <gerdusvanzyl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
in ProductDiscount
you have both:
__storm_primary__ = 'amount', 'is_percent', 'start_date'
and
id = Int(name='discount_id', primary=True)

I don't think that you can have two definition of the primary key that are different;

and then in ProductDiscount.getone
you use
one = store.get(ProductDiscount, (amount, is_percent, start_date) )
according to me you need to use find


On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello,

I have a simple script (attached to this email )- and evrytime I run, i got


stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
  return function(*args, **kwargs)
Traceback (most recent call last):
  File "bulk_price_update.py", line 137, in <module>
    process()
  File "bulk_price_update.py", line 129, in process
    new_pt.product_discount_id = new_pd.id; store.flush()
  File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
    return obj_info.variables[column].get()
  File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
    self.event.emit("resolve-lazy-value", self, self._lazy_value)
  File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
    if callback(owner, *(args+data)) is False:
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
    result, result.get_one())
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
    raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)

I am stuck at new idea to fix it, please help

If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the  pt object, but then try to get a product again using pt.id, however it does not help in both cases.

The DB is VirutalMart DB if it helps

Many thanks in advance



--
Steve Kieu

--
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm




--
Gerdus van Zyl
http://about.me/gerdus



--
Steve Kieu
<div>
<p>I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.<br><br>If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.<br><br>I tried to use find in getone method - no change<br><br>Tried to invalidate the pt&nbsp; after saving the id key, then get the Product using that id key and change its product_discount_id, - no change<br><br>Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error<br><br>Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem <br><br><br><br>Cheers,<br><br><br><br></p>
<div class="gmail_quote">On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <span dir="ltr">&lt;<a href="mailto:gerdusvanzyl@...">gerdusvanzyl@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
in ProductDiscount<br>you have both:<br>__storm_primary__ = 'amount', 'is_percent', 'start_date'<br>and<br>id = Int(name='discount_id', primary=True)<br><br>I don't think that you can have two definition of the primary key that are different; <br><br>and then in ProductDiscount.getone<br>you use <br>one = store.get(ProductDiscount, (amount, is_percent, start_date) ) <br>according to me you need to use find <br><br><br><div class="gmail_quote">
<div>
<div></div>
<div class="h5">
On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>&gt;</span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote">
<div>
<div></div>
<div class="h5">Hello,<div><br></div>
<div>I&nbsp;have&nbsp;a simple script (attached to this email )- and evrytime I run, i got</div>
<div><br></div>

<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div>&nbsp;&nbsp;return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>

<div>&nbsp;&nbsp;File "bulk_price_update.py", line 137, in &lt;module&gt;</div>
<div>&nbsp;&nbsp; &nbsp;process()</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 129, in process</div>
<div>&nbsp;&nbsp; &nbsp;new_pt.product_discount_id = <a href="http://new_pd.id" target="_blank">new_pd.id</a>; store.flush()</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div>&nbsp;&nbsp; &nbsp;return obj_info.variables[column].get()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>

<div>&nbsp;&nbsp; &nbsp;self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div>&nbsp;&nbsp; &nbsp;if callback(owner, *(args+data)) is False:</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div>&nbsp;&nbsp; &nbsp;result, result.get_one())</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>

<div>&nbsp;&nbsp; &nbsp;raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>

<div><br></div>
<div>If I do not modify the&nbsp;product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the &nbsp;pt object, but then try to get a product again using <a href="http://pt.id" target="_blank">pt.id</a>, however it does not help in both cases.</div>

<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
<br>
</div>
</div>--<br>
storm mailing list<br><a href="mailto:storm@..." target="_blank">storm <at> lists.canonical.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank">https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Steve Kieu<br>
</div>
Steve Kieu | 7 Jan 2011 00:19
Picon

Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database


I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem

so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )

Thanks


On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.

If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.

I tried to use find in getone method - no change

Tried to invalidate the pt  after saving the id key, then get the Product using that id key and change its product_discount_id, - no change

Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error

Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem



Cheers,




On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <gerdusvanzyl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
in ProductDiscount
you have both:
__storm_primary__ = 'amount', 'is_percent', 'start_date'
and
id = Int(name='discount_id', primary=True)

I don't think that you can have two definition of the primary key that are different;

and then in ProductDiscount.getone
you use
one = store.get(ProductDiscount, (amount, is_percent, start_date) )
according to me you need to use find


On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello,

I have a simple script (attached to this email )- and evrytime I run, i got


stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
  return function(*args, **kwargs)
Traceback (most recent call last):
  File "bulk_price_update.py", line 137, in <module>
    process()
  File "bulk_price_update.py", line 129, in process
    new_pt.product_discount_id = new_pd.id; store.flush()
  File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
    return obj_info.variables[column].get()
  File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
    self.event.emit("resolve-lazy-value", self, self._lazy_value)
  File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
    if callback(owner, *(args+data)) is False:
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
    result, result.get_one())
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
    raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)

I am stuck at new idea to fix it, please help

If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the  pt object, but then try to get a product again using pt.id, however it does not help in both cases.

The DB is VirutalMart DB if it helps

Many thanks in advance



--
Steve Kieu

--
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm




--
Gerdus van Zyl
http://about.me/gerdus



--
Steve Kieu



--
Steve Kieu
<div>
<br>I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem <br><br>so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )<br><br>Thanks<br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing <at> gmail.com">msh.computing@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.<br><br>If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.<br><br>I tried to use find in getone method - no change<br><br>Tried to invalidate the pt&nbsp; after saving the id key, then get the Product using that id key and change its product_discount_id, - no change<br><br>Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error<br><br>Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem <br><br><br><br>Cheers,<div>
<div></div>
<div class="h5">
<br><br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <span dir="ltr">&lt;<a href="mailto:gerdusvanzyl@..." target="_blank">gerdusvanzyl@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
in ProductDiscount<br>you have both:<br>__storm_primary__ = 'amount', 'is_percent', 'start_date'<br>and<br>id = Int(name='discount_id', primary=True)<br><br>I don't think that you can have two definition of the primary key that are different; <br><br>and then in ProductDiscount.getone<br>you use <br>one = store.get(ProductDiscount, (amount, is_percent, start_date) ) <br>according to me you need to use find <br><br><br><div class="gmail_quote">
<div>
<div></div>
<div>

On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>&gt;</span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote">
<div>
<div></div>
<div>Hello,<div><br></div>
<div>I&nbsp;have&nbsp;a simple script (attached to this email )- and evrytime I run, i got</div>

<div><br></div>

<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div>&nbsp;&nbsp;return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>

<div>&nbsp;&nbsp;File "bulk_price_update.py", line 137, in &lt;module&gt;</div>
<div>&nbsp;&nbsp; &nbsp;process()</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 129, in process</div>
<div>&nbsp;&nbsp; &nbsp;new_pt.product_discount_id = <a href="http://new_pd.id" target="_blank">new_pd.id</a>; store.flush()</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div>&nbsp;&nbsp; &nbsp;return obj_info.variables[column].get()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>

<div>&nbsp;&nbsp; &nbsp;self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div>&nbsp;&nbsp; &nbsp;if callback(owner, *(args+data)) is False:</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div>&nbsp;&nbsp; &nbsp;result, result.get_one())</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>

<div>&nbsp;&nbsp; &nbsp;raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>

<div><br></div>
<div>If I do not modify the&nbsp;product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the &nbsp;pt object, but then try to get a product again using <a href="http://pt.id" target="_blank">pt.id</a>, however it does not help in both cases.</div>

<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
<br>
</div>
</div>--<br>
storm mailing list<br><a href="mailto:storm@..." target="_blank">storm <at> lists.canonical.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank">https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Steve Kieu<br>
</div>
Steve Kieu | 7 Jan 2011 09:39
Picon

Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database

Hi there,

Yes you are right - The table should have the compose key as unique but VirtualMart does not do it - and imposing it cause problem.

Thank you very much for your help, I highly appreciated it and learned  another experience with storm :-)

Cheers,




On Fri, Jan 7, 2011 at 9:19 AM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem

so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )

Thanks



On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <msh.computing <at> gmail.com> wrote:
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.

If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.

I tried to use find in getone method - no change

Tried to invalidate the pt  after saving the id key, then get the Product using that id key and change its product_discount_id, - no change

Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error

Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem



Cheers,




On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <gerdusvanzyl <at> gmail.com> wrote:
in ProductDiscount
you have both:
__storm_primary__ = 'amount', 'is_percent', 'start_date'
and
id = Int(name='discount_id', primary=True)

I don't think that you can have two definition of the primary key that are different;

and then in ProductDiscount.getone
you use
one = store.get(ProductDiscount, (amount, is_percent, start_date) )
according to me you need to use find


On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello,

I have a simple script (attached to this email )- and evrytime I run, i got


stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
  return function(*args, **kwargs)
Traceback (most recent call last):
  File "bulk_price_update.py", line 137, in <module>
    process()
  File "bulk_price_update.py", line 129, in process
    new_pt.product_discount_id = new_pd.id; store.flush()
  File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
    return obj_info.variables[column].get()
  File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
    self.event.emit("resolve-lazy-value", self, self._lazy_value)
  File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
    if callback(owner, *(args+data)) is False:
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
    result, result.get_one())
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
    raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)

I am stuck at new idea to fix it, please help

If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the  pt object, but then try to get a product again using pt.id, however it does not help in both cases.

The DB is VirutalMart DB if it helps

Many thanks in advance



--
Steve Kieu

--
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm




--
Gerdus van Zyl
http://about.me/gerdus



--
Steve Kieu



--
Steve Kieu



--
Steve Kieu
<div>
<p>Hi there,<br><br>Yes you are right - The table should have the compose key as unique but VirtualMart does not do it - and imposing it cause problem.<br><br>Thank you very much for your help, I highly appreciated it and learned&nbsp; another experience with storm :-)<br><br>Cheers,<br><br><br><br><br></p>
<div class="gmail_quote">On Fri, Jan 7, 2011 at 9:19 AM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@...">msh.computing@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<br>I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem <br><br>so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )<br><br>Thanks<div>
<div></div>
<div class="h5">
<br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.<br><br>If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.<br><br>I tried to use find in getone method - no change<br><br>Tried to invalidate the pt&nbsp; after saving the id key, then get the Product using that id key and change its product_discount_id, - no change<br><br>Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error<br><br>Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem <br><br><br><br>Cheers,<div>
<div></div>
<div>
<br><br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <span dir="ltr">&lt;<a href="mailto:gerdusvanzyl@..." target="_blank">gerdusvanzyl <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
in ProductDiscount<br>you have both:<br>__storm_primary__ = 'amount', 'is_percent', 'start_date'<br>and<br>id = Int(name='discount_id', primary=True)<br><br>I don't think that you can have two definition of the primary key that are different; <br><br>and then in ProductDiscount.getone<br>you use <br>one = store.get(ProductDiscount, (amount, is_percent, start_date) ) <br>according to me you need to use find <br><br><br><div class="gmail_quote">
<div>
<div></div>
<div>

On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>&gt;</span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote">
<div>
<div></div>
<div>Hello,<div><br></div>
<div>I&nbsp;have&nbsp;a simple script (attached to this email )- and evrytime I run, i got</div>

<div><br></div>

<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div>&nbsp;&nbsp;return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>

<div>&nbsp;&nbsp;File "bulk_price_update.py", line 137, in &lt;module&gt;</div>
<div>&nbsp;&nbsp; &nbsp;process()</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 129, in process</div>
<div>&nbsp;&nbsp; &nbsp;new_pt.product_discount_id = <a href="http://new_pd.id" target="_blank">new_pd.id</a>; store.flush()</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div>&nbsp;&nbsp; &nbsp;return obj_info.variables[column].get()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>

<div>&nbsp;&nbsp; &nbsp;self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div>&nbsp;&nbsp; &nbsp;if callback(owner, *(args+data)) is False:</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div>&nbsp;&nbsp; &nbsp;result, result.get_one())</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>

<div>&nbsp;&nbsp; &nbsp;raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>

<div><br></div>
<div>If I do not modify the&nbsp;product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the &nbsp;pt object, but then try to get a product again using <a href="http://pt.id" target="_blank">pt.id</a>, however it does not help in both cases.</div>

<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
<br>
</div>
</div>--<br>
storm mailing list<br><a href="mailto:storm@..." target="_blank">storm <at> lists.canonical.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank">https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Steve Kieu<br>
</div>
Gerdus van Zyl | 7 Jan 2011 09:49
Picon
Gravatar

Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database

Can't you just add an autoincrementing integer primary key (surrogate key)? or even a field to store a uuid

On Fri, Jan 7, 2011 at 10:39 AM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi there,

Yes you are right - The table should have the compose key as unique but VirtualMart does not do it - and imposing it cause problem.

Thank you very much for your help, I highly appreciated it and learned  another experience with storm :-)

Cheers,





On Fri, Jan 7, 2011 at 9:19 AM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem

so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )

Thanks



On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.

If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.

I tried to use find in getone method - no change

Tried to invalidate the pt  after saving the id key, then get the Product using that id key and change its product_discount_id, - no change

Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error

Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem



Cheers,




On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <gerdusvanzyl <at> gmail.com> wrote:
in ProductDiscount
you have both:
__storm_primary__ = 'amount', 'is_percent', 'start_date'
and
id = Int(name='discount_id', primary=True)

I don't think that you can have two definition of the primary key that are different;

and then in ProductDiscount.getone
you use
one = store.get(ProductDiscount, (amount, is_percent, start_date) )
according to me you need to use find


On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello,

I have a simple script (attached to this email )- and evrytime I run, i got


stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py
Number of record: 202
/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1
  return function(*args, **kwargs)
Traceback (most recent call last):
  File "bulk_price_update.py", line 137, in <module>
    process()
  File "bulk_price_update.py", line 129, in process
    new_pt.product_discount_id = new_pd.id; store.flush()
  File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__
    return obj_info.variables[column].get()
  File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get
    self.event.emit("resolve-lazy-value", self, self._lazy_value)
  File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit
    if callback(owner, *(args+data)) is False:
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value
    result, result.get_one())
  File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values
    raise LostObjectError("Can't obtain values from the database "
storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)

I am stuck at new idea to fix it, please help

If I do not modify the product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the  pt object, but then try to get a product again using pt.id, however it does not help in both cases.

The DB is VirutalMart DB if it helps

Many thanks in advance



--
Steve Kieu

--
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm




--
Gerdus van Zyl
http://about.me/gerdus



--
Steve Kieu



--
Steve Kieu



--
Steve Kieu



--
Gerdus van Zyl
http://about.me/gerdus
<div>
<p>Can't you just add an autoincrementing integer primary key (surrogate key)? or even a field to store a uuid<br><br></p>
<div class="gmail_quote">On Fri, Jan 7, 2011 at 10:39 AM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@...">msh.computing@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">Hi there,<br><br>Yes you are right - The table should have the compose key as unique but VirtualMart does not do it - and imposing it cause problem.<br><br>Thank you very much for your help, I highly appreciated it and learned&nbsp; another experience with storm :-)<br><br>Cheers,<div>
<div></div>
<div class="h5">
<br><br><br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 9:19 AM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<br>I have thought about a case - if the compose primary key is *not* actually unique in the db it may cause the problem <br><br>so I will try your idea tonight (I am at work now ) to see if it gets fixed, probably have to change the logic there )<br><br>Thanks<div>
<div></div>
<div>
<br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 9:13 AM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
I think (from reading storm doc somewhere) I can use a unique compose key to tell storm that it can be used as primary tuple in get function. In fact I used this in various other scripts which runs fine.<br><br>If this is the problem it does not explain why everything is working - that is I can print out all Product, etc inside the find tuple - I can even create new record for the ProductDiscountHistory fine. Bad thing *only* happen when I change the product_discount_id of the Product to use the new discount.<br><br>I tried to use find in getone method - no change<br><br>Tried to invalidate the pt&nbsp; after saving the id key, then get the Product using that id key and change its product_discount_id, - no change<br><br>Enable DEBUG in storm and does not print any usefull information - just the last SQL statement as normal and boom - error<br><br>Nevertheless I will try your suggestion tonight but I strongly believe it does not solve the problem. It happens with both python version 2.7.1 and Ubuntu lucid stock python (2.6.x) so unlikely it is python GC problem <br><br><br><br>Cheers,<div>
<div></div>
<div>
<br><br><br><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 6:00 AM, Gerdus van Zyl <span dir="ltr">&lt;<a href="mailto:gerdusvanzyl@..." target="_blank">gerdusvanzyl <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
in ProductDiscount<br>you have both:<br>__storm_primary__ = 'amount', 'is_percent', 'start_date'<br>and<br>id = Int(name='discount_id', primary=True)<br><br>I don't think that you can have two definition of the primary key that are different; <br><br>and then in ProductDiscount.getone<br>you use <br>one = store.get(ProductDiscount, (amount, is_percent, start_date) ) <br>according to me you need to use find <br><br><br><div class="gmail_quote">
<div>
<div></div>
<div>

On Thu, Jan 6, 2011 at 3:12 PM, Steve Kieu <span dir="ltr">&lt;<a href="mailto:msh.computing@..." target="_blank">msh.computing@...</a>&gt;</span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote">
<div>
<div></div>
<div>Hello,<div><br></div>
<div>I&nbsp;have&nbsp;a simple script (attached to this email )- and evrytime I run, i got</div>

<div><br></div>

<div><br></div>
<div>
<div>stevek <at> lenovo:~/hang-hieu-uc/python$ python bulk_price_update.py</div>
<div>
Number of record: 202</div>
<div>/usr/lib/python2.6/dist-packages/storm/database.py:342: Warning: Data truncated for column 'amount' at row 1</div>
<div>&nbsp;&nbsp;return function(*args, **kwargs)</div>
<div>Traceback (most recent call last):</div>

<div>&nbsp;&nbsp;File "bulk_price_update.py", line 137, in &lt;module&gt;</div>
<div>&nbsp;&nbsp; &nbsp;process()</div>
<div>&nbsp;&nbsp;File "bulk_price_update.py", line 129, in process</div>
<div>&nbsp;&nbsp; &nbsp;new_pt.product_discount_id = <a href="http://new_pd.id" target="_blank">new_pd.id</a>; store.flush()</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/properties.py", line 60, in __get__</div>
<div>&nbsp;&nbsp; &nbsp;return obj_info.variables[column].get()</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/variables.py", line 178, in get</div>

<div>&nbsp;&nbsp; &nbsp;self.event.emit("resolve-lazy-value", self, self._lazy_value)</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/event.py", line 53, in emit</div>
<div>&nbsp;&nbsp; &nbsp;if callback(owner, *(args+data)) is False:</div>

<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 891, in _resolve_lazy_value</div>
<div>&nbsp;&nbsp; &nbsp;result, result.get_one())</div>
<div>&nbsp;&nbsp;File "/usr/lib/python2.6/dist-packages/storm/store.py", line 746, in _set_values</div>

<div>&nbsp;&nbsp; &nbsp;raise LostObjectError("Can't obtain values from the database "</div>
<div>storm.exceptions.LostObjectError: Can't obtain values from the database (object got removed?)</div>
<br>I am stuck at new idea to fix it, please help</div>

<div><br></div>
<div>If I do not modify the&nbsp;product_discount_id of a product then it printed values fine and create in the history table fine. First I directly modify the &nbsp;pt object, but then try to get a product again using <a href="http://pt.id" target="_blank">pt.id</a>, however it does not help in both cases.</div>

<div><br></div>
<div>The DB is VirutalMart DB if it helps</div>
<div><br></div>
<div>Many thanks in advance</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div>-- <br>Steve Kieu<br>
</div>
<br>
</div>
</div>--<br>
storm mailing list<br><a href="mailto:storm@..." target="_blank">storm <at> lists.canonical.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/storm" target="_blank">https://lists.ubuntu.com/mailman/listinfo/storm</a><br><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>
</div>
</div>-- <br>Steve Kieu<br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Gerdus van Zyl<br><a href="http://about.me/gerdus" target="_blank">http://about.me/gerdus</a><br>
</div>
Steve Kieu | 7 Jan 2011 10:12
Picon

Re: what causes: storm.exceptions.LostObjectError: Can't obtain values from the database

Hi,


On Fri, Jan 7, 2011 at 6:49 PM, Gerdus van Zyl <gerdusvanzyl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Can't you just add an autoincrementing integer primary key (surrogate key)? or even a field to store a uuid



I can manually remove duplicate and alter the table to have it unique but I could not care much for now - I just do not care about data normalization - just remove the extra storm definition of the primary key and replace get with find which works for now

Cheers,

--
Steve Kieu
<div>
<p>Hi,<br><br><br></p>
<div class="gmail_quote">On Fri, Jan 7, 2011 at 6:49 PM, Gerdus van Zyl <span dir="ltr">&lt;<a href="mailto:gerdusvanzyl@...m">gerdusvanzyl@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
Can't you just add an autoincrementing integer primary key (surrogate key)? or even a field to store a uuid<div>
<div></div>
<div class="h5"><br></div>
</div>
</blockquote>
</div>
<br><br>I can manually remove duplicate and alter the table to have it unique but I could not care much for now - I just do not care about data normalization - just remove the extra storm definition of the primary key and replace get with find which works for now<br><br>Cheers,<br><br>-- <br>Steve Kieu<br>
</div>
Steve Kieu | 26 Jan 2011 09:31
Picon

Storm and MySQL in WSGI environment - MySQL server run away

Hello,

I am developing a simple WSGI application using storm and MySQL. The problem is, after midnight ; or for some reason I restart MySQL server and my application dies with 500 - and inside I have exception by Storm raised:

[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File "/usr/local/lib/python2.6/dist-packages/storm/databases/mysql.py", line 106, in execute
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     return Connection.execute(self, statement, params, noresult)
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 227, in execute
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     self._ensure_connected()
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 344, in _ensure_connected
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     raise DisconnectionError("Already disconnected")

Sometimes I got the error mesasge like ; MySQL has gonna away ....


To fix, just restart apache.

The problem is that storm tried to use existing connection and the server is gone. Storm does not want to reinitialize the connection but raise exception. In my code it is clearly that for each request I create a dsn and a Store object like store = Store(create_database(dsn)). Unfortunately it still reuse the connection somehow and then dies. (probably the python environment is reusing these variable somehow)

To prove that is the issue I took a cgi to wsgi gateway from python PEP somewhere, fix it a bit so I can convert the whole wsgi to use cgi. Now problem goes away, I can restart mysql server but the application still works as expected.

Any hint or help are very welcome.

Many thanks

--
Steve Kieu

<div><p>Hello,<br><br>I am developing a simple WSGI application using storm and MySQL. The problem is, after midnight ; or for some reason I restart MySQL server and my application dies with 500 - and inside I have exception by Storm raised:<br><br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp; File "/usr/local/lib/python2.6/dist-packages/storm/databases/mysql.py", line 106, in execute<br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp;&nbsp;&nbsp; return Connection.execute(self, statement, params, noresult)<br>
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp; File "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 227, in execute<br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp;&nbsp;&nbsp; self._ensure_connected()<br>
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp; File "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 344, in _ensure_connected<br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp;&nbsp;&nbsp; raise DisconnectionError("Already disconnected")<br><br clear="all">Sometimes I got the error mesasge like ; MySQL has gonna away ....<br><br><br>To fix, just restart apache.<br><br>The problem is that storm tried to use existing connection and the server is gone. Storm does not want to reinitialize the connection but raise exception. In my code it is clearly that for each request I create a dsn and a Store object like store = Store(create_database(dsn)). Unfortunately it still reuse the connection somehow and then dies. (probably the python environment is reusing these variable somehow)<br><br>To prove that is the issue I took a cgi to wsgi gateway from python PEP somewhere, fix it a bit so I can convert the whole wsgi to use cgi. Now problem goes away, I can restart mysql server but the application still works as expected.<br><br>Any hint or help are very welcome. <br><br>Many thanks<br><br>-- <br>Steve Kieu<br></p></div>
Jamu Kakar | 26 Jan 2011 09:37
Picon
Gravatar

Re: Storm and MySQL in WSGI environment - MySQL server run away

Hi Steve,

On Wed, Jan 26, 2011 at 9:31 AM, Steve Kieu <msh.computing <at> gmail.com> wrote:
> I am developing a simple WSGI application using storm and MySQL. The problem
> is, after midnight ; or for some reason I restart MySQL server and my
> application dies with 500 - and inside I have exception by Storm raised:
>
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
> "/usr/local/lib/python2.6/dist-packages/storm/databases/mysql.py", line 106,
> in execute
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     return
> Connection.execute(self, statement, params, noresult)
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
> "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 227, in
> execute
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]
> self._ensure_connected()
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
> "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 344, in
> _ensure_connected
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     raise
> DisconnectionError("Already disconnected")
>
> Sometimes I got the error mesasge like ; MySQL has gonna away ....

This is the expected behaviour.  When the underlying database goes
away (or is restarted) and an existing connection is used, Storm will
raise a DisconnectionError.  It's up to your application to detect
this and determine how to recover.  In the case of a web server you
can usually just retry the request being handled.  Be careful to put a
maximum retry limit.  If the database doesn't come back quickly you
don't want to be continuously retrying requests.

> To fix, just restart apache.

This works because Storm is creating new connections to MySQL when you
restart Apache.

> The problem is that storm tried to use existing connection and the server is
> gone. Storm does not want to reinitialize the connection but raise
> exception. In my code it is clearly that for each request I create a dsn and
> a Store object like store = Store(create_database(dsn)). Unfortunately it
> still reuse the connection somehow and then dies. (probably the python
> environment is reusing these variable somehow)

Storm will raise a DisconnectionError, as a signal that the
transaction failed and you need to recover.  If you try to use the
connection again Storm will attempt to reconnect to the database
automatically.  If that fails, it'll raise DisconnectionError again.

> To prove that is the issue I took a cgi to wsgi gateway from python PEP
> somewhere, fix it a bit so I can convert the whole wsgi to use cgi. Now
> problem goes away, I can restart mysql server but the application still
> works as expected.

Yep, this is because the CGI application is opening a new connection
to the database for each request.  If the database disappeared during
the CGI request you'd see the same exception.

Thanks,
J.

--

-- 
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
Steve Kieu | 26 Jan 2011 10:00
Picon

Re: Storm and MySQL in WSGI environment - MySQL server run away

Hi,

Thanks for the answer.

The problem is that when create a Store object, storm does not try to connect right away so no exception is thrown at that point. When there is a need, storm try to use the connection and fail. To handle it, I have to wrap many try: catch exception all over places and not quite sure where and it does not look good.

Like a php mysql db, they just don't care, if connection goes away, they reconnect / make new connection automatically. That would be be nice



On Wed, Jan 26, 2011 at 6:37 PM, Jamu Kakar <jkakar <at> kakar.ca> wrote:
Hi Steve,

On Wed, Jan 26, 2011 at 9:31 AM, Steve Kieu <msh.computing-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I am developing a simple WSGI application using storm and MySQL. The problem
> is, after midnight ; or for some reason I restart MySQL server and my
> application dies with 500 - and inside I have exception by Storm raised:
>
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
> "/usr/local/lib/python2.6/dist-packages/storm/databases/mysql.py", line 106,
> in execute
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     return
> Connection.execute(self, statement, params, noresult)
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
> "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 227, in
> execute
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]
> self._ensure_connected()
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
> "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 344, in
> _ensure_connected
> [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     raise
> DisconnectionError("Already disconnected")
>
> Sometimes I got the error mesasge like ; MySQL has gonna away ....

This is the expected behaviour.  When the underlying database goes
away (or is restarted) and an existing connection is used, Storm will
raise a DisconnectionError.  It's up to your application to detect
this and determine how to recover.  In the case of a web server you
can usually just retry the request being handled.  Be careful to put a
maximum retry limit.  If the database doesn't come back quickly you
don't want to be continuously retrying requests.

> To fix, just restart apache.

This works because Storm is creating new connections to MySQL when you
restart Apache.

> The problem is that storm tried to use existing connection and the server is
> gone. Storm does not want to reinitialize the connection but raise
> exception. In my code it is clearly that for each request I create a dsn and
> a Store object like store = Store(create_database(dsn)). Unfortunately it
> still reuse the connection somehow and then dies. (probably the python
> environment is reusing these variable somehow)

Storm will raise a DisconnectionError, as a signal that the
transaction failed and you need to recover.  If you try to use the
connection again Storm will attempt to reconnect to the database
automatically.  If that fails, it'll raise DisconnectionError again.

> To prove that is the issue I took a cgi to wsgi gateway from python PEP
> somewhere, fix it a bit so I can convert the whole wsgi to use cgi. Now
> problem goes away, I can restart mysql server but the application still
> works as expected.

Yep, this is because the CGI application is opening a new connection
to the database for each request.  If the database disappeared during
the CGI request you'd see the same exception.

Thanks,
J.



--
Steve Kieu
<div>
<p>Hi,<br><br>
Thanks for the answer.<br><br>
The problem is that when create a Store object, storm does not try to 
connect right away so no exception is thrown at that point. When there 
is a need, storm try to use the connection and fail. To handle it, I 
have to wrap many try: catch exception all over places and not quite 
sure where and it does not look good.<br><br>
Like a php mysql db, they just don't care, if connection goes away, they
 reconnect / make new connection automatically. That would be be nice<br><br><br><br></p>
<div class="gmail_quote">On Wed, Jan 26, 2011 at 6:37 PM, Jamu Kakar <span dir="ltr">&lt;<a href="mailto:jkakar@...">jkakar <at> kakar.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">Hi Steve,<br><div class="im">
<br>
On Wed, Jan 26, 2011 at 9:31 AM, Steve Kieu &lt;<a href="mailto:msh.computing@...">msh.computing@...</a>&gt; wrote:<br>
&gt; I am developing a simple WSGI application using storm and MySQL. The problem<br>
&gt; is, after midnight ; or for some reason I restart MySQL server and my<br>
&gt; application dies with 500 - and inside I have exception by Storm raised:<br>
&gt;<br>
&gt; [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp; File<br>
&gt; "/usr/local/lib/python2.6/dist-packages/storm/databases/mysql.py", line 106,<br>
&gt; in execute<br>
&gt; [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp;&nbsp;&nbsp; return<br>
&gt; Connection.execute(self, statement, params, noresult)<br>
&gt; [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp; File<br>
&gt; "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 227, in<br>
&gt; execute<br>
&gt; [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]<br>
&gt; self._ensure_connected()<br>
&gt; [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp; File<br>
&gt; "/usr/local/lib/python2.6/dist-packages/storm/database.py", line 344, in<br>
&gt; _ensure_connected<br>
&gt; [Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]&nbsp;&nbsp;&nbsp;&nbsp; raise<br>
&gt; DisconnectionError("Already disconnected")<br>
&gt;<br>
&gt; Sometimes I got the error mesasge like ; MySQL has gonna away ....<br><br>
</div>This is the expected behaviour. &nbsp;When the underlying database goes<br>
away (or is restarted) and an existing connection is used, Storm will<br>
raise a DisconnectionError. &nbsp;It's up to your application to detect<br>
this and determine how to recover. &nbsp;In the case of a web server you<br>
can usually just retry the request being handled. &nbsp;Be careful to put a<br>
maximum retry limit. &nbsp;If the database doesn't come back quickly you<br>
don't want to be continuously retrying requests.<br><div class="im">
<br>
&gt; To fix, just restart apache.<br><br>
</div>This works because Storm is creating new connections to MySQL when you<br><div class="im">restart Apache.<br><br>
&gt; The problem is that storm tried to use existing connection and the server is<br>
&gt; gone. Storm does not want to reinitialize the connection but raise<br>
&gt; exception. In my code it is clearly that for each request I create a dsn and<br>
&gt; a Store object like store = Store(create_database(dsn)). Unfortunately it<br>
&gt; still reuse the connection somehow and then dies. (probably the python<br>
&gt; environment is reusing these variable somehow)<br><br>
</div>Storm will raise a DisconnectionError, as a signal that the<br>
transaction failed and you need to recover. &nbsp;If you try to use the<br>
connection again Storm will attempt to reconnect to the database<br>
automatically. &nbsp;If that fails, it'll raise DisconnectionError again.<br><div class="im">
<br>
&gt; To prove that is the issue I took a cgi to wsgi gateway from python PEP<br>
&gt; somewhere, fix it a bit so I can convert the whole wsgi to use cgi. Now<br>
&gt; problem goes away, I can restart mysql server but the application still<br>
&gt; works as expected.<br><br>
</div>Yep, this is because the CGI application is opening a new connection<br>
to the database for each request. &nbsp;If the database disappeared during<br>
the CGI request you'd see the same exception.<br><br>
Thanks,<br>J.<br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Steve Kieu<br>
</div>

Gmane