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.

add_object()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 14
rs 9.4285
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# pylint: disable=C0330,C0103
4
"""UKMDB Worker.
5
6
Usage: ukm_graph [--help] [--debug ...]
7
8
Options:
9
  -d --debug               Show debug information (maybe multiple).
10
11
  ukm_graph (-h | --help)
12
  ukm_graph --version
13
14
"""
15
16
from __future__ import absolute_import
17
import logging
18
from pprint import pformat
19
import uuid
20
from celery import Celery
21
from docopt import docopt
22
from ukmdb_worker.base import set_debug_level
23
from ukmdb_worker import __version__
24
from ukmdb_worker import queues
25
from ukmdb_settings import settings
26
27
28
ukmdb_log = logging.getLogger("ukmdb")
29
30
31
app = Celery('worker',
32
             broker=settings.AMQP_BROKER_URL,
33
             )
34
35
queues.setup(app)
36
37
# app.conf.update(
38
#     CELERY_ROUTES={
39
#         'ukmdb_graph.worker.add_object': {
40
#             'queue': 'ukmdb_graph01',
41
#             'routing_key': '#',
42
#         },
43
#     },
44
# )
45
#
46
47
48
@app.task(serializer='json',
49
          name='worker.add_object',
50
          queue='ukmdb_graph01',
51
          exchange='ukmdb_all_in',
52
          routing_key='#',
53
          bind=True
54
          )
55
def add_object(self, msg):
56
    ukmdb_log.debug("-------> self.request: '%s'", pformat(self.request))
57
    ukmdb_log.debug("graph # add_object: '%s'", str(msg))
58
    uuid_string = msg.get('uuid')
59
    if uuid_string is not None:
60
        uuid_o = uuid.UUID(uuid_string)
61
        ukmdb_log.debug("UUID object: %s", uuid_o)
62
63
64
def main():
65
    arguments = docopt(__doc__, options_first=True, version=__version__)
66
    set_debug_level(ukmdb_log, arguments)
67
68
    ukmdb_log.debug(u'program start')
69
    app.start()
70
71
    exit("See 'ukm_graph --help'.")
72