|
30 | 30 | from .builder import BuildHandler |
31 | 31 | from .health import HealthHandler |
32 | 32 | from .launcher import Launcher |
| 33 | +from .log import log_request |
33 | 34 | from .registry import DockerRegistry |
34 | 35 | from .main import MainHandler, ParameterizedMainHandler, LegacyRedirectHandler |
35 | 36 | from .repoproviders import (GitHubRepoProvider, GitRepoProvider, |
@@ -306,20 +307,34 @@ def _valid_badge_base_url(self, proposal): |
306 | 307 | config=True |
307 | 308 | ) |
308 | 309 |
|
| 310 | + build_memory_request = ByteSpecification( |
| 311 | + 0, |
| 312 | + help=""" |
| 313 | + Amount of memory to request when scheduling a build |
| 314 | +
|
| 315 | + 0 reserves no memory. |
| 316 | +
|
| 317 | + This is used as the request for the pod that is spawned to do the building, |
| 318 | + even though the pod itself will not be using that much memory |
| 319 | + since the docker building is happening outside the pod. |
| 320 | + However, it makes kubernetes aware of the resources being used, |
| 321 | + and lets it schedule more intelligently. |
| 322 | + """, |
| 323 | + config=True, |
| 324 | + ) |
309 | 325 | build_memory_limit = ByteSpecification( |
310 | 326 | 0, |
311 | 327 | help=""" |
312 | 328 | Max amount of memory allocated for each image build process. |
313 | 329 |
|
314 | 330 | 0 sets no limit. |
315 | 331 |
|
316 | | - This is used as both the memory limit & request for the pod |
317 | | - that is spawned to do the building, even though the pod itself |
318 | | - will not be using that much memory since the docker building is |
319 | | - happening outside the pod. However, it makes kubernetes aware of |
320 | | - the resources being used, and lets it schedule more intelligently. |
| 332 | + This is applied to the docker build itself via repo2docker, |
| 333 | + though it is also applied to our pod that submits the build, |
| 334 | + even though that pod will rarely consume much memory. |
| 335 | + Still, it makes it easier to see the resource limits in place via kubernetes. |
321 | 336 | """, |
322 | | - config=True |
| 337 | + config=True, |
323 | 338 | ) |
324 | 339 |
|
325 | 340 | debug = Bool( |
@@ -572,43 +587,47 @@ def initialize(self, *args, **kwargs): |
572 | 587 | with open(schema_file) as f: |
573 | 588 | self.event_log.register_schema(json.load(f)) |
574 | 589 |
|
575 | | - self.tornado_settings.update({ |
576 | | - "push_secret": self.push_secret, |
577 | | - "image_prefix": self.image_prefix, |
578 | | - "debug": self.debug, |
579 | | - 'launcher': self.launcher, |
580 | | - 'appendix': self.appendix, |
581 | | - "build_namespace": self.build_namespace, |
582 | | - "build_image": self.build_image, |
583 | | - 'build_node_selector': self.build_node_selector, |
584 | | - 'build_pool': self.build_pool, |
585 | | - "sticky_builds": self.sticky_builds, |
586 | | - 'log_tail_lines': self.log_tail_lines, |
587 | | - 'pod_quota': self.pod_quota, |
588 | | - 'per_repo_quota': self.per_repo_quota, |
589 | | - 'per_repo_quota_higher': self.per_repo_quota_higher, |
590 | | - 'repo_providers': self.repo_providers, |
591 | | - 'use_registry': self.use_registry, |
592 | | - 'registry': registry, |
593 | | - 'traitlets_config': self.config, |
594 | | - 'google_analytics_code': self.google_analytics_code, |
595 | | - 'google_analytics_domain': self.google_analytics_domain, |
596 | | - 'about_message': self.about_message, |
597 | | - 'banner_message': self.banner_message, |
598 | | - 'extra_footer_scripts': self.extra_footer_scripts, |
599 | | - 'jinja2_env': jinja_env, |
600 | | - 'build_memory_limit': self.build_memory_limit, |
601 | | - 'build_docker_host': self.build_docker_host, |
602 | | - 'base_url': self.base_url, |
603 | | - 'badge_base_url': self.badge_base_url, |
604 | | - "static_path": os.path.join(HERE, "static"), |
605 | | - 'static_url_prefix': url_path_join(self.base_url, 'static/'), |
606 | | - 'template_variables': self.template_variables, |
607 | | - 'executor': self.executor, |
608 | | - 'auth_enabled': self.auth_enabled, |
609 | | - 'event_log': self.event_log, |
610 | | - 'normalized_origin': self.normalized_origin |
611 | | - }) |
| 590 | + self.tornado_settings.update( |
| 591 | + { |
| 592 | + "log_function": log_request, |
| 593 | + "push_secret": self.push_secret, |
| 594 | + "image_prefix": self.image_prefix, |
| 595 | + "debug": self.debug, |
| 596 | + "launcher": self.launcher, |
| 597 | + "appendix": self.appendix, |
| 598 | + "build_namespace": self.build_namespace, |
| 599 | + "build_image": self.build_image, |
| 600 | + "build_node_selector": self.build_node_selector, |
| 601 | + "build_pool": self.build_pool, |
| 602 | + "sticky_builds": self.sticky_builds, |
| 603 | + "log_tail_lines": self.log_tail_lines, |
| 604 | + "pod_quota": self.pod_quota, |
| 605 | + "per_repo_quota": self.per_repo_quota, |
| 606 | + "per_repo_quota_higher": self.per_repo_quota_higher, |
| 607 | + "repo_providers": self.repo_providers, |
| 608 | + "use_registry": self.use_registry, |
| 609 | + "registry": registry, |
| 610 | + "traitlets_config": self.config, |
| 611 | + "google_analytics_code": self.google_analytics_code, |
| 612 | + "google_analytics_domain": self.google_analytics_domain, |
| 613 | + "about_message": self.about_message, |
| 614 | + "banner_message": self.banner_message, |
| 615 | + "extra_footer_scripts": self.extra_footer_scripts, |
| 616 | + "jinja2_env": jinja_env, |
| 617 | + "build_memory_limit": self.build_memory_limit, |
| 618 | + "build_memory_request": self.build_memory_request, |
| 619 | + "build_docker_host": self.build_docker_host, |
| 620 | + "base_url": self.base_url, |
| 621 | + "badge_base_url": self.badge_base_url, |
| 622 | + "static_path": os.path.join(HERE, "static"), |
| 623 | + "static_url_prefix": url_path_join(self.base_url, "static/"), |
| 624 | + "template_variables": self.template_variables, |
| 625 | + "executor": self.executor, |
| 626 | + "auth_enabled": self.auth_enabled, |
| 627 | + "event_log": self.event_log, |
| 628 | + "normalized_origin": self.normalized_origin, |
| 629 | + } |
| 630 | + ) |
612 | 631 | if self.auth_enabled: |
613 | 632 | self.tornado_settings['cookie_secret'] = os.urandom(32) |
614 | 633 |
|
|
0 commit comments