|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: [TBA]: TBATV v4 Development Log
Quote:
|
|
#2
|
||||||
|
||||||
|
Re: [TBA]: TBATV v4 Development Log
This is probably what we'll end up doing. I don't think rendering templates is very expensive compared to everything else, so that should be clean and easy.
|
|
#3
|
||||||
|
||||||
|
Re: [TBA]: TBATV v4 Development Log
Here is a screenshot of AppStats showing the problem with the Match, MatchTeam, MatchScore object model. All of the database gets and puts to insert a Match add up to a lot of CPU time.
I wonder if storing everything in Match using a red1, red2, red3, blue1, blue2, blue3 system or a red_teams, blue_teams list reference property is a better idea. I'd really love for these relation objects to be faster, but when we render a full event worth of matches, it takes almost 20 seconds. Does anyone know if it is possible to non-lazily query a bunch of objects ReferenceProperties all at once? Like say, "I want all the Matches, and their MatchTeam objects, and the Team objects on the other end of those"? Last edited by Greg Marra : 02-07-2010 at 21:22. |
|
#4
|
||||||
|
||||||
|
Re: [TBA]: TBATV v4 Development Log
I am going to change the Match model to be less flexible so we can speed up datastore performance.
I am thinking we will have a Match have Match.teams, which will be a ListProperty that stores the Teams in the match. Separately, we will store Match.alliances, which will contain a dictionary shaped like {"red": ["frc177", "frc195", "frc125"], "blue": ["frc433", "frc190", "frc222"]}. The teams property will basically be an index to let us quickly search by team, and the alliances property will store the actual structure of the alliances. We'll add another property to Matches called "game", where we write down which FRC game was being played. This way, if they change the game structure in the future (or we get data on past games), we'll easily be able to adjust Controllers to handle it without having to muck with the model. New concept: Code:
class Match(db.Model):
"""
Matches represent individual matches at Events.
Matches have many Videos.
key_name is like 2010ct_qm10 or 2010ct_sf1m2
"""
event = db.ReferenceProperty(Event,
required=True)
time = db.DateTimeProperty()
comp_level = db.StringProperty(required=True,choices=set(["Qualifications", "Quarterfinals", "Semifinals", "Finals"])) # This choices set should probably become a global Constant somewhere. How do you do that in Python properly? -greg 5/20/2010
set_number = db.IntegerProperty(required=True)
match_number = db.IntegerProperty(required=True)
teams = db.ListProperty(Team) #Primarily for indexing and searching
alliances = db.StringProperty #Store a Dictionary as a JSON string
scores = db.StringProperty #Store a Dictionary as a JSON string
Similarly, by changing from having a bunch of EventTeam objects, we could make teams a ListProperty of an Event. Then to get all of the Teams at an Event would require just finding the Event, instead of finding all of the EventTeams. This is switching away from a many-to-many relationship to many one-to-many relationships. I haven't had much time to work on development, but I think these new ideas will remove some of the major roadblocks that existed. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TBA]: [TBA] Curie 2006 and soap108.com | jblay | The Blue Alliance | 3 | 21-04-2010 00:25 |
| [TBA]: Kickoff 2009 Liveblogging Site Development | Greg Marra | The Blue Alliance | 23 | 30-12-2008 18:37 |
| [TBA]: h.264 Video Analysis, and Improving TBATV Video Quality | artdutra04 | The Blue Alliance | 5 | 29-09-2008 00:29 |
| [TBA]: API Client Development | Greg Marra | The Blue Alliance | 21 | 04-05-2008 20:06 |
| [TBA] TBA Presents... Soldering and Multimeter Tutorials | Greg Marra | General Forum | 0 | 27-01-2007 20:15 |