

def run_job(name, force=False):
    "\n    Run a scheduled job on the minion immediately\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' schedule.run_job job1\n\n        salt '*' schedule.run_job job1 force=True\n        Force the job to run even if it is disabled.\n    "
    ret = {
        'comment': [],
        'result': True,
    }
    if (not name):
        ret['comment'] = 'Job name is required.'
        ret['result'] = False
    schedule = list_(show_all=True, return_yaml=False)
    if (name in schedule):
        data = schedule[name]
        if (('enabled' in data) and (not data['enabled']) and (not force)):
            ret['comment'] = 'Job {0} is disabled.'.format(name)
        else:
            out = __salt__['event.fire']({
                'name': name,
                'func': 'run_job',
            }, 'manage_schedule')
            if out:
                ret['comment'] = 'Scheduling Job {0} on minion.'.format(name)
            else:
                ret['comment'] = 'Failed to run job {0} on minion.'.format(name)
                ret['result'] = False
    else:
        ret['comment'] = 'Job {0} does not exist.'.format(name)
        ret['result'] = False
    return ret

dataset/ETHPy150Open saltstack/salt/salt/modules/schedule.py run_job/original