Skip to content

Instantly share code, notes, and snippets.

@ywolff
Last active January 7, 2020 08:31
Show Gist options
  • Save ywolff/4d9910d02a77cdbd8617dd5d9faa00a3 to your computer and use it in GitHub Desktop.
Save ywolff/4d9910d02a77cdbd8617dd5d9faa00a3 to your computer and use it in GitHub Desktop.
import numpy as np
from locust import HttpLocust, TaskSet, task, between
INPUT_WIDTH = 10
class PredictTaskSet(TaskSet):
@task(1)
def predict(self):
payload = {
'input': np.random.random((1, INPUT_WIDTH)).tolist()
}
self.client.post('/predict', json=payload)
class PredictLocust(HttpLocust):
task_set = PredictTaskSet
wait_time = between(1, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment