From c3acb82cc74b26d058482172bfb68f2c103aebd5 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Mon, 8 Apr 2024 13:04:53 +0000 Subject: [PATCH] compose: pass override cpu cores variable --- README.md | 2 +- faasmctl/util/compose.py | 11 +++++++++++ faasmctl/util/version.py | 2 +- pyproject.toml | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 58aab9f..114f6ad 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ running [Faasm](https://github.com/faasm/faasm) cluster. To install `faasmctl` you need a working `pip` (virtual-)environment. Then: ```bash -pip install faasmctl==0.38.0 +pip install faasmctl==0.39.0 ``` ## Usage diff --git a/faasmctl/util/compose.py b/faasmctl/util/compose.py index e80c730..58c0d22 100644 --- a/faasmctl/util/compose.py +++ b/faasmctl/util/compose.py @@ -11,6 +11,8 @@ from subprocess import run from time import sleep +DEFAULT_FAASM_OVERRIDE_CPU_COUNT = "8" + def get_compose_env_vars(faasm_checkout, mount_source, ini_file=None): """ @@ -29,6 +31,8 @@ def get_compose_env_vars(faasm_checkout, mount_source, ini_file=None): - A dictionary with the necessary env. variables """ env = {} + env["FAASM_DEPLOYMENT_TYPE"] = "compose" + if mount_source: env["FAASM_BUILD_DIR"] = join(faasm_checkout, "dev/faasm/build") env["CONAN_CACHE_MOUNT_SOURCE"] = join(faasm_checkout, "dev/faasm/conan") @@ -83,6 +87,9 @@ def get_compose_env_vars(faasm_checkout, mount_source, ini_file=None): faasm_ver = faasm_ver.strip() # Whitelist env. variables that we recognise + if "FAASM_DEPLOYMENT_TYPE" in environ: + env["FAASM_DEPLOYMENT_TYPE"] = environ["FAASM_DEPLOYMENT_TYPE"] + if "FAASM_WASM_VM" in environ: wasm_vm = environ["FAASM_WASM_VM"] if wasm_vm == "sgx-sim": @@ -103,6 +110,10 @@ def get_compose_env_vars(faasm_checkout, mount_source, ini_file=None): else: env["FAASM_WASM_VM"] = wasm_vm + env["FAASM_OVERRIDE_CPU_COUNT"] = DEFAULT_FAASM_OVERRIDE_CPU_COUNT + if "FAASM_OVERRIDE_CPU_COUNT" in environ: + env["FAASM_OVERRIDE_CPU_COUNT"] = environ["FAASM_OVERRIDE_CPU_COUNT"] + if "FAASM_CLI_IMAGE" in environ: env["FAASM_CLI_IMAGE"] = environ["FAASM_CLI_IMAGE"] diff --git a/faasmctl/util/version.py b/faasmctl/util/version.py index 7d68ca1..0de495e 100644 --- a/faasmctl/util/version.py +++ b/faasmctl/util/version.py @@ -1,4 +1,4 @@ -FAASMCTL_VERSION = "0.38.0" +FAASMCTL_VERSION = "0.39.0" def get_version(): diff --git a/pyproject.toml b/pyproject.toml index a327daa..b6bf012 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "faasmctl" -version = "0.38.0" +version = "0.39.0" authors = [ { name="Faasm Team", email="foo@bar.com" }, ]