Compare commits

...

9 Commits

Author SHA1 Message Date
andrewso
f5f3a4edd7 [15.10.20] Headers 2020-10-15 20:13:02 +01:00
andrewso
83841ef6b2 [14.10.20] CPU increase 2020-10-14 13:18:05 +01:00
andrewso
ef7219a952 [10.10.20] increased Resources 2020-10-11 17:53:09 +01:00
andrewso
91d65a6bfb [10.10.20] Reduced Resources 2020-10-10 23:29:26 +01:00
andrewso
5581960eee [09.10.20] Clearer Logging for tweet messages 2020-10-09 20:26:01 +01:00
andrewso
5a6cabd3db [09.10.20] Wrong Service mentioned for log 2020-10-09 18:18:49 +01:00
andrewso
a9ec303f3f [09.10.20] Misspelling 2020-10-09 18:09:14 +01:00
andrewso
47569f2ea6 [08.10.20] New probe so that it doesn't spit out logs 2020-10-08 17:21:44 +01:00
andrewso
c4953ca6cc [08.10.20] Misspelling in Probe URL 2020-10-08 17:06:14 +01:00
3 changed files with 13 additions and 9 deletions

View File

@ -64,10 +64,10 @@ spec:
imagePullPolicy: Always
resources:
requests:
cpu: 32m
memory: 32Mi
cpu: 64m
memory: 64Mi
limits:
cpu: 75m
cpu: 128m
memory: 64Mi
securityContext:
capabilities:

View File

@ -18,15 +18,20 @@ analyser = sentimentAnalyser.get_sentiment()
@app.route('/sentiment', methods=['GET'])
def tweetPredict():
tweet = request.args.get('tweet')
syncId = request.headers.get('X-CRYPTO-Sync-ID')
log("Receiving Tweet to classify {}".format(tweet), 'INFO')
log("Receiving Tweet to classify [{}] for [{}]".format(tweet, syncId), 'INFO')
result = analyser.get_vader_sentiment(tweet)
log("Returning classification result of {}".format(result), 'INFO')
log("Returning classification result of [{}]".format(result), 'INFO')
return json.dumps({'result': result, 'tweet': tweet}), 200, {'ContentType':'application/json'}
@app.route('/sentimentProbeTest', methods=['GET'])
def sentimentProbeTest():
return json.dumps({'result': {'Score': {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound': 0.0}, 'Compound': 0.0}, 'tweet': 'Fake Text'}), 200, {'ContentType':'application/json'}
def callSentimentAnalyser():
analyser.set_newSentiment()
@ -38,10 +43,9 @@ def callProbes():
if __name__ == '__main__':
setup_logging()
log("Starting Spam Filter...", 'INFO')
log("Starting Sentiment Analyser...", 'INFO')
sys.stdout.flush()
Thread(target=callProbes).start()
Thread(target=callSentimentAnalyser).start()
# Thread(target=callNewsFilter).start()
Thread(target=callSentimentAnalyser).start()

View File

@ -13,7 +13,7 @@ def health():
@app.route('/readiness')
def readiness():
result = requests.request("GET", 'http://0.0.0.0:9090/senitment?tweet=Boitcoin%20is%20doing%20very%20well')
result = requests.request("GET", 'http://0.0.0.0:9090/sentimentProbeTest')
result = json.loads(result.text)
if result != "" :