GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — develop-v1.3.1 ( 7a20bf...1c6b17 )
by
unknown
05:35
created

st2actions.cmd._run_worker()   A

Complexity

Conditions 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 11
rs 9.4285
cc 3
1
import eventlet
2
import os
3
import sys
4
5
from st2common import log as logging
6
from st2common.service_setup import setup as common_setup
7
from st2common.service_setup import teardown as common_teardown
8
from st2actions.resultstracker import config
9
from st2actions.resultstracker import resultstracker
10
11
12
LOG = logging.getLogger(__name__)
13
14
15
eventlet.monkey_patch(
16
    os=True,
17
    select=True,
18
    socket=True,
19
    thread=False if '--use-debugger' in sys.argv else True,
20
    time=True)
21
22
23
def _setup():
24
    common_setup(service='resultstracker', config=config, setup_db=True,
25
                 register_mq_exchanges=True, register_signal_handlers=True)
26
27
28
def _run_worker():
29
    LOG.info('(PID=%s) Results tracker started.', os.getpid())
30
    tracker = resultstracker.get_tracker()
31
    try:
32
        tracker.start(wait=True)
33
    except (KeyboardInterrupt, SystemExit):
34
        LOG.info('(PID=%s) Results tracker stopped.', os.getpid())
35
        tracker.shutdown()
36
    except:
37
        return 1
38
    return 0
39
40
41
def _teardown():
42
    common_teardown()
43
44
45
def main():
46
    try:
47
        _setup()
48
        return _run_worker()
49
    except SystemExit as exit_code:
50
        sys.exit(exit_code)
51
    except:
52
        LOG.exception('(PID=%s) Results tracker quit due to exception.', os.getpid())
53
        return 1
54
    finally:
55
        _teardown()
56