~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/buildmaster/interfaces/builder.py

Fix lint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    exported,
28
28
    operation_parameters,
29
29
    operation_returns_entry,
30
 
    operation_returns_collection_of,
31
 
    operation_for_version,
32
 
    )
33
 
from lazr.restful.fields import (
34
 
    Reference,
35
 
    ReferenceChoice,
36
30
    )
37
31
from zope.interface import (
38
32
    Attribute,
40
34
    )
41
35
from zope.schema import (
42
36
    Bool,
 
37
    Choice,
43
38
    Field,
44
39
    Int,
45
40
    Text,
50
45
from lp.app.validators.name import name_validator
51
46
from lp.app.validators.url import builder_url_validator
52
47
from lp.registry.interfaces.role import IHasOwner
53
 
from lp.soyuz.interfaces.processor import IProcessor
54
48
from lp.services.fields import (
55
49
    Description,
56
50
    PersonChoice,
112
106
 
113
107
    id = Attribute("Builder identifier")
114
108
 
115
 
    processor = exported(ReferenceChoice(
 
109
    processor = Choice(
116
110
        title=_('Processor'), required=True, vocabulary='Processor',
117
 
        schema=IProcessor,
118
111
        description=_('Build Slave Processor, used to identify '
119
 
                      'which jobs can be built by this device.')),
120
 
        as_of='devel', readonly=True)
 
112
                      'which jobs can be built by this device.'))
121
113
 
122
114
    owner = exported(PersonChoice(
123
115
        title=_('Owner'), required=True, vocabulary='ValidOwner',
136
128
 
137
129
    title = exported(Title(
138
130
        title=_('Title'), required=True,
139
 
        description=_(
140
 
            'The builder slave title. Should be just a few words.')))
 
131
        description=_('The builder slave title. Should be just a few words.')))
141
132
 
142
133
    description = exported(Description(
143
134
        title=_('Description'), required=False,
208
199
        :param file_sha1: The file's sha1, which is how the file is addressed
209
200
            in the slave XMLRPC protocol. Specially, the file_sha1 'buildlog'
210
201
            will cause the build log to be retrieved and gzipped.
211
 
        :param filename: The name of the file to be given to the librarian
212
 
            file alias.
 
202
        :param filename: The name of the file to be given to the librarian file
 
203
            alias.
213
204
        :param private: True if the build is for a private archive.
214
205
        :return: A Deferred that calls back with a librarian file alias.
215
206
        """
247
238
 
248
239
    def updateStatus(logger=None):
249
240
        """Update the builder's status by probing it.
250
 
 
 
241
        
251
242
        :return: A Deferred that fires when the dialog with the slave is
252
243
            finished.  It does not have a return value.
253
244
        """
254
245
 
255
246
    def cleanSlave():
256
247
        """Clean any temporary files from the slave.
257
 
 
 
248
        
258
249
        :return: A Deferred that fires when the dialog with the slave is
259
250
            finished.  It does not have a return value.
260
251
        """
394
385
    def getBuilders():
395
386
        """Return all active configured builders."""
396
387
 
397
 
    @export_read_operation()
398
 
    @operation_for_version('devel')
 
388
    def getBuildersByArch(arch):
 
389
        """Return all configured builders for a given DistroArchSeries."""
 
390
 
399
391
    def getBuildQueueSizes():
400
392
        """Return the number of pending builds for each processor.
401
393
 
402
394
        :return: a dict of tuples with the queue size and duration for
403
 
            each processor and virtualisation. For example::
404
 
 
405
 
                {
406
 
                    'virt': {
407
 
                                '386': (1, datetime.timedelta(0, 60)),
408
 
                                'amd64': (2, datetime.timedelta(0, 30)),
409
 
                            },
410
 
                    'nonvirt':...
411
 
                }
 
395
            each processor and virtualisation. For example:
 
396
            {
 
397
                'virt': {
 
398
                            '386': (1, datetime.timedelta(0, 60)),
 
399
                            'amd64': (2, datetime.timedelta(0, 30)),
 
400
                        },
 
401
                'nonvirt':...
 
402
            }
412
403
 
413
404
            The tuple contains the size of the queue, as an integer,
414
405
            and the sum of the jobs 'estimated_duration' in queue,
415
406
            as a timedelta or None for empty queues.
416
407
        """
417
408
 
418
 
    @operation_parameters(
419
 
        processor=Reference(
420
 
            title=_("Processor"), required=True, schema=IProcessor),
421
 
        virtualized=Bool(
422
 
            title=_("Virtualized"), required=False, default=True))
423
 
    @operation_returns_collection_of(IBuilder)
424
 
    @export_read_operation()
425
 
    @operation_for_version('devel')
426
409
    def getBuildersForQueue(processor, virtualized):
427
410
        """Return all builders for given processor/virtualization setting."""