Example #1
0
class Job(DBObject.DBObject):
    """The base type for all jobs submitted to the scheduling system.

    @ivar jobid:      unique identifier of the job
    @ivar user:       user that submitted the job
    @ivar host:       host where the job was submitted from
    @ivar title:      title of the job
    @ivar priority:   priority of this job to determine placement in the queue
    @ivar huntgroups: list of slot groups this job can run on
    @ivar spooltime:  time this job was spooled
    @ivar stoptime:   time this job finished or was canceled.
    @ivar deletetime: time this job was deleted from the scheduling system.
    @ivar numtasks:   total number of tasks in this job
    @ivar active:     total number of active tasks in this job.
    @ivar blocked:    total number of blocked tasks in this job.
    @ivar done:       total number of done tasks in this job.
    @ivar error:      total number of errored tasks in this job.
    @ivar ready:      total number of ready tasks in this job.
    @ivar other:      total number of tasks in a state other than active,
                       blocked, done, error, or ready.

    @ivar graph:      a compressed representation of the job graph containing
                      all the dependencies. (gziped as well)

    """

    Fields = [
        DBFields.AutoIncField('jobid'),
        DBFields.VarCharField('user', length=16, index=True),
        DBFields.VarCharField('host', length=64, index=True),
        DBFields.IntField('port', unsigned=True),
        DBFields.VarCharField('title', length=255, index=True),
        DBFields.FloatField('priority', index=True),
        DBFields.StrListField('huntgroups', ftype='varchar(255)', index=True),
        DBFields.TimeIntField('spooltime', index=True),
        DBFields.TimeIntField('stoptime', index=True),
        DBFields.TimeIntField('deletetime', index=True),
        DBFields.IntField('numtasks', unsigned=True, index=True),
        DBFields.IntField('active', unsigned=True, index=True),
        DBFields.IntField('blocked', unsigned=True, index=True),
        DBFields.IntField('done', unsigned=True, index=True),
        DBFields.IntField('error', unsigned=True, index=True),
        DBFields.IntField('ready', unsigned=True, index=True),
        DBFields.IntField('other', unsigned=True, index=True),
        DBFields.BlobField('graph')
    ]

    VirtualFields = [DispatcherField('dispatcher', ['user', 'host', 'port'])]

    Aliases = {
        'actv': 'active',
        'crews': 'huntgroups',
        'deleted': 'deletetime',
        'jid': 'jobid',
        'pri': 'priority',
        'spooled': 'spooltime',
        'stopped': 'stoptime',
        'disp': 'dispatcher'
    }
Example #2
0
class Artist(DBObject.DBObject):
    Fields = (DBFields.AutoIncField('artistid'),
              DBFields.VarCharField('name', length=128, equivKey=True),
              DBFields.SmallIntField('albums'))

    Aliases = {'artist': 'name'}

    def __init__(self, name):
        """Initialize the Artist object with the their name."""
        # we must call the init of the base class before we can do anything.
        DBObject.__init__(self)
        self.name = name
Example #3
0
class Album(DBObject.DBObject):
    Fields = (DBFields.AutoIncField('albumid'),
              DBFields.IntField('artistid', unsigned=True, equivKey=True),
              DBFields.VarCharField('name', length=128, indexlen=8,
                                    index=True),
              DBFields.VarCharField('genre',
                                    length=128,
                                    indexlen=8,
                                    index=True),
              DBFields.TimeIntField('released', index=True),
              DBFields.SmallIntField('year', unsigned=True, index=True),
              DBFields.SmallIntField('tracks', unsigned=True),
              DBFields.SmallIntField('discs', unsigned=True))

    Aliases = {'album': 'name'}