Skip to content

Commit 1001aef

Browse files
authored
accless: set env. vars (#96)
* accless: set env. vars * more formatting * flake8: silence warnings
1 parent 8ea5973 commit 1001aef

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ running [Faasm](https://github.com/faasm/faasm) cluster.
88
To install `faasmctl` you need a working `pip` (virtual-)environment. Then:
99

1010
```bash
11-
pip install faasmctl==0.47.1
11+
pip install faasmctl==0.48.0
1212
```
1313

1414
## Usage

faasmctl/tasks/invoke.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,17 @@ def invoke(
8787
exec_time = "{:.2f} s".format(
8888
get_execution_time_from_message_results(result, unit="s")
8989
)
90+
cold_start_time = "{:.2f} ms".format(
91+
get_execution_time_from_message_results(
92+
result, unit="ms", ext_start_ts=(start_ts * 1e3)
93+
)
94+
)
9095

9196
if output_format is not None:
97+
if output_format == "cold-start":
98+
print(cold_start_time[:-3])
99+
return 0
100+
92101
if output_format == "exec-time":
93102
print(exec_time[:-2])
94103
return 0
@@ -98,7 +107,7 @@ def invoke(
98107
return 0
99108

100109
if output_format == "start-end-ts":
101-
print(f"{start_ts},{end_ts}")
110+
print(f"{start_ts},{end_ts}") # noqa: E231
102111
return 0
103112

104113
print("======================= Faasm Execution =========================")

faasmctl/tasks/monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def print_planner_resources(policy):
126126

127127
def color_text(color, text="X"):
128128
num1 = str(color)
129-
return f"\033[38;5;{num1}m{text}\033[0;0m"
129+
return f"\033[38;5;{num1}m{text}\033[0;0m" # noqa: E231, E702
130130

131131
def print_line(host_msg, worker_occupation, next_evicted_vm_ips=[]):
132132
is_evicted = host_msg.ip in next_evicted_vm_ips

faasmctl/util/compose.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from subprocess import run
1212
from time import sleep
1313

14+
DEFAULT_FAASM_ACCLESS_ENABLED = "off"
15+
DEFAULT_FAASM_ATTESTATION_SERVICE_URL = "https://localhost:8443"
1416
DEFAULT_FAASM_CAPTURE_STDOUT = "off"
1517
DEFAULT_FAASM_OVERRIDE_CPU_COUNT = "8"
1618

@@ -124,6 +126,16 @@ def get_compose_env_vars(faasm_checkout, mount_source, ini_file=None):
124126
if "FAASM_CLI_IMAGE" in environ:
125127
env["FAASM_CLI_IMAGE"] = environ["FAASM_CLI_IMAGE"]
126128

129+
# Tunable env. vars with curated default values
130+
131+
env["FAASM_ACCLESS_ENABLED"] = DEFAULT_FAASM_ACCLESS_ENABLED
132+
if "FAASM_ACCLESS_ENABLED" in environ:
133+
env["FAASM_ACCLESS_ENABLED"] = environ["FAASM_ACCLESS_ENABLED"]
134+
135+
env["FAASM_ATTESTATION_SERVICE_URL"] = DEFAULT_FAASM_ATTESTATION_SERVICE_URL
136+
if "FAASM_ATTESTATION_SERVICE_URL" in environ:
137+
env["FAASM_ATTESTATION_SERVICE_URL"] = environ["FAASM_ATTESTATION_SERVICE_URL"]
138+
127139
env["FAASM_OVERRIDE_CPU_COUNT"] = DEFAULT_FAASM_OVERRIDE_CPU_COUNT
128140
if "FAASM_OVERRIDE_CPU_COUNT" in environ:
129141
env["FAASM_OVERRIDE_CPU_COUNT"] = environ["FAASM_OVERRIDE_CPU_COUNT"]

faasmctl/util/results.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def get_execution_time_from_message_results(result, unit="s"):
1+
def get_execution_time_from_message_results(result, unit="s", ext_start_ts=None):
22
valid_units = ["s", "ms", "us"]
33
if unit not in valid_units:
44
print(
@@ -13,6 +13,8 @@ def get_execution_time_from_message_results(result, unit="s"):
1313
start_ts = min([msg.startTimestamp for msg in result.messageResults])
1414
except AttributeError:
1515
start_ts = min([msg.timestamp for msg in result.messageResults])
16+
if ext_start_ts is not None:
17+
start_ts = ext_start_ts
1618
end_ts = max([msg.finishTimestamp for msg in result.messageResults])
1719

1820
if unit == "s":

faasmctl/util/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FAASMCTL_VERSION = "0.47.1"
1+
FAASMCTL_VERSION = "0.48.0"
22

33

44
def get_version():

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "faasmctl"
7-
version = "0.47.1"
7+
version = "0.48.0"
88
authors = [
99
{ name="Faasm Team", email="[email protected]" },
1010
]

0 commit comments

Comments
 (0)