Skip to content

Commit

Permalink
SDKTECHNO-269: Add SaagieAPI request timeout env var on SUM
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikail Congar committed Sep 5, 2024
1 parent 71d65ed commit abfad13
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions technologies/app/saagie-usage-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ To deploy Saagie Usage Monitoring on your platform, you need to create a user wi
- IP_HDFS (Required if MONITORING_OPT=`SAAGIE_AND_DATALAKE`) : Namenode IP
- AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_S3_ENDPOINT and AWS_REGION_NAME (Required if MONITORING_OPT=`SAAGIE_AND_S3`)
- SAAGIE_SUM_CRON : Cron to collect Saagie informations on API (Optionnal, Default value : `0 * * * *`)
- REQUEST_TIMEOUT : Manage SaagieAPI request timeout (Default value in seconds : `10`)

For an external Postgres database :
- SAAGIE_PG_HOST : Postgresql host (Default value : `localhost`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
boto3==1.28.54
urllib3==1.26.5
psycopg2==2.9.2
pyarrow==6.0.1
pyarrow==7.0
hdfs
saagieapi==2.9.2
saagieapi==2.13.0
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
saagie_realm = os.environ["SAAGIE_REALM"]
saagie_platform = os.environ["SAAGIE_PLATFORM_ID"]

timeout = os.environ["REQUEST_TIMEOUT"]

# Workaround for platforms with too many instances
MAX_INSTANCES_FETCHED = os.environ.get("SMT_MAX_INSTANCES_FETCHED", 1000)
Expand All @@ -39,7 +40,8 @@ def __init__(self):
id_platform=saagie_platform,
user=saagie_login,
password=saagie_password,
realm=saagie_realm)
realm=saagie_realm,
timeout=timeout)
def __enter__(self):
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ if [[ -z ${SAAGIE_SUPERVISION_LOGIN} || -z ${SAAGIE_SUPERVISION_PASSWORD} || -z
exit 1
fi

if [[ -z ${REQUEST_TIMEOUT} ]]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') [WARN] REQUEST_TIMEOUT not set, default timeout is 10 seconds"
export REQUEST_TIMEOUT=10
fi

if [[ -z ${MONITORING_OPT} ]]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') [WARN] MONITORING_OPT not set, Saagie Usage Monitoring will only monitor Saagie"
export MONITORING_OPT="SAAGIE"
Expand Down Expand Up @@ -48,6 +53,7 @@ echo \#!/bin/bash
echo export SAAGIE_URL="$SAAGIE_URL"
echo export SAAGIE_REALM="$SAAGIE_REALM"
echo export SAAGIE_PLATFORM_ID="$SAAGIE_PLATFORM_ID"
echo export REQUEST_TIMEOUT=$REQUEST_TIMEOUT
echo export MONITORING_OPT=$MONITORING_OPT
echo export IP_HDFS="$IP_HDFS"
echo export HADOOP_HOME=/hadoop/hadoop-2.6.5
Expand Down

0 comments on commit abfad13

Please sign in to comment.