def new_expiration(self): self.pool = j.sals.zos.get().pools.get(self.pool_id) cu, su = deployer.calculate_capacity_units(**self.query) expiration_time = min(self.pool.cus / cu, self.pool.sus / su) if expiration_time < 60 * 60: default_time = j.data.time.utcnow().timestamp + 1209600 self.expiration = deployer.ask_expiration( self, default_time, pool_empty_at=j.data.time.utcnow().timestamp + expiration_time ) else: self.expiration = 0
def new_expiration(self): self.pool = j.sals.zos.get().pools.get(self.pool_id) cloud_units = deployer._calculate_cloud_units(**self.query) cu, su = cloud_units.cu, cloud_units.su # guard in case of extending of 0 will raise zero division if not cu: cu = 1 if not su: expiration_time = self.pool.cus / cu else: expiration_time = min(self.pool.cus / cu, self.pool.sus / su) if expiration_time < 60 * 60: default_time = j.data.time.utcnow().timestamp + 1209600 self.expiration = deployer.ask_expiration( self, default_time, pool_empty_at=j.data.time.utcnow().timestamp + expiration_time ) else: self.expiration = 0
def new_expiration(self): default_time = j.data.time.utcnow().timestamp + 1209600 self.expiration = deployer.ask_expiration(self, default_time)