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
81 changes: 0 additions & 81 deletions .circleci/config.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Lint

on:
push:
pull_request:

jobs:
linting:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Cache virtualenv
uses: actions/cache@v4
with:
path: python-venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}-${{ github.ref_name }}
restore-keys: |
venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}-
venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-

- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev

- name: Install Python dependencies (via install.py)
run: |
python3 install.py --no-aws --no-azure --no-gcp --no-openwhisk --no-local

- name: Black (check)
run: |
. python-venv/bin/activate
black benchmarks --check --config .black.toml

- name: Flake8 (lint)
run: |
. python-venv/bin/activate
# write to file and echo to stdout (requires flake8 with --tee support)
flake8 benchmarks --config=.flake8.cfg --tee --output-file flake-reports

- name: Upload flake report
if: always()
uses: actions/upload-artifact@v4
with:
name: flake-reports
path: flake-reports
11 changes: 9 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
entry: flake8
args: ["--config=.flake8.cfg"]
types: [python]
files: ^sebs/
files: ^(sebs/|benchmarks/)
- repo: local
hooks:
- id: black-check-local
Expand All @@ -19,5 +19,12 @@ repos:
entry: black
args: ["--config=.black.toml", "--check", "--diff"]
types: [python]
files: ^sebs/
files: ^(sebs/|benchmarks/)
# - repo: local
# hooks:
# - id: mypy-local
# name: mypy (project venv)
# language: system
# entry: bash -lc 'python -m mypy --config-file=.mypy.ini sebs'
# types: [python]

13 changes: 6 additions & 7 deletions benchmarks/000.microbenchmarks/010.sleep/input.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
size_generators = {"test": 1, "small": 100, "large": 1000}

size_generators = {
'test' : 1,
'small' : 100,
'large': 1000
}

def buckets_count():
return (0, 0)

def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func):
return { 'sleep': size_generators[size] }

def generate_input(
data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func
):
return {"sleep": size_generators[size]}
6 changes: 3 additions & 3 deletions benchmarks/000.microbenchmarks/010.sleep/python/function.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

from time import sleep


def handler(event):

# start timing
sleep_time = event.get('sleep')
sleep_time = event.get("sleep")
sleep(sleep_time)
return { 'result': sleep_time }
return {"result": sleep_time}
10 changes: 6 additions & 4 deletions benchmarks/000.microbenchmarks/020.network-benchmark/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ def buckets_count():
return 0, 1


def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func):
def generate_input(
data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func
):
return {
'bucket': {
'bucket': benchmarks_bucket,
'output': output_paths[0],
"bucket": {
"bucket": benchmarks_bucket,
"output": output_paths[0],
},
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import csv
import json
import os.path
import socket
from datetime import datetime
from time import sleep

from . import storage


def handler(event):

request_id = event['request-id']
address = event['server-address']
port = event['server-port']
repetitions = event['repetitions']
output_bucket = event.get('bucket').get('bucket')
output_prefix = event.get('bucket').get('output')
request_id = event["request-id"]
address = event["server-address"]
port = event["server-port"]
repetitions = event["repetitions"]
output_bucket = event.get("bucket").get("bucket")
output_prefix = event.get("bucket").get("output")
times = []
i = 0
socket.setdefaulttimeout(3)
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind(('', 0))
message = request_id.encode('utf-8')
server_socket.bind(("", 0))
message = request_id.encode("utf-8")
adr = (address, port)
consecutive_failures = 0
while i < repetitions + 1:
Expand All @@ -43,16 +42,16 @@ def handler(event):
consecutive_failures = 0
server_socket.settimeout(2)
server_socket.close()

if consecutive_failures != 5:
with open('/tmp/data.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',')
writer.writerow(["id", "client_send", "client_rcv"])
with open("/tmp/data.csv", "w", newline="") as csvfile:
writer = csv.writer(csvfile, delimiter=",")
writer.writerow(["id", "client_send", "client_rcv"])
for row in times:
writer.writerow(row)

client = storage.storage.get_instance()
filename = 'results-{}.csv'.format(request_id)
key = client.upload(output_bucket, os.path.join(output_prefix, filename), '/tmp/data.csv')
filename = "results-{}.csv".format(request_id)
key = client.upload(output_bucket, os.path.join(output_prefix, filename), "/tmp/data.csv")

return { 'result': key }
return {"result": key}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@


def buckets_count():
return 0, 1

def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func):

def generate_input(
data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func
):
return {
'bucket': {
'bucket': benchmarks_bucket,
'output': output_paths[0],
"bucket": {
"bucket": benchmarks_bucket,
"output": output_paths[0],
},
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import csv
import json
import os
import socket
from datetime import datetime
from time import sleep

from . import storage


def handler(event):

request_id = event['request-id']
address = event['server-address']
port = event['server-port']
repetitions = event['repetitions']
output_bucket = event.get('bucket').get('bucket')
output_prefix = event.get('bucket').get('output')
request_id = event["request-id"]
address = event["server-address"]
port = event["server-port"]
repetitions = event["repetitions"]
output_bucket = event.get("bucket").get("bucket")
output_prefix = event.get("bucket").get("output")
times = []
print("Starting communication with {}:{}".format(address, port))
i = 0
socket.setdefaulttimeout(4)
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind(('', 0))
message = request_id.encode('utf-8')
server_socket.bind(("", 0))
message = request_id.encode("utf-8")
adr = (address, port)
consecutive_failures = 0
measurements_not_smaller = 0
Expand All @@ -43,11 +42,13 @@ def handler(event):
if i > 0:
times.append([i, send_begin, recv_end])
cur_time = recv_end - send_begin
print("Time {} Min Time {} NotSmaller {}".format(cur_time, cur_min, measurements_not_smaller))
print(
"Time {} Min Time {} NotSmaller {}".format(cur_time, cur_min, measurements_not_smaller)
)
if cur_time > cur_min and cur_min > 0:
measurements_not_smaller += 1
if measurements_not_smaller == repetitions:
message = "stop".encode('utf-8')
message = "stop".encode("utf-8")
server_socket.sendto(message, adr)
break
else:
Expand All @@ -57,18 +58,18 @@ def handler(event):
consecutive_failures = 0
server_socket.settimeout(4)
server_socket.close()

if consecutive_failures != 5:
with open('/tmp/data.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',')
writer.writerow(["id", "client_send", "client_rcv"])
with open("/tmp/data.csv", "w", newline="") as csvfile:
writer = csv.writer(csvfile, delimiter=",")
writer.writerow(["id", "client_send", "client_rcv"])
for row in times:
writer.writerow(row)

client = storage.storage.get_instance()
filename = 'results-{}.csv'.format(request_id)
key = client.upload(output_bucket, os.path.join(output_prefix, filename), '/tmp/data.csv')
filename = "results-{}.csv".format(request_id)
key = client.upload(output_bucket, os.path.join(output_prefix, filename), "/tmp/data.csv")
else:
key = None

return { 'result': {'bucket-key': key, 'timestamp': event['income-timestamp']} }
return {"result": {"bucket-key": key, "timestamp": event["income-timestamp"]}}
13 changes: 6 additions & 7 deletions benchmarks/000.microbenchmarks/040.server-reply/input.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
size_generators = {"test": 1, "small": 100, "large": 1000}

size_generators = {
'test' : 1,
'small' : 100,
'large': 1000
}

def buckets_count():
return (0, 0)

def generate_input(data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func):
return { 'sleep': size_generators[size] }

def generate_input(
data_dir, size, benchmarks_bucket, input_paths, output_paths, upload_func, nosql_func
):
return {"sleep": size_generators[size]}
Loading