def delete(name, **kwargs):
    '''
    Delete a job from the minion's schedule

    CLI Example:

    .. code-block:: bash

        salt '*' schedule.delete job1
    '''

    ret = {'comment': 'Failed to delete job {0} from schedule.'.format(name),
           'result': False}

    if not name:
        ret['comment'] = 'Job name is required.'

    if 'test' in kwargs and kwargs['test']:
        ret['comment'] = 'Job: {0} would be deleted from schedule.'.format(name)
        ret['result'] = True
    else:
        persist = True
        if 'persist' in kwargs:
            persist = kwargs['persist']

        if name in list_(show_all=True, where='opts', return_yaml=False):
            event_data = {'name': name, 'func': 'delete', 'persist': persist}
        elif name in list_(show_all=True, where='pillar', return_yaml=False):
            event_data = {'name': name, 'where': 'pillar', 'func': 'delete', 'persist': False}
        else:
            ret['comment'] = 'Job {0} does not exist.'.format(name)
            return ret

        try:
            eventer = salt.utils.event.get_event('minion', opts=__opts__)
            res = __salt__['event.fire'](event_data, 'manage_schedule')
            if res:
                event_ret = eventer.get_event(tag='/salt/minion/minion_schedule_delete_complete', wait=30)
                if event_ret and event_ret['complete']:
                    schedule = event_ret['schedule']
                    if name not in schedule:
                        ret['result'] = True
                        ret['comment'] = 'Deleted Job {0} from schedule.'.format(name)
                    else:
                        ret['comment'] = 'Failed to delete job {0} from schedule.'.format(name)
                    return ret
        except KeyError:
            # Effectively a no-op, since we can't really return without an event system
            ret['comment'] = 'Event module not available. Schedule add failed.'
    return ret
dataset/ETHPy150Open saltstack/salt/salt/modules/schedule.py/delete/original