Esempio n. 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'
    }
Esempio n. 2
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'}