Esempio n. 1
0
def index():
    hello.delay()
    session.clear()

    if not session.get('testing'):
        session['testing'] = 'TESTING'
    print(session['testing'])

    return render_template('index.html')
Esempio n. 2
0
def track():
	hashtag = request.args.get('hashtag','')
	# add the hashtag syntax
	if (hashtag[:1] != '#'):
		hashtag = '#' + hashtag
	try:
		result = hello.delay(hashtag)
		app.config['ISRUNNING'] = True
	except:
		print('could not start hello.delay()')
	try:
		print('async')
	except:
		print('result.tasks doesnt work')
	try:
		print('async')
	except:
		print('result.tasks doesnt work')
	try:
		print('request', hello.request)
	except:
		print('backend didnt work')

	return 'running task ' + result.id
Esempio n. 3
0
from tasks import hello

hello.delay()
Esempio n. 4
0
#
# Sends a request to call hello() from within a worker.
#

import sys

from tasks import hello

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print('usage: {} NAME AGE'.format(sys.argv[0]))
        sys.exit(1)

    # By calling hello.delay(), we request hello() to be executed in a worker
    # rather than executed directly in the current process, which is what a
    # call to hello() would do.
    # http://docs.celeryproject.org/en/latest/userguide/calling.html
    hello.delay(sys.argv[1], int(sys.argv[2]))
Esempio n. 5
0
def hello_callback():
    print 'DEBUG: callback hit'
    hello.delay()
Esempio n. 6
0
def hello_call():
    r = hello.delay(name='celery')
    while not r.ready():
        print('hello task is not ready.')

    print(r)
Esempio n. 7
0
def update_graph(selected_dropdown_value):
    hello.delay()
    return static_image_route + selected_dropdown_value
Esempio n. 8
0
def job():
    print("I'm working...")
    hello.delay()
    print('-'*30)
Esempio n. 9
0
from tasks import hello

hello.delay({"stname": "\u57fa\u9686", "station": "466940"}, '2019-06-23')

Esempio n. 10
0
from tasks import hello, calculator
from time import sleep

if __name__ == '__main__':
    print("Test Celery using hello world!")
    result1 = hello.delay()
    print("Execute calculator addition operation:- 4+5")
    result2 = calculator.delay(4, 5, "+")
    print("#---------------------------------#")
    print()
    flag1, flag2 = False, False
    while True:
        if (result1.ready() and not flag1):
            print("Hello function Output: ", result1.result)
            flag1 = True
        if (result2.ready() and not flag2):
            print("Calculator function Output: ", result2.result)
            flag2 = True
        if (flag1 and flag2):
            print("All tasks done!!!")
            exit(0)