TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #411 · 9 фев.

reload_flag="" if [[ -n "${DEBUG}" ]]; then reload_flag="--reload" fi if [[ -n "${WORKER_COUNT}" ]]; then workers=${WORKER_COUNT} else workers=2 fi gunicorn --workers ${workers} \ --bind 0.0.0.0:8000 \ ${reload_flag} main.wsgi Писали такие конструкции чтобы проверить наличие флага и сформировать команду правильно? На самом деле можно сделать тоже самое проще. Для этого используются операторы условной подстановки, доступные в оболочках семейства POSIX. :- для установки значений по умолчанию ${WORKER_COUNT:-2} Если переменная не объявлена, то будет дефолтное значение 2. :+ подставляет указанный текст, если переменная не пуста ${DEBUG:+--reload} Если что-то есть в переменной то распечатается текст после символа +, в противном случае - ничего. Удобно для опциональных флагов, как в нашем примере. Итого наш скрипт может выглядеть так: gunicorn --workers ${WORKER_COUNT:-2} \ --bind 0.0.0.0:8000 \ ${DEBUG:+--reload} main.wsgi Есть еще два оператора. := не только подставить дефолтное значение, но и присвоить его переменной, если она пуста # никаких переменных еще нет VAL1=${VAL2:=hello} # теперь доступны обе echo $VAL1 $VAL2 # hello hello :? остановить выполнение с ошибкой, если переменной нет. echo ${MISS:?is required} bash: MISS: is required Код выхода будет 1. #tricks#linux

Резултати

Пронајдени 3 слични објави

Пребарај: #dataengineering

当前筛选 #dataengineering清除筛选
Repositorio data science

@repo_science · Post #3567 · 06.09.2023 г., 19:13

#python#dataEngineering 📃 Amazon Web Services in Action Description Master essential best practices for deploying and managing applications on Amazon Web Services. This revised bestseller is packed with techniques for building highly available and scalable architectures and automating deployment with Infrastructure as Code. ⚖️1.7 GB 🔗Enlace ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3495 · 03.08.2023 г., 13:47

#dataEngineering#IBM 🤖 IBM Data Warehouse Engineer Professional Certificate Description This Professional Certificate is intended to help you develop the job-ready skills and portfolio for an entry-level Business Intelligence (BI) or Data Warehousing Engineering position. Throughout the online courses in this program, you will immerse yourself in the in-demand role of a Data Warehouse Engineer and acquire the essential skills you need to work with a range of tools and databases to design, deploy, operationalize and manage Enterprise Data Warehouses (EDW). 🔗ETLanddatapipelinesshellairflowkafka 🔗Gettingstartedwithdatawarehousingandbianalytics 🔗Handsonintroductiontolinuxcommandsandshellscripting 🔗Introductiontodataengineering 🔗Introductiontorelationaldatabases 🔗Relationaldatabaseadministration 🔗SQLdatascience ----- Main channel:@repo_science Coupons: @freecoupons_reposcience -----