IRC log for #storm on 20100401

00:00.38*** join/#storm danilos (~danilo@canonical/launchpad/danilos)
00:00.57midgetspyI have Foo with primary key (a, b, c) and Bar with primary key d. I want to build a M<->M relationship between the two objects, so I have a link object with keys a, b, c, d. I then tried passing all 4 pairs into ReferenceSet but get an exception due to too many arguments to the constructor. what's the proper way to do this?
01:17.44*** join/#storm danilos (~danilo@canonical/launchpad/danilos)
02:13.38*** join/#storm bob2_ (rob@egads.ertius.org)
02:29.28midgetspyhow does storm handle multithreading (with sqlite)? should I be using a lock for the store object?
05:29.04*** join/#storm bob2 (rob@unaffiliated/bob2)
05:46.48*** join/#storm jukart (lovely@81.189.156.94)
06:43.27*** join/#storm hazmat (~kapil@64.126.138.247)
07:20.41*** join/#storm stub (~stub@canonical/launchpad/stub)
08:57.40*** join/#storm zmijunkie (~chatzilla@i59F5F2D5.versanet.de)
12:15.45*** join/#storm salgado (~salgado@canonical/launchpad/salgado)
12:44.09*** join/#storm fcorrea (~fcorrea@187.3.154.39)
12:53.56*** join/#storm niemeyer (~niemeyer@201-40-138-24.pltce701.dsl.brasiltelecom.net.br)
13:23.31*** join/#storm elmom (~elmom@hoasnet-fe29dd00-137.dhcp.inet.fi)
13:29.46*** join/#storm bac (~bac@cpe-065-190-186-163.nc.res.rr.com)
13:29.46*** join/#storm bac (~bac@canonical/launchpad/bac)
14:35.02midgetspyI have Foo with primary key (a, b, c) and Bar with primary key d. I want to build a M<->M relationship between the two objects, so I have a link object with keys a, b, c, d. I see that ReferenceSet only takes two pairs, so how do I make a relationship with more keys than that?
14:35.16midgetspyalso how does storm handle multithreading (with sqlite)? should I be using a lock for the store object?
14:36.48therve1) you don't really have multiple keys, you have a compound key
14:37.06thervethe first key being (a, b, c), the second one d
14:37.56therve2) storm doesn't "handle" multiplethreading specifically. It is threadsafe. If you use sqlite, you may need to have only store with locks around it indeed
14:40.48midgetspytherve: how can I make ReferenceSet with a compound key then?
14:41.21thervemidgetspy: pass (a, b, c) as first argument and d as second?
14:41.28midgetspyhm
14:41.38midgetspyI'll give it a try, thanks
14:46.21*** join/#storm skrite (~skrite@pivotrac.texaspivot.com)
14:57.20skritehey all
15:03.14thervehey you
15:06.05skritei recently upgraded our operating system on our server from ubuntu 8.10 to 9.10 | i also moved from MyISAM to InnoDB. ever since, i have been getting, a few times a day, an error regarding Dead Lock while trying to read.
15:06.17skriteAny gotchas i might need to know about?
15:07.20therveso, storm shouldn't even run on MyISAM? or at least it doesn't do transaction
15:07.35thervethe error you get looks mysql specific, unfortunately
15:10.11skriteok
15:11.24skriteactually i did run storm on MyISAM. Even though it was not recommended. due to a bug in the InnoDB regarding row-locking that existed at the time. Storm did a great job.
15:11.45skritebetter than advertized :0
15:12.05skriteso i will look into the MySQL problem.
15:37.11*** join/#storm danilos (~danilo@canonical/launchpad/danilos)
15:51.53*** join/#storm elmom (~elmom@62.236.159.117)
15:57.15*** join/#storm stub1 (~stub@ppp-58-8-211-171.revip2.asianet.co.th)
15:57.18*** join/#storm stub (~stub@canonical/launchpad/stub)
16:04.05*** join/#storm salgado (~salgado@canonical/launchpad/salgado)
16:44.53*** join/#storm danilos (~danilo@canonical/launchpad/danilos)
16:52.03midgetspyso when exactly does storm start a transaction? If I change a property value on an object in memory does a transaction start then? or only if it's been flushed? (I'm wondering when I will have to be committing to avoid having my db locked for long periods of time)
17:25.56midgetspyso when exactly does storm start a transaction? If I change a property value on an object in memory does a transaction start then? or only if it's been flushed? (I'm wondering when I will have to be committing to avoid having my db locked for long periods of time)
17:25.59midgetspygrr sorry again
17:26.21midgetspykeep tabbing to the wrong window and pressing up-enter :-|
17:40.40jkakarmidgetspy: Storm starts transactions automatically.
17:40.50jkakarmidgetspy: They stop when you call store.commit or store.rollback.
17:42.42midgetspyjkakar: right, when do they start though? can i change a value on something in memory without starting a transaction?
17:44.09jkakarmidgetspy: They start when the first statement is executed.
17:44.23jkakarmidgetspy: This can happen because Storm flushes queries, sending them to the database.
17:44.35jkakarmidgetspy: Or when you call store.flush() and no automatic flush has occurred.
17:44.48jkakarmidgetspy: Or when you call store.execute() and no automatic flush has occurred.
17:44.52jkakarmidgetspy: IOW, it's hard to tell when they start.
17:45.30jkakarmidgetspy: You're using SQLite, right?
17:45.48midgetspyyes
17:45.51jkakarmidgetspy: You can see where this happens in the code at storm/databases/sqlite.py, specifically in SQLiteConnection.raw_execute.
17:46.23midgetspyok I will look into it, thanks
17:51.41midgetspyhmm, I've got an object with a property that's a ReferenceSet and when I do print myObj.theproperty.count(); myObj.theproperty.add(another); print myObj.theproperty.count() it prints 0 then 2 (it adds it twice). any idea where I should start troubleshooting that?
17:59.17midgetspyah never mind, I was creating a second object when I tried adding it rather than using store.find to retrieve the existing object
18:06.23*** join/#storm keppla (~keppla@i577B1959.versanet.de)
18:28.17*** join/#storm mup_ (~mup@li37-90.members.linode.com)
18:46.35midgetspyIs there a storm function to retrieve an object by primary key or create one if it doesn't exist or should I be doing that logic myself? I thought creating a new object with the primary key I want might just load the values from the DB but I get a key error instead
19:47.55*** join/#storm yosafbridge (~yosafbrid@li14-39.members.linode.com)
21:19.19jkakarmidgetspy: Nope, no such function.
21:19.45jkakarmidgetspy: You can use store.get(ClassType, key_value) to get an object by primary key, but it returns None if the matching object isn't in the database.
21:20.09jkakarmidgetspy: It's preferable to store.find(ClassType, ClassType.id == key_value).one() when you only want to fetch a single object because, if the object is in Storm's cache, it won't execute a query.
21:20.26jkakarmidgetspy: Store.find always executes a query, even if the objects that end up getting returned are from the cache.
21:25.44midgetspythanks jkakar
21:25.52jkakarmidgetspy: np
21:26.30midgetspyis there any way to proxy attributes from a Reference'd object?
21:26.53midgetspy(aside from manually doing it with __setattr__() and __getattr__())
21:28.12midgetspyeg. Outer has an attribute foo which is a Reference() to a type Inner. I'd like to access foo's attributes through Outer like outer.myattr rather than outer.foo.myattr
21:31.38*** join/#storm danilo_ (~danilo@static-213-198-236-193.adsl.eunet.rs)
21:36.56jkakarmidgetspy: Nope.
21:39.57midgetspyhmm
21:45.03midgetspyI guess storm uses __getattr__ too so I can't do it that way either... doh
21:46.52midgetspyah well, I can type the extra attribute level :0)
21:56.03*** join/#storm shaunm (~shaunm@c-98-212-133-244.hsd1.il.comcast.net)
23:04.53*** join/#storm jamesh (~james@canonical/launchpad/jamesh)
23:28.08*** join/#storm fcorrea (~fcorrea@201-75-152-196-nd.cpe.vivax.com.br)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.