Skip to content

Commit

Permalink
nits: fixes for use with tless (#94)
Browse files Browse the repository at this point in the history
* nits: fixes for use with tless

* nit: bump faasm version
  • Loading branch information
csegarragonz authored Oct 1, 2024
1 parent 8812619 commit 87e4393
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 7 deletions.
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.46.2
pip install faasmctl==0.47.0
```

## Usage
Expand Down
14 changes: 14 additions & 0 deletions faasmctl/tasks/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def invoke(
mpi_world_size=None,
single_host=False,
host_dist=None,
output_format=None,
):
"""
Invoke the execution of a user/func pair
Expand Down Expand Up @@ -87,6 +88,19 @@ def invoke(
get_execution_time_from_message_results(result, unit="s")
)

if output_format is not None:
if output_format == "exec-time":
print(exec_time[:-2])
return 0

if output_format == "wall-time":
print(wall_time[-2])
return 0

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

print("======================= Faasm Execution =========================")
print("Function: \t\t\t{}/{}".format(user, function))
print("Return value: \t\t\t{}".format(ret_val))
Expand Down
24 changes: 23 additions & 1 deletion faasmctl/tasks/s3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from invoke import task
from faasmctl.util.backend import COMPOSE_BACKEND, K8S_BACKEND
from faasmctl.util.config import (
BACKEND_INI_STRING,
get_faasm_ini_file,
get_faasm_ini_value,
)
from faasmctl.util.s3 import (
list_buckets as do_list_buckets,
clear_bucket as do_clear_bucket,
Expand All @@ -7,6 +12,7 @@
upload_dir as do_upload_dir,
dump_object as do_dump_object,
)
from invoke import task


@task
Expand All @@ -25,6 +31,22 @@ def clear_bucket(ctx, bucket):
do_clear_bucket(bucket)


@task
def get_url(ctx):
"""
Get the URL for the S3 server
"""
ini_file = get_faasm_ini_file()

backend = get_faasm_ini_value(ini_file, "Faasm", BACKEND_INI_STRING)
if backend == COMPOSE_BACKEND:
print("127.0.0.1")
elif backend == K8S_BACKEND:
raise RuntimeError("Unimplemented for backend: {}".format(backend))
else:
raise RuntimeError("Unrecognised backend: {}".format(backend))


@task
def list_objects(ctx, bucket, recursive=False):
"""
Expand Down
2 changes: 1 addition & 1 deletion faasmctl/tasks/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def workflow(ctx, wflow, path, ini_file=None):
if wasm_in_ctr:
ctr_image = path[: path.rfind(":")]
in_ctr_path = path[path.rfind(":") + 1 :]
docker_cmd = "docker run --rm -it {} ls --format=commas {}".format(
docker_cmd = "docker run --rm {} ls --format=commas {}".format(
ctr_image, in_ctr_path
)
funcs = (
Expand Down
2 changes: 1 addition & 1 deletion faasmctl/util/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from subprocess import run
from time import sleep

DEFAULT_FAASM_CAPTURE_STDOUT = "on"
DEFAULT_FAASM_CAPTURE_STDOUT = "off"
DEFAULT_FAASM_OVERRIDE_CPU_COUNT = "8"


Expand Down
2 changes: 1 addition & 1 deletion faasmctl/util/faasm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from os import environ

FAASM_VERSION = "0.26.0"
FAASM_VERSION = "0.27.0"


def get_version():
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.46.2"
FAASMCTL_VERSION = "0.47.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.46.2"
version = "0.47.0"
authors = [
{ name="Faasm Team", email="[email protected]" },
]
Expand Down

0 comments on commit 87e4393

Please sign in to comment.