예제 #1
0
파일: test_agent.py 프로젝트: CSIS/proccer
def test_disabled_lock_extra_config():
    conf = {
        'commands': {
            'testdisabledlock': {
                'command': 'true',
                'lockfile': {
                    'timeout': 100,
                    'disabled': True,
                },
            },
        },
    }
    with assert_raises(AssertionError):
        run_process(conf, 'testdisabledlock')
예제 #2
0
파일: test_agent.py 프로젝트: CSIS/proccer
def test_disabled_lock():
    conf = {
        'commands': {
            'testdisabledlock': {
                'command': 'true',
                'lockfile': {
                    'disabled': True,
                },
            },
        },
    }
    with patch('proccer.agent.FileLock') as mock:
        run_process(conf, 'testdisabledlock')
        assert not mock.called, mock.mock_calls
예제 #3
0
def run_processes():
    opts, args = run_processes_opts.parse_args()
    log = configure_logging(opts)

    from proccer import agent
    conf = agent.load_configuration(opts.configuration)
    for name in args:
        try:
            log.debug('[%s] starting', name)
            result = agent.run_process(conf, name)
            if result:
                agent.log_for(result)
                agent.report(result)
                agent.raise_for(result)
            log.debug('[%s] done', name)

        except agent.ProcessError, e:
            log.error('[%s] %s', name, e.args[0])
            sys.exit(1)