def announceGenerate(self):
        DistributedDistrictAI.announceGenerate(self)

        # Remember the time of which this district was created:
        self.created = int(time.time())

        # We want to handle shard status queries so that a ShardStatusReceiver
        # being created after we're generated will know where we're at:
        self.air.netMessenger.accept('queryShardStatus', self,
                                     self.handleShardStatusQuery)

        # Send a shard status update with the information we have:
        status = {
            'available': bool(self.available),
            'name': self.name,
            'created': int(time.time())
        }
        self.air.netMessenger.send('shardStatus',
                                   [self.air.ourChannel, status])

        # Add a post remove shard status update in-case we go down:
        status = {'available': False}
        datagram = self.air.netMessenger.prepare('shardStatus',
                                                 [self.air.ourChannel, status])
        self.air.addPostRemove(datagram)
    def announceGenerate(self):
        DistributedDistrictAI.announceGenerate(self)

        # Remember the time of which this district was created:
        self.created = int(time.time())

        # We want to handle shard status queries so that a ShardStatusReceiver
        # being created after we're generated will know where we're at:
        self.air.accept("queryShardStatus", self.handleShardStatusQuery)

        # Send a shard status update with the information we have:
        status = {"available": bool(self.available), "name": self.name, "created": int(time.time())}
        self.air.sendNetEvent("shardStatus", [self.air.ourChannel, status])
Пример #3
0
 def announceGenerate(self):
     DistributedDistrictAI.announceGenerate(self)
     self.created = int(time.time())
     self.air.netMessenger.accept('queryShardStatus', self,
                                  self.handleShardStatusQuery)
     status = {
         'available': bool(self.available),
         'name': self.name,
         'created': int(time.time())
     }
     self.air.netMessenger.send('shardStatus',
                                [self.air.ourChannel, status])
     status = {'available': False}
     datagram = self.air.netMessenger.prepare('shardStatus',
                                              [self.air.ourChannel, status])
     self.air.addPostRemove(datagram)
    def announceGenerate(self):
        DistributedDistrictAI.announceGenerate(self)

        # Remember the time of which this district was created:
        self.created = int(time.time())

        # We want to handle shard status queries so that a ShardStatusReceiver
        # being created after we're generated will know where we're at:
        self.air.accept('queryShardStatus', self.handleShardStatusQuery)

        # Send a shard status update with the information we have:
        status = {
            'available': bool(self.available),
            'name': self.name,
            'created': int(time.time())
        }
        self.air.sendNetEvent('shardStatus', [self.air.ourChannel, status])
Пример #5
0
    def announceGenerate(self):
        DistributedDistrictAI.announceGenerate(self)

        # Remember the time of which this district was created:
        self.created = int(time.time())

        # We want to handle shard status queries so that a ShardStatusReceiver
        # being created after we're generated will know where we're at:
        self.air.netMessenger.accept('queryShardStatus', self, self.handleShardStatusQuery)

        # Send a shard status update with the information we have:
        status = {
            'available': bool(self.available),
            'name': self.name,
            'created': int(time.time())
        }
        self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status])

        # Add a post remove shard status update in-case we go down:
        status = {'available': False}
        datagram = self.air.netMessenger.prepare('shardStatus', [self.air.ourChannel, status])
        self.air.addPostRemove(datagram)
Пример #6
0
 def announceGenerate(self):
     DistributedDistrictAI.announceGenerate(self)
Пример #7
0
 def announceGenerate(self):
     DistributedDistrictAI.announceGenerate(self)