Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.47.1
pip install faasmctl==0.48.0
```

## Usage
Expand Down
11 changes: 10 additions & 1 deletion faasmctl/tasks/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,17 @@ def invoke(
exec_time = "{:.2f} s".format(
get_execution_time_from_message_results(result, unit="s")
)
cold_start_time = "{:.2f} ms".format(
get_execution_time_from_message_results(
result, unit="ms", ext_start_ts=(start_ts * 1e3)
)
)

if output_format is not None:
if output_format == "cold-start":
print(cold_start_time[:-3])
return 0

if output_format == "exec-time":
print(exec_time[:-2])
return 0
Expand All @@ -98,7 +107,7 @@ def invoke(
return 0

if output_format == "start-end-ts":
print(f"{start_ts},{end_ts}")
print(f"{start_ts},{end_ts}") # noqa: E231
return 0

print("======================= Faasm Execution =========================")
Expand Down
2 changes: 1 addition & 1 deletion faasmctl/tasks/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def print_planner_resources(policy):

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

def print_line(host_msg, worker_occupation, next_evicted_vm_ips=[]):
is_evicted = host_msg.ip in next_evicted_vm_ips
Expand Down
12 changes: 12 additions & 0 deletions faasmctl/util/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from subprocess import run
from time import sleep

DEFAULT_FAASM_ACCLESS_ENABLED = "off"
DEFAULT_FAASM_ATTESTATION_SERVICE_URL = "https://localhost:8443"
DEFAULT_FAASM_CAPTURE_STDOUT = "off"
DEFAULT_FAASM_OVERRIDE_CPU_COUNT = "8"

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

# Tunable env. vars with curated default values

env["FAASM_ACCLESS_ENABLED"] = DEFAULT_FAASM_ACCLESS_ENABLED
if "FAASM_ACCLESS_ENABLED" in environ:
env["FAASM_ACCLESS_ENABLED"] = environ["FAASM_ACCLESS_ENABLED"]

env["FAASM_ATTESTATION_SERVICE_URL"] = DEFAULT_FAASM_ATTESTATION_SERVICE_URL
if "FAASM_ATTESTATION_SERVICE_URL" in environ:
env["FAASM_ATTESTATION_SERVICE_URL"] = environ["FAASM_ATTESTATION_SERVICE_URL"]

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"]
Expand Down
4 changes: 3 additions & 1 deletion faasmctl/util/results.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def get_execution_time_from_message_results(result, unit="s"):
def get_execution_time_from_message_results(result, unit="s", ext_start_ts=None):
valid_units = ["s", "ms", "us"]
if unit not in valid_units:
print(
Expand All @@ -13,6 +13,8 @@ def get_execution_time_from_message_results(result, unit="s"):
start_ts = min([msg.startTimestamp for msg in result.messageResults])
except AttributeError:
start_ts = min([msg.timestamp for msg in result.messageResults])
if ext_start_ts is not None:
start_ts = ext_start_ts
end_ts = max([msg.finishTimestamp for msg in result.messageResults])

if unit == "s":
Expand Down
2 changes: 1 addition & 1 deletion faasmctl/util/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FAASMCTL_VERSION = "0.47.1"
FAASMCTL_VERSION = "0.48.0"


def get_version():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "faasmctl"
version = "0.47.1"
version = "0.48.0"
authors = [
{ name="Faasm Team", email="foo@bar.com" },
]
Expand Down