Esempio n. 1
0
def do_work(wait_for_result=False):
    """ here's our magic function that inserts into the message
    queue, does something, and optionally waits for a result.
    Highly dependent on the
    import benchmark.celerybench.tasks module """
    result = add.apply_async(args=[4, 4])
    if wait_for_result:
        result.get() #block and wait for the result
Esempio n. 2
0
def dumb_test_code():
    """ my little 'how the hell does this work anyway' testing code.
    Probably useless and should be deleted
    """
    print "add.delay(4, 4)"
    result = add.delay(4, 4)
    print "result.ready() is ",result.ready()
    print "result.get() ", result.get() #wait for the result
    print "result.successful() is ",result.successful()
    print "and the result is ", result.result
    print "delivery_mode is ",add.delivery_mode

    print "delivery_mode is ",add.delivery_mode
    print "add.apply_async(args=[4, 4])"
    result = add.apply_async(args=[4, 4])
    print "result.ready() is ",result.ready()
    print "result.get() ", result.get() #wait for the result
    print "result.successful() is ",result.successful()
    print "and the result is ", result.result
    print "delivery_mode is ",add.delivery_mode