diff --git a/README.md b/README.md index 8f5090c..8c76c57 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.46.2 +pip install faasmctl==0.47.0 ``` ## Usage diff --git a/faasmctl/tasks/invoke.py b/faasmctl/tasks/invoke.py index f4afb35..56b54a4 100644 --- a/faasmctl/tasks/invoke.py +++ b/faasmctl/tasks/invoke.py @@ -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 @@ -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)) diff --git a/faasmctl/tasks/s3.py b/faasmctl/tasks/s3.py index 8563bc5..54cc305 100644 --- a/faasmctl/tasks/s3.py +++ b/faasmctl/tasks/s3.py @@ -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, @@ -7,6 +12,7 @@ upload_dir as do_upload_dir, dump_object as do_dump_object, ) +from invoke import task @task @@ -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): """ diff --git a/faasmctl/tasks/upload.py b/faasmctl/tasks/upload.py index d293568..a61dc0f 100644 --- a/faasmctl/tasks/upload.py +++ b/faasmctl/tasks/upload.py @@ -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 = ( diff --git a/faasmctl/util/compose.py b/faasmctl/util/compose.py index 55e4ab5..a56a618 100644 --- a/faasmctl/util/compose.py +++ b/faasmctl/util/compose.py @@ -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" diff --git a/faasmctl/util/faasm.py b/faasmctl/util/faasm.py index a87e109..070758c 100644 --- a/faasmctl/util/faasm.py +++ b/faasmctl/util/faasm.py @@ -1,6 +1,6 @@ from os import environ -FAASM_VERSION = "0.26.0" +FAASM_VERSION = "0.27.0" def get_version(): diff --git a/faasmctl/util/version.py b/faasmctl/util/version.py index a9de8a8..19acbb0 100644 --- a/faasmctl/util/version.py +++ b/faasmctl/util/version.py @@ -1,4 +1,4 @@ -FAASMCTL_VERSION = "0.46.2" +FAASMCTL_VERSION = "0.47.0" def get_version(): diff --git a/pyproject.toml b/pyproject.toml index a393365..67d9063 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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="foo@bar.com" }, ]