<s> from circus . commands . base import Command <EOL> from circus . exc import ArgumentError <EOL> from circus . util import TransformableFuture <EOL> class Reload ( Command ) : <EOL> """<STR_LIT>""" <EOL> name = "<STR_LIT>" <EOL> options = ( Command . options + Command . waiting_options + <EOL> [ ( '<STR_LIT>' , '<STR_LIT>' , False , "<STR_LIT>" ) ] + <EOL> [ ( '<STR_LIT>' , '<STR_LIT>' , False , "<STR_LIT>" ) ] ) <EOL> def message ( self , * args , ** opts ) : <EOL> if len ( args ) > <NUM_LIT:1> : <EOL> raise ArgumentError ( "<STR_LIT>" ) <EOL> graceful = not opts . get ( "<STR_LIT>" , False ) <EOL> waiting = opts . get ( "<STR_LIT>" , False ) <EOL> sequential = opts . get ( "<STR_LIT>" , False ) <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> return self . make_message ( name = args [ <NUM_LIT:0> ] , graceful = graceful , <EOL> waiting = waiting , sequential = sequential ) <EOL> else : <EOL> return self . make_message ( graceful = graceful , waiting = waiting , <EOL> sequential = sequential ) <EOL> def execute ( self , arbiter , props ) : <EOL> graceful = props . get ( '<STR_LIT>' , True ) <EOL> sequential = props . get ( '<STR_LIT>' , False ) <EOL> if '<STR_LIT:name>' in props : <EOL> watcher = self . _get_watcher ( arbiter , props [ '<STR_LIT:name>' ] ) <EOL> if props . get ( '<STR_LIT>' ) : <EOL> resp = TransformableFuture ( ) <EOL> resp . set_upstream_future ( watcher . reload ( <EOL> graceful = graceful , <EOL> sequential = sequential ) ) <EOL> resp . set_transform_function ( lambda x : { "<STR_LIT:info>" : x } ) <EOL> return resp <EOL> return watcher . reload ( graceful = graceful , <EOL> sequential = sequential ) <EOL> else : <EOL> return arbiter . reload ( graceful = graceful , sequential = sequential ) </s>
