• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemocracyClub / WhoCanIVoteFor / 76043ff7-7bec-4853-9a32-7344c1706bfb

28 Apr 2026 11:48AM UTC coverage: 59.561% (-0.02%) from 59.584%
76043ff7-7bec-4853-9a32-7344c1706bfb

Pull #2377

circleci

awdem
ignore router on lambda
Pull Request #2377: Lambda db routing

0 of 3 new or added lines in 2 files covered. (0.0%)

2 existing lines in 2 files now uncovered.

3068 of 5151 relevant lines covered (59.56%)

0.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/wcivf/lambda_handler.py
1
import json
×
NEW
2
import os
×
3

4
import django
×
5
import sentry_sdk
×
6
from django.core.management import call_command
×
7

8

9
def handler(event, context):
×
10
    """
11
    Parameters
12
    ----------
13
    event: dict, required
14
        Either an SQS event (when invoked via the SQS event source mapping) or
15
        a direct invocation payload. SQS events wrap the command payload in
16
        Records[0].body as a JSON string.
17

18
        SQS event doc: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
19

20
    context: object, required
21
        Lambda Context runtime methods and attributes
22

23
        Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html
24

25
    Returns
26
    ------
27
    dict with statusCode and body
28
    """
29
    if "Records" in event:
×
30
        event = json.loads(event["Records"][0]["body"])
×
31

32
    cmd = event["command"]
×
33
    args = event.get("args", [])
×
34

35
    sentry_sdk.set_context("event", event)
×
36
    # Ensure we use the principal database for everything in this lambda
NEW
37
    os.environ["IGNORE_ROUTERS"] = "1"
×
UNCOV
38
    django.setup()
×
39

40
    print(f"Calling {cmd} with args {args}")
×
41
    call_command(cmd, *args)
×
42

43
    arg_str = " ".join(args)
×
44
    return {
×
45
        "statusCode": 200,
46
        "body": json.dumps(
47
            {
48
                "message": f"{cmd} {arg_str} completed",
49
            }
50
        ),
51
    }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc