Exemple #1
0
class Properties(base.ResourceType):

    name = "property"
    plural = "properties"
    endpoints = [BuildsetPropertiesEndpoint, BuildPropertiesEndpoint]
    keyFields = []

    entityType = types.SourcedProperties()
Exemple #2
0
 class EntityType(types.Entity):
     buildid = types.Integer()
     number = types.Integer()
     builderid = types.Integer()
     buildrequestid = types.Integer()
     workerid = types.Integer()
     masterid = types.Integer()
     started_at = types.DateTime()
     complete = types.Boolean()
     complete_at = types.NoneOk(types.DateTime())
     results = types.NoneOk(types.Integer())
     state_string = types.String()
     properties = types.NoneOk(types.SourcedProperties())
Exemple #3
0
class Properties(base.ResourceType):

    name = "property"
    plural = "properties"
    endpoints = [BuildsetPropertiesEndpoint, BuildPropertiesEndpoint]
    keyFields = []

    entityType = types.SourcedProperties()

    @base.updateMethod
    def setBuildProperty(self, buildid, name, value, source):
        return self.master.db.builds.setBuildProperty(
            buildid, name, value, source)
Exemple #4
0
 class EntityType(types.Entity):
     buildrequestid = types.Integer()
     buildsetid = types.Integer()
     builderid = types.Integer()
     priority = types.Integer()
     claimed = types.Boolean()
     claimed_at = types.NoneOk(types.DateTime())
     claimed_by_masterid = types.NoneOk(types.Integer())
     complete = types.Boolean()
     results = types.NoneOk(types.Integer())
     submitted_at = types.DateTime()
     complete_at = types.NoneOk(types.DateTime())
     waited_for = types.Boolean()
     properties = types.NoneOk(types.SourcedProperties())
Exemple #5
0
 class EntityType(types.Entity):
     changeid = types.Integer()
     author = types.String()
     files = types.List(of=types.String())
     comments = types.String()
     revision = types.NoneOk(types.String())
     when_timestamp = types.Integer()
     branch = types.NoneOk(types.String())
     category = types.NoneOk(types.String())
     revlink = types.NoneOk(types.String())
     properties = types.SourcedProperties()
     repository = types.String()
     project = types.String()
     codebase = types.String()
     sourcestamp = sourcestamps.SourceStamp.entityType
Exemple #6
0
class Properties(base.ResourceType):

    name = "property"
    plural = "properties"
    endpoints = [BuildsetPropertiesEndpoint, BuildPropertiesEndpoint]
    keyFields = []

    entityType = types.SourcedProperties()

    def generateUpdateEvent(self, buildid, newprops):
        # This event cannot use the produceEvent mechanism, as the properties resource type is a bit
        # specific (this is a dictionary collection)
        # We only send the new properties, and count on the client to merge the resulting properties
        # dict
        # We are good, as there is no way to delete a property.
        routingKey = ('builds', str(buildid), "properties", "update")
        newprops = self.sanitizeMessage(newprops)
        return self.master.mq.produce(routingKey, newprops)

    @base.updateMethod
    @defer.inlineCallbacks
    def setBuildProperties(self, buildid, properties):
        to_update = {}
        oldproperties = yield self.master.data.get(
            ('builds', str(buildid), "properties"))
        properties = properties.getProperties()
        properties = yield properties.render(properties.asDict())
        for k, v in properties.items():
            if k in oldproperties and oldproperties[k] == v:
                continue
            to_update[k] = v

        if to_update:
            for k, v in to_update.items():
                yield self.master.db.builds.setBuildProperty(
                    buildid, k, v[0], v[1])
            yield self.generateUpdateEvent(buildid, to_update)

    @base.updateMethod
    @defer.inlineCallbacks
    def setBuildProperty(self, buildid, name, value, source):
        res = yield self.master.db.builds.setBuildProperty(
            buildid, name, value, source)
        yield self.generateUpdateEvent(buildid, dict(name=(value, source)))
        return res