Compare commits

...

12 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
andrewso
ef7dce1375 [08.10.20] Service rename 2020-10-08 17:00:34 +01:00
andrewso
1042ec90da [08.10.20] Service rename 2020-10-08 16:58:13 +01:00
andrewso
36de0ae909 [08.10.20] Service rename 2020-10-08 16:56:25 +01:00
8 changed files with 49 additions and 11 deletions

6
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/sentiment-analyser.iml" filepath="$PROJECT_DIR$/.idea/sentiment-analyser.iml" />
</modules>
</component>
</project>

9
.idea/sentiment-analyser.iml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

11
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="GraziCommit" enabled="true" level="TYPO" enabled_by_default="true" />
</profile>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

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

@ -1,9 +1,9 @@
#!/usr/bin/env groovy
env.APPLICATION_NAME = 'sentiment-analyser'
env.APPLICATION_NAME = 'sentiment'
env.APPLICATION_LABEL = 'utilities'
env.GIT_BRANCH = 'master'
env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git"
env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}-analyser.git"
env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}"
env.GITHUB_CREDENTIALS_ID = 'Github'
env.DIGITAL_OCEAN = 'registry.digitalocean.com'

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()

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 != "" :