from __future__ import division
from math import log, exp
from operator import mul
from math import e
from collections import Counter
import os
import pylab, json, csv
import pickle
from celery import Celery
app = Celery('sentiment_worker_test',backend='amqp', broker='amqp://localhost//')
pos = dict()
neg = dict()
features = set()
totals = [0, 0]
delchars = ''.join(c for c in map(chr, range(128)) if not c.isalnum())
CDATA_FILE = "countdata.pickle"
class MyDict(dict):
def __getitem__(self, key):
if key in self:
return self.get(key)
return 0
def __init__(self):
self.train()
# print "Trained..."
def negate_sequence(self,text):
"""
Detects negations and transforms negated words into "not_" form.
"""
#some code
def train(self):
#some code
def classify2(self, text):
#some code
@app.task(bind=True)
def classify_demo(self, input_data):
#some code
if __name__ == '__main__':
query = "Some String to test"
result = MyDict().classify_demo.delay(query)
print (result.get())
print
I am using this command to run celery task on my windows 7 pc:
celery -A sentiment_worker_test worker -l info -P eventlet
it all displays and connected successfully...
but when i run this sentiment_worker_test.py file in another terminal with command:"python sentiment_worker_test.py" then it shows "None" in result...
and at the celery command prompt window it shows following response..
[2018-10-31 11:19:13,104: INFO/MainProcess] celery@dell-PC ready. [2018-10-31 11:19:13,105: INFO/MainProcess] Received task: sentiment_worker_test .classify_demo[4d173818-64f6-400a-a75b-344074921461] [2018-10-31 11:19:13,107: WARNING/MainProcess] There is some error, please retry with different input [2018-10-31 11:19:13,108: INFO/MainProcess] pidbox: Connected toamqp://guest:**@127.0.0.1:5672//. [2018-10-31 11:19:13,221: INFO/MainProcess] Task sentiment_worker_test.classify_demo[4d173818-64f6-400a-a75b-344074921461] succeeded in 0.10899999999946886s: None
I dont know what that warning means..."There is some error, please retry with different input".. i have tried almost all different types of inputs... but none worked...
any help would be appreciated
Thanks in advance