<s> from flask import Flask , request <EOL> from flask . ext . celery import Celery <EOL> def create_app ( ) : <EOL> return Flask ( "<STR_LIT>" ) <EOL> app = create_app ( ) <EOL> app . config . from_pyfile ( '<STR_LIT>' ) <EOL> celery = Celery ( app ) <EOL> @ celery . task ( name = "<STR_LIT>" ) <EOL> def add ( x , y ) : <EOL> return x + y <EOL> @ app . route ( "<STR_LIT:/>" ) <EOL> def hello_world ( x = <NUM_LIT:16> , y = <NUM_LIT:16> ) : <EOL> x = int ( request . args . get ( "<STR_LIT:x>" , x ) ) <EOL> y = int ( request . args . get ( "<STR_LIT:y>" , y ) ) <EOL> res = add . apply_async ( ( x , y ) ) <EOL> context = { "<STR_LIT:id>" : res . task_id , "<STR_LIT:x>" : x , "<STR_LIT:y>" : y } <EOL> return """<STR_LIT>""" % context <EOL> @ app . route ( "<STR_LIT>" ) <EOL> def show_result ( task_id ) : <EOL> retval = add . AsyncResult ( task_id ) . get ( timeout = <NUM_LIT:1.0> ) <EOL> return repr ( retval ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> app . run ( debug = True ) </s>
