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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm.azurecr.io/cpython:0.2.5
image: faasm.azurecr.io/cpython:0.2.6
credentials:
username: ${{secrets.ACR_SERVICE_PRINCIPAL_ID }}
password: ${{secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
Expand All@@ -44,7 +44,7 @@ jobs:
REDIS_QUEUE_HOST: redis
REDIS_STATE_HOST: redis
container:
image: faasm.azurecr.io/cpython:0.2.5
image: faasm.azurecr.io/cpython:0.2.6
credentials:
username: ${{secrets.ACR_SERVICE_PRINCIPAL_ID }}
password: ${{secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
0.2.5
0.2.6
5 changes: 3 additions & 2 deletions crossenv/tasks/modules.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,8 +55,9 @@
# "dulwich",
"Genshi",
"pyaes",
"pyperf",
"pyperformance",
# 16/07/2023 - pyperf and pyperformance installation suddendly broken
# "pyperf",
# "pyperformance",
"six",
]

Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
black==22.3.0
faasmctl==0.5.6
flake8==3.9.2
invoke==1.7.1
invoke>=2.0.0
numpy==1.22.0
requests==2.25.1
requests>=2.31.0
16 changes: 2 additions & 14 deletions tasks/cpython.py
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
from copy import copy as deep_copy
from faasmctl.util.upload import upload_wasm
from faasmtools.build import (
FAASM_BUILD_ENV_DICT,
WASM_HEADER_INSTALL,
Expand All@@ -7,13 +8,11 @@
build_config_cmd,
)
from faasmtools.compile_util import wasm_cmake, wasm_copy_upload
from faasmtools.endpoints import get_faasm_upload_host_port
from faasmtools.env import WASM_DIR
from invoke import task
from os import environ, makedirs
from os.path import join, exists
from re import compile
from requests import put
from shutil import copy, copytree, rmtree
from subprocess import run
from tasks.env import (
Expand DownExpand Up@@ -240,18 +239,7 @@ def upload(ctx):
"""
Upload the CPython function
"""
host, port = get_faasm_upload_host_port()
wasm_file = join(
WASM_DIR, CPYTHON_FUNC_USER, CPYTHON_FUNC_NAME, "function.wasm"
)
url = "http://{}:{}/f/{}/{}".format(
host, port, CPYTHON_FUNC_USER, CPYTHON_FUNC_NAME
)
print(
"Uploading{}/{} to{}".format(
CPYTHON_FUNC_USER, CPYTHON_FUNC_NAME, url
)
)
response = put(url, data=open(wasm_file, "rb"))

print("Response ({}):{}".format(response.status_code, response.text))
upload_wasm(CPYTHON_FUNC_USER, CPYTHON_FUNC_NAME, wasm_file)
31 changes: 8 additions & 23 deletions tasks/func.py
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
from faasmtools.build import FAASM_LOCAL_DIR
from faasmtools.endpoints import (
get_faasm_invoke_host_port,
get_faasm_upload_host_port,
get_knative_headers,
)

import requests
from base64 import b64encode
from os.path import join
from faasmctl.util.invoke import invoke_wasm
from faasmctl.util.upload import upload_python
from faasmtools.build import FAASM_LOCAL_DIR
from invoke import task
from os import makedirs, listdir
from os.path import join
from shutil import copy
from tasks.env import CPYTHON_FUNC_USER, CPYTHON_FUNC_NAME, PROJ_ROOT

Expand All@@ -23,7 +18,6 @@ def uploadpy(ctx, func, local=False):
"""
Upload the given Python function
"""
host, port = get_faasm_upload_host_port()
src_file = join(PY_FUNC_DIR, "{}.py".format(func))

if local:
Expand All@@ -35,10 +29,7 @@ def uploadpy(ctx, func, local=False):
print("Copying function{}{} ->{}".format(func, src_file, dest_file))
copy(src_file, dest_file)
else:
url = "http://{}:{}/p/{}/{}".format(host, port, "python", func)
response = requests.put(url, data=open(src_file, "rb"))

print("Response ({}):{}".format(response.status_code, response.text))
upload_python(func, src_file)


@task
Expand All@@ -59,8 +50,6 @@ def invoke(ctx, user, func, input_data=None):
"""
Invoke a python function on a Faasm cluster
"""
host, port = get_faasm_invoke_host_port()
url = "http://{}:{}".format(host, port)
data ={
"user": CPYTHON_FUNC_USER,
"function": CPYTHON_FUNC_NAME,
Expand All@@ -74,11 +63,7 @@ def invoke(ctx, user, func, input_data=None):
"utf-8"
)

headers = get_knative_headers()
response = requests.post(url, json=data, headers=headers)

if response.status_code != 200:
print("Error ({}):\n{}".format(response.status_code, response.text))
exit(1)
# Invoke message
response = invoke_wasm(data)

print("Success:\n{}".format(response.text))
print("Success:\n{}".format(response.messageResults[0].outputData))