Skip to content

Commit 857818c

Browse files
committed
add wclouser_fxa_db_counts job. Fixes DSRE-1779
1 parent ff7c18b commit 857818c

File tree

11 files changed

+273
-1
lines changed

11 files changed

+273
-1
lines changed

.circleci/config.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ jobs:
139139
name: Test Code
140140
command: docker run app:build python3 -m pytest
141141

142+
142143
build-job-dap-collector-ppa-prod:
143144
docker:
144145
- image: << pipeline.parameters.git-image >>
@@ -155,6 +156,7 @@ jobs:
155156
name: Test Code
156157
command: docker run app:build python3 -m pytest
157158

159+
158160
build-job-desktop-mobile-mau-2020:
159161
docker:
160162
- image: << pipeline.parameters.git-image >>
@@ -345,6 +347,19 @@ jobs:
345347
command: docker run app:build pytest
346348

347349

350+
build-job-wclouser-fxa-db-counts:
351+
docker:
352+
- image: << pipeline.parameters.git-image >>
353+
steps:
354+
- checkout
355+
- compare-branch:
356+
pattern: ^jobs/wclouser-fxa-db-counts/
357+
- setup_remote_docker:
358+
version: << pipeline.parameters.docker-version >>
359+
- run:
360+
name: Build Docker image
361+
command: docker build -t app:build jobs/wclouser-fxa-db-counts/
362+
348363
build-job-webcompat-kb:
349364
docker:
350365
- image: << pipeline.parameters.git-image >>
@@ -501,7 +516,6 @@ workflows:
501516
branches:
502517
only: main
503518

504-
505519
job-fxci-taskcluster-export:
506520
jobs:
507521
- build-job-fxci-taskcluster-export
@@ -620,6 +634,20 @@ workflows:
620634
branches:
621635
only: main
622636

637+
job-wclouser-fxa-db-counts:
638+
jobs:
639+
- build-job-wclouser-fxa-db-counts
640+
- gcp-gcr/build-and-push-image:
641+
context: data-eng-airflow-gcr
642+
docker-context: jobs/wclouser-fxa-db-counts/
643+
path: jobs/wclouser-fxa-db-counts/
644+
image: wclouser-fxa-db-counts_docker_etl
645+
requires:
646+
- build-job-wclouser-fxa-db-counts
647+
filters:
648+
branches:
649+
only: main
650+
623651
job-webcompat-kb:
624652
jobs:
625653
- build-job-webcompat-kb
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.ci_job.yaml
2+
.ci_workflow.yaml
3+
.DS_Store
4+
*.pyc
5+
.pytest_cache/
6+
__pycache__/
7+
venv/

jobs/wclouser-fxa-db-counts/.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
*.pyc
3+
__pycache__/
4+
venv/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM python:3.8
2+
MAINTAINER Wil Clouser <[email protected]>
3+
4+
# https://github.com/mozilla-services/Dockerflow/blob/master/docs/building-container.md
5+
ARG USER_ID="10001"
6+
ARG GROUP_ID="app"
7+
ARG HOME="/app"
8+
9+
ENV HOME=${HOME}
10+
RUN groupadd --gid ${USER_ID} ${GROUP_ID} && \
11+
useradd --create-home --uid ${USER_ID} --gid ${GROUP_ID} --home-dir ${HOME} ${GROUP_ID}
12+
13+
WORKDIR ${HOME}
14+
15+
RUN pip install --upgrade pip
16+
17+
COPY requirements.txt requirements.txt
18+
RUN pip install -r requirements.txt
19+
20+
COPY . .
21+
22+
RUN pip install .
23+
24+
# Drop root and change ownership of the application folder to the user
25+
RUN chown -R ${USER_ID}:${GROUP_ID} ${HOME}
26+
USER ${USER_ID}

jobs/wclouser-fxa-db-counts/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# wclouser-fxa-db-counts
2+
3+
This is a simple job to enable us to identify trends within accounts data. E.g. "How many inactive accounts are there?"
4+
5+
## Usage
6+
7+
This script is intended to be run in a docker container.
8+
Build the docker image with:
9+
10+
```sh
11+
docker build -t wclouser_fxa_db_counts .
12+
```
13+
14+
To run locally, install dependencies with:
15+
16+
```sh
17+
pip install -r requirements.txt
18+
```
19+
20+
Run the script with
21+
22+
```sh
23+
python3 -m wclouser_fxa_db_counts.main
24+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
build-job-wclouser-fxa-db-counts:
2+
docker:
3+
- image: << pipeline.parameters.git-image >>
4+
steps:
5+
- checkout
6+
- compare-branch:
7+
pattern: ^jobs/wclouser-fxa-db-counts/
8+
- setup_remote_docker:
9+
version: << pipeline.parameters.docker-version >>
10+
- run:
11+
name: Build Docker image
12+
command: docker build -t app:build jobs/wclouser-fxa-db-counts/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
job-wclouser-fxa-db-counts:
2+
jobs:
3+
- build-job-wclouser-fxa-db-counts
4+
- gcp-gcr/build-and-push-image:
5+
context: data-eng-airflow-gcr
6+
docker-context: jobs/wclouser-fxa-db-counts/
7+
path: jobs/wclouser-fxa-db-counts/
8+
image: wclouser-fxa-db-counts_docker_etl
9+
requires:
10+
- build-job-wclouser-fxa-db-counts
11+
filters:
12+
branches:
13+
only: main
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
click==8.0.4
2+
pytest==6.0.2
3+
pytest-black==0.3.11
4+
pytest-flake8==1.0.6
5+
google-cloud-bigquery==3.26.0

jobs/wclouser-fxa-db-counts/setup.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
3+
from setuptools import setup, find_packages
4+
5+
readme = open("README.md").read()
6+
7+
setup(
8+
name="wclouser_fxa_db_counts",
9+
version="0.1.0",
10+
author="Wil Clouser <[email protected]>",
11+
packages=find_packages(include=["docker_etl"]), # TODO: change placeholder name
12+
long_description=readme,
13+
include_package_data=True,
14+
license="MPL 2.0",
15+
)

0 commit comments

Comments
 (0)