<s> from __future__ import print_function <EOL> from jobqueue . client import connect <EOL> DEBUG = True <EOL> server = connect ( '<STR_LIT>' ) <EOL> def checkqueue ( pending = [ ] , active = [ ] , complete = [ ] ) : <EOL> qpending = server . jobs ( '<STR_LIT>' ) <EOL> qactive = server . jobs ( '<STR_LIT>' ) <EOL> qcomplete = server . jobs ( '<STR_LIT>' ) <EOL> if DEBUG : print ( "<STR_LIT>" , qpending , "<STR_LIT>" , qactive , "<STR_LIT>" , qcomplete ) <EOL> long = { '<STR_LIT>' : '<STR_LIT:count>' , '<STR_LIT:data>' : <NUM_LIT> , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> short = { '<STR_LIT>' : '<STR_LIT:count>' , '<STR_LIT:data>' : <NUM_LIT:200> , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> fail1 = { '<STR_LIT>' : '<STR_LIT:count>' , '<STR_LIT:data>' : '<STR_LIT:string>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> fail2 = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:data>' : '<STR_LIT:string>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> job = server . submit ( int ) <EOL> print ( "<STR_LIT>" , job ) <EOL> checkqueue ( ) <EOL> job2 = server . submit ( short ) <EOL> print ( "<STR_LIT>" , job2 ) <EOL> result = server . wait ( job [ '<STR_LIT:id>' ] , pollrate = <NUM_LIT:10> , timeout = <NUM_LIT> ) <EOL> print ( "<STR_LIT:result>" , result ) <EOL> checkqueue ( ) <EOL> print ( "<STR_LIT>" , server . info ( job [ '<STR_LIT:id>' ] ) ) <EOL> print ( "<STR_LIT>" , server . delete ( job [ '<STR_LIT:id>' ] ) ) <EOL> checkqueue ( ) <EOL> job3 = server . submit ( fail1 ) <EOL> job4 = server . submit ( fail2 ) <EOL> print ( "<STR_LIT>" ) <EOL> result = server . wait ( job3 [ '<STR_LIT:id>' ] , pollrate = <NUM_LIT:1> , timeout = <NUM_LIT> ) <EOL> print ( result [ '<STR_LIT:error>' ] ) <EOL> print ( result [ '<STR_LIT>' ] ) <EOL> print ( "<STR_LIT>" ) <EOL> result = server . wait ( job4 [ '<STR_LIT:id>' ] , pollrate = <NUM_LIT:1> , timeout = <NUM_LIT> ) <EOL> print ( result [ '<STR_LIT:error>' ] ) <EOL> print ( result [ '<STR_LIT>' ] ) </s>
