mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
Add core config option to limit compile process count (#3952)
This commit is contained in:
parent
991fc54994
commit
85faecb2fd
@ -116,6 +116,7 @@ CONF_COMMAND_RETAIN = "command_retain"
|
|||||||
CONF_COMMAND_TOPIC = "command_topic"
|
CONF_COMMAND_TOPIC = "command_topic"
|
||||||
CONF_COMMENT = "comment"
|
CONF_COMMENT = "comment"
|
||||||
CONF_COMMIT = "commit"
|
CONF_COMMIT = "commit"
|
||||||
|
CONF_COMPILE_PROCESS_LIMIT = "compile_process_limit"
|
||||||
CONF_COMPONENT_ID = "component_id"
|
CONF_COMPONENT_ID = "component_id"
|
||||||
CONF_COMPONENTS = "components"
|
CONF_COMPONENTS = "components"
|
||||||
CONF_CONDITION = "condition"
|
CONF_CONDITION = "condition"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ from esphome.const import (
|
|||||||
CONF_BOARD_FLASH_MODE,
|
CONF_BOARD_FLASH_MODE,
|
||||||
CONF_BUILD_PATH,
|
CONF_BUILD_PATH,
|
||||||
CONF_COMMENT,
|
CONF_COMMENT,
|
||||||
|
CONF_COMPILE_PROCESS_LIMIT,
|
||||||
CONF_ESPHOME,
|
CONF_ESPHOME,
|
||||||
CONF_FRAMEWORK,
|
CONF_FRAMEWORK,
|
||||||
CONF_INCLUDES,
|
CONF_INCLUDES,
|
||||||
@ -151,6 +153,9 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
|
cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
|
||||||
cv.version_number, validate_version
|
cv.version_number, validate_version
|
||||||
),
|
),
|
||||||
|
cv.Optional(CONF_COMPILE_PROCESS_LIMIT): cv.int_range(
|
||||||
|
min=1, max=multiprocessing.cpu_count()
|
||||||
|
),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
validate_hostname,
|
validate_hostname,
|
||||||
|
@ -8,7 +8,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from esphome.const import KEY_CORE
|
from esphome.const import CONF_COMPILE_PROCESS_LIMIT, CONF_ESPHOME, KEY_CORE
|
||||||
from esphome.core import CORE, EsphomeError
|
from esphome.core import CORE, EsphomeError
|
||||||
from esphome.util import run_external_command, run_external_process
|
from esphome.util import run_external_command, run_external_process
|
||||||
|
|
||||||
@ -103,7 +103,10 @@ def run_platformio_cli_run(config, verbose, *args, **kwargs) -> Union[str, int]:
|
|||||||
|
|
||||||
|
|
||||||
def run_compile(config, verbose):
|
def run_compile(config, verbose):
|
||||||
return run_platformio_cli_run(config, verbose)
|
args = []
|
||||||
|
if CONF_COMPILE_PROCESS_LIMIT in config[CONF_ESPHOME]:
|
||||||
|
args += [f"-j{config[CONF_ESPHOME][CONF_COMPILE_PROCESS_LIMIT]}"]
|
||||||
|
return run_platformio_cli_run(config, verbose, *args)
|
||||||
|
|
||||||
|
|
||||||
def _run_idedata(config):
|
def _run_idedata(config):
|
||||||
|
Loading…
Reference in New Issue
Block a user