app/soc/models/timeline.py
author Sverre Rabbelier <srabbelier@gmail.com>
Sun, 19 Apr 2009 17:42:44 +0000
changeset 2246 c29272f640b0
parent 1475 22b63ab59b27
permissions -rw-r--r--
Tweak the 'load balancing' algorithm In order to reduce contention we randomly skipped jobs, but this caused many jobs to end up stopping early. Now instead we keep on going until we time out (also increased the chance of doing work). Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
1308
35b75ffcbb37 Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
     3
# Copyright 2008 the Melange authors.
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
771
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    17
"""This module contains the Timeline Model.
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    18
"""
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
]
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from google.appengine.ext import db
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    27
from django.utils.translation import ugettext
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
1475
22b63ab59b27 Make timeline a Linkable
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    29
from soc.models import linkable
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
766
046b4b51eabf Made Program reference Timeline
Sverre Rabbelier <srabbelier@gmail.com>
parents: 765
diff changeset
    31
1475
22b63ab59b27 Make timeline a Linkable
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    32
class Timeline(linkable.Linkable):
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
  """The Timeline Model, representing the timeline for a Program.
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
  """
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
771
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    36
  program_start = db.DateTimeProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    37
      verbose_name=ugettext('Program Start date'))
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
771
0b1beae179f5 Typo and style fixes.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 766
diff changeset
    39
  program_end = db.DateTimeProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    40
      verbose_name=ugettext('Program End date'))
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
  org_signup_start = db.DateTimeProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    43
      verbose_name=ugettext('Organization Signup Start date'))
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  org_signup_end  = db.DateTimeProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    46
      verbose_name=ugettext('Organization Signup End date'))
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  student_signup_start  = db.DateTimeProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    49
      verbose_name=ugettext('Student Signup Start date'))
764
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
e0293fa7b342 Added a basic Timeline model
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
  student_signup_end = db.DateTimeProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 776
diff changeset
    52
      verbose_name=ugettext('Student Signup End date'))