<s> import uuid <EOL> from st2actions . runners import ActionRunner <EOL> from st2common import log as logging <EOL> from st2common . constants . action import LIVEACTION_STATUS_SUCCEEDED <EOL> from st2common . exceptions import actionrunner as runnerexceptions <EOL> from st2common . models . api . trace import TraceContext <EOL> from st2common . transport . announcement import AnnouncementDispatcher <EOL> LOG = logging . getLogger ( __name__ ) <EOL> def get_runner ( ) : <EOL> return AnnouncementRunner ( str ( uuid . uuid4 ( ) ) ) <EOL> class AnnouncementRunner ( ActionRunner ) : <EOL> def __init__ ( self , runner_id ) : <EOL> super ( AnnouncementRunner , self ) . __init__ ( runner_id = runner_id ) <EOL> self . _dispatcher = AnnouncementDispatcher ( LOG ) <EOL> def pre_run ( self ) : <EOL> LOG . debug ( '<STR_LIT>' , <EOL> self . liveaction_id ) <EOL> if not self . runner_parameters . get ( '<STR_LIT>' ) : <EOL> message = ( '<STR_LIT>' % self . action . ref ) <EOL> LOG . exception ( '<STR_LIT>' ) <EOL> raise runnerexceptions . ActionRunnerPreRunError ( message ) <EOL> self . _route = self . runner_parameters . get ( '<STR_LIT>' ) <EOL> def run ( self , action_parameters ) : <EOL> trace_context = self . liveaction . context . get ( '<STR_LIT>' , None ) <EOL> if trace_context : <EOL> trace_context = TraceContext ( ** trace_context ) <EOL> self . _dispatcher . dispatch ( self . _route , <EOL> payload = action_parameters , <EOL> trace_context = trace_context ) <EOL> return ( LIVEACTION_STATUS_SUCCEEDED , action_parameters , None ) </s>
