From 129197b89817cbc1f484e06f6d398b3fd0f57068 Mon Sep 17 00:00:00 2001 From: bistline Date: Thu, 30 Jan 2025 13:32:20 -0500 Subject: [PATCH 1/2] adding STDOUT logging handler --- ingest/monitor.py | 3 +++ scripts/vault-gsm-migration.sh | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ingest/monitor.py b/ingest/monitor.py index 21f9e737..1ba98df9 100644 --- a/ingest/monitor.py +++ b/ingest/monitor.py @@ -1,5 +1,6 @@ import logging import os +import sys from contextlib import nullcontext # General docs for Sentry: @@ -41,6 +42,8 @@ def setup_logger(logger_name, log_file, level=logging.DEBUG, format="default"): logger.propagate = True logger.setLevel(level) logger.addHandler(handler) + # also log to STDOUT to pass to cloud logging + logger.addHandler(logging.StreamHandler(sys.stdout)) return logger diff --git a/scripts/vault-gsm-migration.sh b/scripts/vault-gsm-migration.sh index 04e9536b..14709bc2 100755 --- a/scripts/vault-gsm-migration.sh +++ b/scripts/vault-gsm-migration.sh @@ -38,7 +38,8 @@ function main { BASEPATH="secret/kdux/scp/development/$(whoami)" VAULT_SECRET="" ROLLBACK="false" - while getopts "t:p:b:s:rh" OPTION; do + NAME_OVERRIDE="" + while getopts "t:p:b:s:n:rh" OPTION; do case $OPTION in t) VAULT_TOKEN="$OPTARG" @@ -55,6 +56,10 @@ function main { VAULT_SECRET="$OPTARG" echo "setting VAULT_SECRET to $VAULT_SECRET" ;; + n) + NAME_OVERRIDE="$OPTARG" + echo "using $NAME_OVERRIDE as GSM secret name" + ;; r) ROLLBACK="true" ;; @@ -78,7 +83,12 @@ function main { # set up for GSM secret based on existing vault path # changes / to -, e.g. mongo/hostname becomes mongo-hostname - GSM_SECRET_NAME=$(echo "$VAULT_SECRET" | sed 's/\//\-/g') + GSM_SECRET_NAME=$(echo "$VAULT_SECRET" | sed 's/[/_]/\-/g') + + # use name override if specified + if [[ -n "$NAME_OVERRIDE" ]]; then + GSM_SECRET_NAME="$NAME_OVERRIDE" + fi if [[ "$ROLLBACK" = "true" ]]; then echo "Rolling back GSM migration" @@ -109,6 +119,7 @@ USAGE: -s VAULT_SECRET set the name of the requested secret in vault to copy (no default) [OPTIONS] + -n GSM_NAME set the name of the new GSM secret, otherwise defaults to old name with special chars converted to - -p PROJECT set the GCP project in which to create secrets (defaults to '$(gcloud info --format="value(config.project)")') -b BASEPATH set the base vault path for retrieving secrets (defaults to 'secret/kdux/scp/development/$(whoami)') -r roll back migration and delete scp-ingest-pipeline secret in GSM From 22786522fb390e97f847355be12887477557350e Mon Sep 17 00:00:00 2001 From: bistline Date: Thu, 30 Jan 2025 13:49:46 -0500 Subject: [PATCH 2/2] fixing typo --- ingest/de.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingest/de.py b/ingest/de.py index b214eab0..a6f0de32 100644 --- a/ingest/de.py +++ b/ingest/de.py @@ -367,7 +367,7 @@ def write_de_result(adata, group, annotation, rank_key, cluster_name, extra_para clean_group = DifferentialExpression.sanitize_string(group) out_file = f'{cluster_name}--{clean_annotation}--{clean_group}--{annot_scope}--{method}.tsv' DifferentialExpression.de_logger.info( - f"Writing DE output for {clean_group} vs restq" + f"Writing DE output for {clean_group} vs rest" ) elif de_type == "pairwise": # rank_genes_groups accepts a list. For SCP pairwise, should be a list with one item