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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #205 · 22 јан.

Как работает функция reload()? Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора. Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload() from importlib import reload reload(my_module) 🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком! 🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули. 🔸Она не может перезагрузить ранее не импортированный модуль. 🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля. Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся. Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты. Напишем простой модуль # mymodule.py x = 1 Теперь импортируем модуль и отдельно переменную х из модуля >>> import mymodule >>> from mymodule import x >>> print(mymodule.x) 1 >>> print(x) 1 Не перезапуская интерпретатор вносим изменения в модуль # mymodule.py x = 2 Делаем перезагрузку модуля и проверяем х ещё раз >>> reload(mymodule) >>> print(mymodule.x) 2 >>> print(x) 1 То же самое будет если присвоить любой объект переменной (даже словарь или список) Повторный импорт обновляет значение >>> from mymodule import x >>> print(x) 2 🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать. #tricks#basic

Резултати

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

Пребарај: #microservices

当前筛选 #microservices清除筛选
Go

@golang · Post #40 · 17.02.2018 г., 22:40

Very interesting article calls “From monoliths to microservices: an architectural strategy.” The structure of this post: - Adopting Microservices; - Microservices Architectural Patterns; - Architectural & Implementation Considerations; - Developer Productivity During Microservices Adoption; #architecture#development#microservices https://thenewstack.io/from-monolith-to-microservices

Go

@golang · Post #38 · 12.02.2018 г., 19:51

The article by Paul Dix calls “The Decomposable Monolith: Long Live the Monolith, Long Live Services!” Code examples are available but without a code highlighting 🙂 #architecture#development#microservices https://www.influxdata.com/blog/decomposable-monolith-long-live-monolith-long-live-services/

Go

@golang · Post #31 · 31.01.2018 г., 20:13

Great article about the architecture inside of Golang microservice, based on the Bob's Clean Architecture Concept (https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html) Main points: Your GoLang microservice has 4 layers: - Models, data structures, and their methods; - Repository, the provider of DB operations and data management, - Usecase for business logic implementation; - Delivery, protocol, and algorithms for message handling (HTTP, gRPC, etc). Each layer should be independent and be available for mocking, for internal communications between application layers. An example project here: https://github.com/bxcodec/go-clean-arch Full article on the Hackernoon website: https://hackernoon.com/golang-clean-archithecture-efd6d7c43047 #development#microservices#architecture

Go

@golang · Post #37 · 11.02.2018 г., 15:25

How can we track our microservice activity and monitor some processes inside of the service? The Prometheus can helps us in it: the next following article discovers an step-by-step flow for set up, configure and usage this excellent product: #development#microservices#monitoring https://www.google.ru/amp/s/blog.alexellis.io/prometheus-monitoring/amp/

Go

@golang · Post #23 · 25.01.2018 г., 20:13

Are you a beginner in GoLang? Then it requires your attention 🙂. Good and simple for understanding article about microservice-based API development; just simple and work solution with code examples and couple of advices #development#microservices#architecture#practice https://medium.com/@thedevsaddam/build-restful-api-service-in-golang-using-gin-gonic-framework-85b1a6e176f3?source=linkShare-b636419a57de-1516910445

Go

@golang · Post #19 · 22.01.2018 г., 21:32

Do you think about gRPC usage? Here is a great post about step-by-step guide to gRPC framework development. You’ll find here code examples, theory introductions and useful tips. Enjoy learning! 🙂 #manual#development#microservices#examples https://medium.com/@shijuvar/building-high-performance-apis-in-go-using-grpc-and-protocol-buffers-2eda5b80771b?source=linkShare-b636419a57de-1516656055

Go

@golang · Post #28 · 28.01.2018 г., 20:33

Interesting step-by-step guide about design and development API with Docker containers, Swarm cluster and Traefik (HTTP reverse proxy and load balancer). In this article you’ll know how to configure the Traefik in the Docker environment with 3 following nodes: one manager and two workers #architecture#configuration#docker#microservices https://hackernoon.com/architecting-a-highly-scalable-golang-api-with-docker-swarm-traefik-875d1871cc1f?source=linkShare-b636419a57de-1517171008

Go

@golang · Post #18 · 22.01.2018 г., 11:56

Up-to-date article about data-stream processing: Apache Kafka, microservices, JVM to GoLang migrations, ES & Cassandra. What they did when they got 6x traffic increasing in 6 month #design#cases#microservices#scalability https://medium.com/@magicpineng/in-depth-look-at-a-scalable-robust-data-stream-processing-pipeline-using-golang-processing-500k-9e68310a0675

IT Events RU

@iteventsru · Post #257 · 03.03.2018 г., 16:13

✅ Завтра JBreak 2018 📅 4 марта / 10:00 (время Новосибирское, МСК+4) / Новосибирск, Станционная ул., 104 + онлайн-трансляция 💵 Платно 📝 Регистрация тут: https://goo.gl/J22JGQ JBreak — единственная сибирская технологическая Java-конференция для опытных разработчиков. Все доклады будут посвящены только востребованным Java-технологиям и проблемам: производительность, concurrency, тестирование, распределённые системы и высокие нагрузки в мире Java, а также будущее платформы. Спикеры: ~ Simon Ritter ~ Sebastian Daschner ~ Никита Липский ~ Алексей Зиновьев ~ Дмитрий Бугайченко и другие 🔗 Программа: https://goo.gl/tYhuCR #backend#java#spring#JDK#Hibernate#microservices#Новосибирск#онлайн

12
ПретходнаСтраница 1 од 2Следна