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' }
class Taste(DBObject.DBObject): Fields = [ DBFields.VarCharField('taste', length=16, key=True), DBFields.VarCharField('goodbad', length=16, index=True), DBFields.IntListField('states', index=True, indexlen=8) ] def __init__(self, *args, **kw): DBObject.DBObject.__init__(self, *args, **kw)
class StudioJob(Job): """Job submitted to the scheduling system from within the studio. @ivar tool: name of the tool that created this job (e.g. lumos, supe, etc.) @ivar menv: version of menv that the job needs. @ivar dept: department this job was submitted from. """ Fields = [ DBFields.VarCharField('tool', length=32), DBFields.VarCharField('menv', length=32), DBFields.VarCharField('dept', length=64, index=True) ]
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'}
class TaskAttempt(DBObject.DBObject): """Every time a task is attempted (either from initial startup or from a retry) a TaskInvocation object is created. This holds all the data relevent to the attempt. @ivar jobid: unique identifier for the job the tasks belong to @ivar taskid: unique identifier for the task within the job @ivar state: the current state of the task @ivar slots: list of the slots checked out for this invocation. @ivar readytime: the time this attempt became ready. @ivar pickuptime: the time the first command started (derived) @ivar statetime: the time the task entered its current state (derived) @ivar activesecs: the total time the task was active (derived) """ Fields = [ DBFields.IntField('jobid', unsigned=True, key=True), DBFields.IntField('taskid', unsigned=True, key=True), DBFields.VarCharField('state', length=12, index=True, indexlen=8), DBFields.StrListField('slots', index=True, indexlen=8), DBFields.TimeIntField('readytime', index=True), DBFields.TimeIntField('pickuptime', index=True), DBFields.TimeIntField('statetime', index=True), DBFields.IntField('activesecs', unsigned=True, index=True) ] Aliases = {'jid': 'jobid', 'tid': 'taskid'}
class ShotJob(StudioJob): """Any job submitted for the purpose of a single shot. Most jobs are of this type and often render one or more frames in the shot. @ivar shot: the name of the shot @ivar firstframe: first frame this job is responsible for @ivar lastframe: last frame this job is responsible for @ivar numframes: total number of frames this job is responsible for @ivar framestep: job submitted on 1s, 2s, 4s, etc. """ Fields = [ DBFields.VarCharField('shot', length=255, index=True), DBFields.IntField('firstframe', index=True), DBFields.IntField('lastframe', index=True), DBFields.IntField('numframes', unsigned=True, index=True), DBFields.IntField('framestep') ] Aliases = { 'fframe': 'firstframe', 'first': 'firstframe', 'last': 'lastframe', 'lframe': 'lastframe', 'nframes': 'numframes', 'fstep': 'framestep', 'on': 'framestep' }
class Fruit(DBObject.DBObject): """ @ivar fruit: name of the fruit @ivar flavour: what does the fruit taste like @ivar seasons: when is this fruit in season """ Fields = [ DBFields.VarCharField('fruit', length=16, key=True), DBFields.VarCharField('taste', length=16, index=True, member='flavour'), DBFields.StrListField('seasons') ] Aliases = {'seas': 'seasons'} def __init__(self, *args, **kw): DBObject.DBObject.__init__(self, *args, **kw) self.price = 1.99
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
class Song(DBObject.DBObject): Fields = (DBFields.IntField('artistid', unsigned=True, key=True), DBFields.IntField('albumid', unsigned=True, key=True), DBFields.VarCharField('title', length=128, indexlen=8, index=True), DBFields.SmallIntField('tracknum', unsigned=True), DBFields.SmallIntField('discnum', unsigned=True), DBFields.SecsIntField('length', index=True), DBFields.ByteIntField('filesize')) Aliases = {'song': 'title', 'name': 'title'}
class Task(DBObject.DBObject): """Base class for all tasks. @ivar jobid: unique identifier for the job the tasks belong to @ivar taskid: unique identifier for the task within the job @ivar previds: list of the task ids that must finish before we can start @ivar nextids: list of the task ids that are waiting for us to finish @ivar title: title of this task @ivar priority: the priority of this task @ivar keystr: the original key expression used to determine if this task can run on a given slot. @ivar keys: a list of all the keys found in the key string @ivar tags: a list of the tags needed by the task @ivar wdir: working directory of the task. """ States = ('active', 'blocked', 'canceled', 'cleaning', 'done', 'error', 'groupstall', 'larval', 'linger', 'paused', 'ready', 'thwarted', 'unknown') Fields = [ DBFields.IntField('jobid', unsigned=True, key=True), DBFields.IntField('taskid', unsigned=True, key=True), DBFields.IntListField('previds'), DBFields.IntListField('nextids'), DBFields.VarCharField('state', length=12, index=True, indexlen=8), DBFields.VarCharField('title', length=255, index=True), DBFields.FloatField('priority', index=True), DBFields.VarCharField('keystr', length=128, index=True), DBFields.StrListField('keylist', ftype='varchar(128)', index=True, member='keys'), DBFields.VarCharField('tags', length=64), DBFields.BlobField('wdir') ] Aliases = {'jid': 'jobid', 'tid': 'taskid', 'pri': 'priority'}