Skip to content
Permalink
Browse files

Benchmarked classification service.

  • Loading branch information
mwauer committed Jan 22, 2019
1 parent e737cab commit 1d855f2162c39fe0f2a4a8027a93b9f040160362
@@ -0,0 +1,19 @@
benchmark-filter:
docker run -e "configuration=null <http://purl.org/dc/terms/spatial> null" -e "cbd=false" -e "amqp_server_host=localhost" --network host --name geiser-classification-service mwauer/geiser-classification-service | tee benchmark-filter.log

benchmark-filter-cbd:
docker run -e "configuration=null <http://purl.org/dc/terms/spatial> null" -e "amqp_server_host=localhost" --network host --name geiser-classification-service mwauer/geiser-classification-service | tee benchmark-filter-cbd.log

benchmark-query:
docker run -e "mode=query" -e "configuration=CONSTRUCT { ?s ?p ?o } WHERE { ?s <http://purl.org/dc/terms/spatial> ?spatial; ?p ?o }" -e "amqp_server_host=localhost" --network host --name geiser-classification-service mwauer/geiser-classification-service | tee benchmark-query.log

benchmark-logs-into-csv:
cat benchmark-filter.log | grep -oP 'XXXXX \K.*' > benchmark-filter-times.csv
cat benchmark-filter-cbd.log | grep -oP 'XXXXX \K.*' > benchmark-filter-cbd-times.csv
cat benchmark-query.log | grep -oP 'XXXXX \K.*' > benchmark-query-times.csv

stop-docker:
docker stop geiser-classification-service

rm-docker:
docker rm geiser-classification-service
Binary file not shown.
Binary file not shown.
@@ -1,26 +1,48 @@
#!/usr/bin/env python
#
# Test script for sending a sample turtle message to classification service.
# Test script for sending all test tweets to classification service.
# Assumes that you have a "test" routing key for receiving the
# results and classification service running.
# results.
#
import pika
import gzip
import time

connection = pika.BlockingConnection(pika.ConnectionParameters(
'127.0.0.1'))
channel = connection.channel()

properties = pika.BasicProperties(content_type='text/turtle')

print("Sending Turtle message...")
print("Sending Turtle messages...")

message = '<urn:r1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:c1>; <http://www.w3.org/2000/01/rdf-schema#label> "Resource". <urn:r2> <http://www.w3.org/2000/01/rdf-schema#label> "Resource2"; <urn:p1> <urn:o1>.'
turtle = ""
last_subject = ""

channel.basic_publish(exchange='geiser',
routing_key='classification-v1.test',
body=message,
properties=properties)
with gzip.open('sorted-tweets.n3.gz', 'rb') as f:
for line in f:
subject = line.split()[0]
if subject == last_subject:
turtle += line
else:
channel.basic_publish(exchange='geiser',
routing_key='classification-v1.test',
body=turtle,
properties=properties)
#print("Next message:")
#print(turtle)
time.sleep(0.3)
turtle = line
last_subject = subject

print(" [x] Sent turtle message to Service")
# send last resource
if turtle != "":
channel.basic_publish(exchange='geiser',
routing_key='classification-v1.test',
body=turtle,
properties=properties)
#print("Final message:")
#print(turtle)

print(" [x] Sent JSON message to Service request message")
connection.close()

0 comments on commit 1d855f2

Please sign in to comment.
You can’t perform that action at this time.