st2api/st2api/controllers/v1/actionexecutions.py
def post(self, spec_api, id, requester_user, no_merge=False, show_secrets=False):
        """
        Re-run the provided action execution optionally specifying override parameters.

        Handles requests:

            POST /executions/<id>/re_run
        """

        if (spec_api.tasks or spec_api.reset) and spec_api.parameters:
            raise ValueError('Parameters override is not supported when '
                             're-running task(s) for a workflow.')

        if spec_api.parameters:
            assert isinstance(spec_api.parameters, dict)

        if spec_api.tasks:
            assert isinstance(spec_api.tasks, list)

        if spec_api.reset:
            assert isinstance(spec_api.reset, list)

        if list(set(spec_api.reset) - set(spec_api.tasks)):
            raise ValueError('List of tasks to reset does not match the tasks to rerun.')

        no_merge = cast_argument_value(value_type=bool, value=no_merge)
        existing_execution = self._get_one_by_id(id=id, exclude_fields=self.exclude_fields,
                                                 requester_user=requester_user,
                                                 permission_type=PermissionType.EXECUTION_VIEW)

        if spec_api.tasks and existing_execution.runner['name'] != 'mistral-v2':
            raise ValueError('Task option is only supported for Mistral workflows.')

        # Merge in any parameters provided by the user
        new_parameters = {}
        if not no_merge:
            new_parameters.update(getattr(existing_execution, 'parameters', {}))
        new_parameters.update(spec_api.parameters)

        # Create object for the new execution
        action_ref = existing_execution.action['ref']

        # Include additional option(s) for the execution
        context = {
            're-run': {
                'ref': id,
            }
        }

        if spec_api.tasks:
            context['re-run']['tasks'] = spec_api.tasks

        if spec_api.reset:
            context['re-run']['reset'] = spec_api.reset

        # Add trace to the new execution
        trace = trace_service.get_trace_db_by_action_execution(
            action_execution_id=existing_execution.id)

        if trace:
            context['trace_context'] = {'id_': str(trace.id)}

        new_liveaction_api = LiveActionCreateAPI(action=action_ref,
                                                 context=context,
                                                 parameters=new_parameters,
                                                 user=spec_api.user)

        return self._handle_schedule_execution(liveaction_api=new_liveaction_api,
                                               requester_user=requester_user,
                                               show_secrets=show_secrets)

        Re-run the provided action execution optionally specifying override parameters.

        Handles requests:

            POST /executions/<id>/re_run
        
Re-run the provided action execution optionally specifying override parameters.
Handles requests.


Re - run the provided action execution optionally specifying override parameters . Handles requests .
def post(self, spec_api, id, requester_user, no_merge=False, show_secrets=False):
        if (spec_api.tasks or spec_api.reset) and spec_api.parameters:
            raise ValueError('Parameters override is not supported when '
                             're-running task(s) for a workflow.')
        if spec_api.parameters:
            assert isinstance(spec_api.parameters, dict)
        if spec_api.tasks:
            assert isinstance(spec_api.tasks, list)
        if spec_api.reset:
            assert isinstance(spec_api.reset, list)
        if list(set(spec_api.reset) - set(spec_api.tasks)):
            raise ValueError('List of tasks to reset does not match the tasks to rerun.')
        no_merge = cast_argument_value(value_type=bool, value=no_merge)
        existing_execution = self._get_one_by_id(id=id, exclude_fields=self.exclude_fields,
                                                 requester_user=requester_user,
                                                 permission_type=PermissionType.EXECUTION_VIEW)
        if spec_api.tasks and existing_execution.runner['name'] != 'mistral-v2':
            raise ValueError('Task option is only supported for Mistral workflows.')
        new_parameters = {}
        if not no_merge:
            new_parameters.update(getattr(existing_execution, 'parameters', {}))
        new_parameters.update(spec_api.parameters)
        action_ref = existing_execution.action['ref']
        context = {
            're-run': {
                'ref': id,
            }
        }
        if spec_api.tasks:
            context['re-run']['tasks'] = spec_api.tasks
        if spec_api.reset:
            context['re-run']['reset'] = spec_api.reset
        trace = trace_service.get_trace_db_by_action_execution(
            action_execution_id=existing_execution.id)
        if trace:
            context['trace_context'] = {'id_': str(trace.id)}
        new_liveaction_api = LiveActionCreateAPI(action=action_ref,
                                                 context=context,
                                                 parameters=new_parameters,
                                                 user=spec_api.user)
        return self._handle_schedule_execution(liveaction_api=new_liveaction_api,
                                               requester_user=requester_user,
                                               show_secrets=show_secrets)
def post ( self , spec_api , id , requester_user , no_merge = False , show_secrets = False ) : if ( spec_api . tasks or spec_api . reset ) and spec_api . parameters : raise ValueError ( 'Parameters override is not supported when ' 're-running task(s) for a workflow.' ) if spec_api . parameters : assert isinstance ( spec_api . parameters , dict ) if spec_api . tasks : assert isinstance ( spec_api . tasks , list ) if spec_api . reset : assert isinstance ( spec_api . reset , list ) if list ( set ( spec_api . reset ) - set ( spec_api . tasks ) ) : raise ValueError ( 'List of tasks to reset does not match the tasks to rerun.' ) no_merge = cast_argument_value ( value_type = bool , value = no_merge ) existing_execution = self . _get_one_by_id ( id = id , exclude_fields = self . exclude_fields , requester_user = requester_user , permission_type = PermissionType . EXECUTION_VIEW ) if spec_api . tasks and existing_execution . runner [ 'name' ] != 'mistral-v2' : raise ValueError ( 'Task option is only supported for Mistral workflows.' ) new_parameters = { } if not no_merge : new_parameters . update ( getattr ( existing_execution , 'parameters' , { } ) ) new_parameters . update ( spec_api . parameters ) action_ref = existing_execution . action [ 'ref' ] context = { 're-run' : { 'ref' : id , } } if spec_api . tasks : context [ 're-run' ] [ 'tasks' ] = spec_api . tasks if spec_api . reset : context [ 're-run' ] [ 'reset' ] = spec_api . reset trace = trace_service . get_trace_db_by_action_execution ( action_execution_id = existing_execution . id ) if trace : context [ 'trace_context' ] = { 'id_' : str ( trace . id ) } new_liveaction_api = LiveActionCreateAPI ( action = action_ref , context = context , parameters = new_parameters , user = spec_api . user ) return self . _handle_schedule_execution ( liveaction_api = new_liveaction_api , requester_user = requester_user , show_secrets = show_secrets )
Re-run the provided action execution optionally specifying override parameters.
Re - run the provided action execution optionally specifying override parameters .
"""
        Re-run the provided action execution optionally specifying override parameters.

        Handles requests:

            POST /executions/<id>/re_run
        """ # Merge in any parameters provided by the user # Create object for the new execution # Include additional option(s) for the execution # Add trace to the new execution
self
spec_api
id
requester_user
no_merge
show_secrets