mirror of https://github.com/mamba-org/mamba.git
allow mamba to set max extract threads
use MAMBA_EXTRACT_THREADS env var in mamba set max extract threads before transaction make sure the context value is used by setting context value in fetch_extract_packages add error handling in mamba in case env var can't be converted to integer
This commit is contained in:
parent
3e310f0b1e
commit
770d1a9ba2
|
@ -875,6 +875,7 @@ namespace mamba
|
|||
Console::instance().init_multi_progress(ProgressBarMode::aggregated);
|
||||
|
||||
auto& ctx = Context::instance();
|
||||
DownloadExtractSemaphore::set_max(ctx.extract_threads);
|
||||
|
||||
if (ctx.experimental && ctx.verify_artifacts)
|
||||
LOG_INFO << "Content trust is enabled, package(s) signatures will be verified";
|
||||
|
|
|
@ -227,6 +227,7 @@ PYBIND11_MODULE(bindings, m)
|
|||
.def_readwrite("local_repodata_ttl", &Context::local_repodata_ttl)
|
||||
.def_readwrite("use_index_cache", &Context::use_index_cache)
|
||||
.def_readwrite("max_parallel_downloads", &Context::max_parallel_downloads)
|
||||
.def_readwrite("extract_threads", &Context::extract_threads)
|
||||
.def_readwrite("always_yes", &Context::always_yes)
|
||||
.def_readwrite("dry_run", &Context::dry_run)
|
||||
.def_readwrite("ssl_verify", &Context::ssl_verify)
|
||||
|
|
|
@ -211,6 +211,16 @@ def init_api_context(use_mamba_experimental=False):
|
|||
api_ctx.channels = context.channels
|
||||
api_ctx.platform = context.subdir
|
||||
|
||||
if "MAMBA_EXTRACT_THREADS" in os.environ:
|
||||
try:
|
||||
max_threads = int(os.environ["MAMBA_EXTRACT_THREADS"])
|
||||
api_ctx.extract_threads = max_threads
|
||||
except ValueError:
|
||||
v = os.environ["MAMBA_EXTRACT_THREADS"]
|
||||
raise ValueError(
|
||||
f"Invalid conversion of env variable 'MAMBA_EXTRACT_THREADS' from value '{v}'"
|
||||
)
|
||||
|
||||
def get_base_url(url, name=None):
|
||||
tmp = url.rsplit("/", 1)[0]
|
||||
if name:
|
||||
|
|
Loading…
Reference in New Issue