Commit 7a5566ae authored by Eelco van der Wel's avatar Eelco van der Wel :speech_balloon:
Browse files

Merge branch 'eelco/perf-test-classifier' into 'dev'

add classifier with roberta-base model to perf test

See merge request memri/pod!340
parents 640c09a3 c853c24d
Pipeline #10134 canceled with stage
in 8 minutes and 23 seconds
Showing with 37 additions and 18 deletions
+37 -18
from unicodedata import name
import aiohttp
import asyncio
from locust import FastHttpUser, task, between, events, tag
import os
import json
import os
from unicodedata import name
import aiohttp
from locust import FastHttpUser, between, events, tag, task
key = "dbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdb"
......@@ -75,9 +74,31 @@ class ClassifierPlugin(FastHttpUser):
ClassifierPlugin.CURRENT_OWNER += 1
return owner
def create_initial_messages(self, num_messages=500):
"""
Simulate the initial import of an importer,
with dateReceived < trigger.filterCreatedAfter
"""
messages = []
for _ in range(num_messages):
messages.append({
"type": "Message",
"content": "a"*500,
"dateReceived":1655170839991,
"isMock": True
})
self.client.post("/v4/"+self.pod_owner+"/bulk", json={
"auth": CLIENT_AUTH,
"payload": {
"createItems": messages,
}
})
def on_start(self):
"""Start the plugin"""
self.pod_owner = self.get_owner()
self.create_initial_messages()
with open(os.path.join(ClassifierPlugin.PLUGIN_DIR, ClassifierPlugin.DEPLOY_PLUGIN), 'r') as file:
payload = json.loads(file.read())
......@@ -114,8 +135,9 @@ class ClassifierPlugin(FastHttpUser):
json={"auth": CLIENT_AUTH,
"payload": {
"type": "Message",
"content": "this is fake message",
"dateReceived":1655170839993
"content": "a"*500,
"dateReceived":1655170839993,
"isMock": True,
}},
name=f"{self.pod_owner} {self.__class__.__name__}.classification"
)
......
......@@ -3,14 +3,11 @@
{
"type": "Plugin",
"id": "b8d3cd38-1a0f-492d-8cbb-39dde5b5e090",
"gitProjectId": 234,
"config": "{\"item_type\":\"Message\",\"model_name\":\"my_plugin_model\",\"model_version\":\"0.1\",\"isMock\":true}",
"configJson": "[\n {\n \"name\": \"item_type\",\n \"display\": \"Item Type\",\n \"data_type\": \"Text\",\n \"type\": \"textbox\",\n \"default\": \"Message\",\n \"optional\": true\n },\n {\n \"name\": \"item_service\",\n \"display\": \"Item Service\",\n \"data_type\": \"Text\",\n \"type\": \"textbox\",\n \"default\": null,\n \"optional\": true\n },\n {\n \"name\": \"model_name\",\n \"display\": \"Model Name\",\n \"data_type\": \"Text\",\n \"type\": \"textbox\",\n \"default\": \"my_plugin_model\",\n \"optional\": true\n },\n {\n \"name\": \"model_version\",\n \"display\": \"Model Version\",\n \"data_type\": \"Text\",\n \"type\": \"textbox\",\n \"default\": \"0.1\",\n \"optional\": true\n },\n {\n \"name\": \"isMock\",\n \"display\": \"Ismock\",\n \"data_type\": \"Bool\",\n \"type\": \"textbox\",\n \"default\": true,\n \"optional\": true\n }\n]",
"containerImage": "gitlab.memri.io:5050/szimnowoda/plugin_to_trigger:main-latest",
"name": "plugin to trigger",
"pluginDescription": "A transformer based sentiment analyis plugin",
"pluginModule": "plugin_to_trigger.plugin",
"pluginName": "ClassifierPlugin",
"gitProjectId": 472,
"containerImage": "gitlab.memri.io:5050/eelcovdw/plugin-resources-test:main-latest",
"name": "Plugin Resources Test",
"pluginModule": "plugin_resources_test.plugin",
"pluginName": "ClassifierPlugin",
"pluginType": "app"
},
{
......
......@@ -3,8 +3,8 @@
{
"type": "PluginRun",
"id": "4fa2094c-51d6-4874-a135-9017fcdedf16",
"containerImage": "gitlab.memri.io:5050/szimnowoda/plugin_to_trigger:main-latest",
"pluginModule": "plugin_to_trigger.plugin",
"containerImage": "gitlab.memri.io:5050/eelcovdw/plugin-resources-test:main-latest",
"pluginModule": "plugin_resources_test.plugin",
"pluginName": "ClassifierPlugin",
"status": "idle",
"targetItemId": "4fa2094c-51d6-4874-a135-9017fcdedf16"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment