Skip to content

Commit 6b9c1be

Browse files
authored
Script extract-jupyter-users-from-magpie-db: allow to customize the query (#530)
## Overview Script `extract-jupyter-users-from-magpie-db`: allow to customize the query An example query is provided if we want to list all users, except if they belong to some groups. ## Changes **Non-breaking changes** - `extract-jupyter-users-from-magpie-db`: allow to customize the query ## CI Operations <!-- The test suite can be run using a different DACCS config with ``birdhouse_daccs_configs_branch: branch_name`` in the PR description. To globally skip the test suite regardless of the commit message use ``birdhouse_skip_ci`` set to ``true`` in the PR description. Using ``[<cmd>]`` (with the brackets) where ``<cmd> = skip ci`` in the commit message will override ``birdhouse_skip_ci`` from the PR description. Such commit command can be used to override the PR description behavior for a specific commit update. However, a commit message cannot 'force run' a PR which the description turns off the CI. To run the CI, the PR should instead be updated with a ``true`` value, and a running message can be posted in following PR comments to trigger tests once again. --> birdhouse_daccs_configs_branch: master birdhouse_skip_ci: false
2 parents 222274c + a4823f9 commit 6b9c1be

File tree

8 files changed

+52
-18
lines changed

8 files changed

+52
-18
lines changed

.bumpversion.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.13.4
2+
current_version = 2.13.5
33
commit = True
44
tag = False
55
tag_name = {new_version}
@@ -30,11 +30,11 @@ search = {current_version}
3030
replace = {new_version}
3131

3232
[bumpversion:file:RELEASE.txt]
33-
search = {current_version} 2025-05-05T13:04:34Z
33+
search = {current_version} 2025-05-08T17:20:00Z
3434
replace = {new_version} {utcnow:%Y-%m-%dT%H:%M:%SZ}
3535

3636
[bumpversion:part:releaseTime]
37-
values = 2025-05-05T13:04:34Z
37+
values = 2025-05-08T17:20:00Z
3838

3939
[bumpversion:file(version):birdhouse/components/canarie-api/docker_configuration.py.template]
4040
search = 'version': '{current_version}'

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717

1818
[//]: # (list changes here, using '-' for each new entry, remove this when items are added)
1919

20+
[2.13.5](https://github.com/bird-house/birdhouse-deploy/tree/2.13.5) (2025-05-08)
21+
------------------------------------------------------------------------------------------------------------------
22+
23+
## Changes
24+
25+
- Script `extract-jupyter-users-from-magpie-db`: allow to customize the query
26+
27+
An example query is provided if we want to list all users, except if they
28+
belong to some groups.
29+
30+
2031
[2.13.4](https://github.com/bird-house/birdhouse-deploy/tree/2.13.4) (2025-05-05)
2132
------------------------------------------------------------------------------------------------------------------
2233

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ override BIRDHOUSE_MAKE_DIR := $(shell realpath -P $$(dirname $(BIRDHOUSE_MAKE_C
88
# Generic variables
99
override SHELL := bash
1010
override APP_NAME := birdhouse-deploy
11-
override APP_VERSION := 2.13.4
11+
override APP_VERSION := 2.13.5
1212

1313
# utility to remove comments after value of an option variable
1414
override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g")

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ for a full-fledged production platform.
1818
* - citation
1919
- | |citation|
2020

21-
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.13.4.svg
21+
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.13.5.svg
2222
:alt: Commits since latest release
23-
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.13.4...master
23+
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.13.5...master
2424

25-
.. |latest-version| image:: https://img.shields.io/badge/tag-2.13.4-blue.svg?style=flat
25+
.. |latest-version| image:: https://img.shields.io/badge/tag-2.13.5-blue.svg?style=flat
2626
:alt: Latest Tag
27-
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.13.4
27+
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.13.5
2828

2929
.. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest
3030
:alt: ReadTheDocs Build Status (latest version)

RELEASE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.13.4 2025-05-05T13:04:34Z
1+
2.13.5 2025-05-08T17:20:00Z

birdhouse/components/canarie-api/docker_configuration.py.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ SERVICES = {
108108
# NOTE:
109109
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
110110
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
111-
'version': '2.13.4',
112-
'releaseTime': '2025-05-05T13:04:34Z',
111+
'version': '2.13.5',
112+
'releaseTime': '2025-05-08T17:20:00Z',
113113
'institution': '${BIRDHOUSE_INSTITUTION}',
114114
'researchSubject': '${BIRDHOUSE_SUBJECT}',
115115
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',
@@ -141,8 +141,8 @@ PLATFORMS = {
141141
# NOTE:
142142
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
143143
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
144-
'version': '2.13.4',
145-
'releaseTime': '2025-05-05T13:04:34Z',
144+
'version': '2.13.5',
145+
'releaseTime': '2025-05-08T17:20:00Z',
146146
'institution': '${BIRDHOUSE_INSTITUTION}',
147147
'researchSubject': '${BIRDHOUSE_SUBJECT}',
148148
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',

birdhouse/scripts/extract-jupyter-users-from-magpie-db

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
# Extract Jupyter users from Magpie DB so we can send announcements to all
44
# Jupyter users.
55
#
6+
# Environment variable EXTRACT_JUPYTER_USERS_FROM_MAGPIE_DB_QUERY can be set to
7+
# customize the query in env.local.
8+
#
9+
# Example: list all users, except those in group1 and group2
10+
#
11+
# EXTRACT_JUPYTER_USERS_FROM_MAGPIE_DB_QUERY="${EXTRACT_JUPYTER_USERS_FROM_MAGPIE_DB_QUERY:-"
12+
# SELECT email,user_name
13+
# FROM users
14+
# WHERE id NOT IN
15+
# (SELECT user_id
16+
# FROM users_groups
17+
# WHERE group_id IN
18+
# (SELECT id FROM groups
19+
# WHERE group_name IN ('group1', 'group2')
20+
# )
21+
# )
22+
# ORDER BY email
23+
# "}"
24+
#
625
# Sample output:
726
#
827
# $ ./scripts/extract-jupyter-users-from-magpie-db > /tmp/out
@@ -24,13 +43,17 @@ THIS_DIR="$(dirname "${THIS_FILE}")"
2443
COMPOSE_DIR="${COMPOSE_DIR:-$(dirname "${THIS_DIR}")}"
2544

2645
if [ -f "${COMPOSE_DIR}/read-configs.include.sh" ]; then
46+
47+
# Silence warnings in this simple script.
48+
export BIRDHOUSE_LOG_QUIET=True
49+
2750
. "${COMPOSE_DIR}/read-configs.include.sh"
2851

29-
# Get POSTGRES_MAGPIE_USERNAME, MAGPIE_DB_NAME.
52+
# Get EXTRACT_JUPYTER_USERS_FROM_MAGPIE_DB_QUERY
3053
read_configs
3154
fi
3255

3356
set -x
3457

35-
echo "SELECT email,user_name FROM users ORDER BY email" | \
36-
docker exec -i postgres-magpie psql -U "${POSTGRES_MAGPIE_USERNAME}" "${MAGPIE_DB_NAME}"
58+
echo "${EXTRACT_JUPYTER_USERS_FROM_MAGPIE_DB_QUERY:="SELECT email,user_name FROM users ORDER BY email"}" | \
59+
docker exec -i postgres-magpie sh -c 'psql -U "${POSTGRES_USER}" "${POSTGRES_DB}"'

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
# built documents.
7070
#
7171
# The short X.Y version.
72-
version = '2.13.4'
72+
version = '2.13.5'
7373
# The full version, including alpha/beta/rc tags.
74-
release = '2.13.4'
74+
release = '2.13.5'
7575

7676
# The language for content autogenerated by Sphinx. Refer to documentation
7777
# for a list of supported languages.

0 commit comments

Comments
 (0)