Пример #1
0
def testEnqueue( param ) : 

    cnt = 0 ; 

    tid = "test_%s"%uuid.uuid4().hex

    while True : 
       
        try: 

            # enqueue task for execution 
            enqueueTask( PROCESS_CLASS , tid , param )
        
            print "ENQUEUE: %s" % tid , param  
        
            break 

        except QueueFull : # retry if queue full 

            print " --- QueueFull #%i - sleep: %g s"%( cnt + 1 , getWaitTime(cnt) ) 

            time.sleep(getWaitTime(cnt)) 

            cnt += 1 
            
            continue 
Пример #2
0
def testEnqueue(param):

    cnt = 0

    tid = "test_%s" % uuid.uuid4().hex

    while True:

        try:

            # enqueue task for execution
            enqueueTask(PROCESS_CLASS, tid, param)

            print "ENQUEUE: %s" % tid, param

            break

        except QueueFull:  # retry if queue full

            print " --- QueueFull #%i - sleep: %g s" % (cnt + 1,
                                                        getWaitTime(cnt))

            time.sleep(getWaitTime(cnt))

            cnt += 1

            continue
Пример #3
0
def wcst11EnqueueAsyncProc(actions, context):
    """ WCS-T 1.1 Asynchronous Transaction --- task queue & worker daemon """

    try:

        # register new task handler
        registerTaskType(PROCESS_CLASS, ASYNC_HANDLER, ASYNC_TIMEOUT)

        # enqueue task for execution
        enqueueTask(PROCESS_CLASS, context['tid'], (actions, context))

    except QueueFull:

        raise ExServerBusy
Пример #4
0
def wcst11EnqueueAsyncProc( actions , context ) : 
    """ WCS-T 1.1 Asynchronous Transaction --- task queue & worker daemon """

    try : 

        # register new task handler 
        registerTaskType( PROCESS_CLASS , ASYNC_HANDLER , ASYNC_TIMEOUT ) 

        # enqueue task for execution 
        enqueueTask( PROCESS_CLASS , context['tid'] , (actions,context) ) 

    except QueueFull : 

        raise ExServerBusy
Пример #5
0
    try : 
        deleteTaskByIdentifier( "SequenceSum" , "Task001" )
    except : pass 

#-------------------------------------------------------------------------------
# Step 2 - task registration 


    registerTaskType( "SequenceSum" , "tools.atp_demo.handler" , 60 , 600 , 3 )

#-------------------------------------------------------------------------------
# Step 3 - new task creation 
 
    while True :
        try:
            enqueueTask( "SequenceSum" , "Task001" , (1,2,3,4,5) )
            break
        except QueueFull : # retry if queue full
            print "QueueFull!"
            time.sleep( 5 )

#-------------------------------------------------------------------------------
# Step 4 - polling task status 

    while True :
        status = getTaskStatusByIdentifier( "SequenceSum" , "Task001" )
        print time.asctime() , "Status: " , status[1]
        if status[1] in ( "FINISHED" , "FAILED" ) : break
        time.sleep( 5 )

#-------------------------------------------------------------------------------
Пример #6
0
    try:
        deleteTaskByIdentifier("SequenceSum", "Task001")
    except:
        pass

    #-------------------------------------------------------------------------------
    # Step 2 - task registration

    registerTaskType("SequenceSum", "tools.atp_demo.handler", 60, 600, 3)

    #-------------------------------------------------------------------------------
    # Step 3 - new task creation

    while True:
        try:
            enqueueTask("SequenceSum", "Task001", (1, 2, 3, 4, 5))
            break
        except QueueFull:  # retry if queue full
            print "QueueFull!"
            time.sleep(5)

#-------------------------------------------------------------------------------
# Step 4 - polling task status

    while True:
        status = getTaskStatusByIdentifier("SequenceSum", "Task001")
        print time.asctime(), "Status: ", status[1]
        if status[1] in ("FINISHED", "FAILED"): break
        time.sleep(5)

#-------------------------------------------------------------------------------