Add executor-specific setup time support
This will allow us to make the setup time TTL for k8s-based builds much lower (on the order of a minute), which means faster timeouts and fallbacks (which is a better user experience).
This commit is contained in:
parent
9aac68fbeb
commit
ef41e57aad
3 changed files with 12 additions and 3 deletions
|
@ -373,7 +373,7 @@ class EphemeralBuilderManager(BaseManager):
|
|||
# Load components for all realms currently known to the cluster
|
||||
async(self._register_existing_realms())
|
||||
|
||||
def setup_time(self):
|
||||
def overall_setup_time(self):
|
||||
return self._ephemeral_setup_timeout
|
||||
|
||||
def shutdown(self):
|
||||
|
@ -418,7 +418,6 @@ class EphemeralBuilderManager(BaseManager):
|
|||
realm = str(uuid.uuid4())
|
||||
token = str(uuid.uuid4())
|
||||
nonce = str(uuid.uuid4())
|
||||
setup_time = self.setup_time()
|
||||
|
||||
machine_max_expiration = self._manager_config.get('MACHINE_MAX_TIME', 7200)
|
||||
max_expiration = datetime.utcnow() + timedelta(seconds=machine_max_expiration)
|
||||
|
@ -526,6 +525,9 @@ class EphemeralBuilderManager(BaseManager):
|
|||
})
|
||||
|
||||
try:
|
||||
setup_time = started_with_executor.setup_time or self.overall_setup_time()
|
||||
logger.debug('Writing job key for job %s using executor %s with ID %s and ttl %s', build_uuid,
|
||||
started_with_executor.name, execution_id, setup_time)
|
||||
yield From(self._etcd_client.write(self._etcd_realm_key(realm), realm_spec, prevExist=False,
|
||||
ttl=setup_time))
|
||||
except (KeyError, etcd.EtcdKeyError):
|
||||
|
|
Reference in a new issue