yield builder
- async def sync(self, *args, **kwargs):
- """
- Synchronize any state with AWS
- """
- log.info("Syncing state with AWS")
-
- # Sync all builders
- async with asyncio.TaskGroup() as tasks:
- for builder in self:
- tasks.create_task(
- builder.sync(),
- )
-
async def autoscale(self, wait=False):
"""
This method performs two tasks:
if self.instance_id:
return self.backend.aws.ec2.Instance(self.instance_id)
- async def sync(self):
- log.info("Syncing AWS state for %s" % self)
-
- if not self.instance:
- log.debug("%s does not have an instance ID" % self)
- return
-
- # This callback is being executed in a separate thread
- # because boto3 is not thread-safe
- def callback():
- log.debug("%s is currently in state: %s" % (self, self.instance.state))
-
- # Launch in a separate thread
- await asyncio.to_thread(callback)
-
async def is_running(self):
"""
Returns True if this builder is currently running
# Launch some initial tasks
self.backend.run_task(self.backend.users.generate_vapid_keys)
- self.backend.run_task(self.backend.builders.sync)
self.backend.run_task(self.backend.builders.autoscale)
# Regularly check the mirrors