Beispiel #1
0
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'}
Beispiel #2
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'
    }
Beispiel #3
0
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
Beispiel #4
0
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'}