lsd bug

6 views
Skip to first unread message

Pedro Rodriguez

unread,
May 15, 2012, 5:03:56 PM5/15/12
to lsd-...@googlegroups.com
I think I may have found a bug in lsd related to the mulithreading. My question pertains to whether or not the code below is threadsafe. Here is the code and some sample data I am getting back.

def generateNullROSATData():
    rows = db.query('select e_RAJ2000, e_DEJ2000 from ROSATData')
    iteratedRows = []
    changedRows = []
    i = 0
    for row in rows.iterate():
        iteratedRows.append(row)
    return iteratedRows

(54.03833, 31.31472), (40.56042, 7.745), (40.56042, 7.745), (40.56042, 7.745), (40.56042, 7.745), (40.56042, 7.745), (40.56042, 7.745), (40.56042, 7.745), (40.56042, 7.745), (342.33459, 48.81917), (342.33459, 48.81917), (342.33459, 48.81917), (338.20459, -5.49847), (338.20459, -5.49847), (338.20459, -5.49847), (338.20459, -5.49847)]

It seems like the same entry is getting added to the list multiple times. Is there a way to fix this or a safe way to get the rows to a list?

--
Pedro Rodriguez
UCBerkeley 2014 | Physics/AstroPhysics
SnowGeek.org Founder
ski.ro...@gmail.com
208-340-1703

Pedro Rodriguez

unread,
May 15, 2012, 5:35:59 PM5/15/12
to lsd-users
Found the bug, If there are suppose two threads running the code, the
row gets set by one then the other which results in repeated values.
Solution is to make a new element to append
> ski.rodrig...@gmail.com
> 208-340-1703
Reply all
Reply to author
Forward
0 new messages