Engaged with ASAB

🇨🇿 Česká verze je níže / Czech version is below.

About microservices, coroutines, failures and enthusiasm. And most of all, about ASAB. These are my first months at TeskaLabs.


A while ago I wrote about joining TeskaLabs. After the first month, when I was learning new things at a rocket speed and picking up basic vocabulary, there came a period I called the lag phase. I just felt like I sucked. I was getting angry all the time, complaining. Because it’s always so lame! Wrong port number, missing configuration, different IP address, old package version, VPN turned off… I often think to myself, at least I won’t do that again. And then, again, I try to run something without config file anyway.

Breaking point

During one workshop, Přemek was describing me a picture with a diagram of Logman. “… at the very bottom there are the technologies it uses. You probably already know them all.” I stopped listening to Přemek for a moment and stared at that row of icons, because I realized at that moment: Wow, I already know them all!

In my two months at Teskalabs, in addition to Prometheus, which you’ve already read about, I also became familiar with ElasticSearch, Kafka, ZooKeeper, and Grafana. I don’t cry because of Docker anymore, I can’t live without Postman, I’ve moved to Linux, and I’m even getting into networks and servers. When I get bored, I play with HTML. And I’m so happy about it! Even though I get blue from time to time, the green bar under my photo on GitHub makes all sorrows disappear.

Most of all, I feel satisfied when I can get the right object in the right place. There are less I can’t install/connect/run it problems to solve. Instead, I have to think more about the relevance of the code I produce. I even started to write my first real microservice! It’s like sculpting a mighty Golem out of the clay. It’s exciting to actively build something, and I credit ASAB for this opportunity to create.

It’s not bullshit, it’s coroutine

ASAB is the first thing that probably every newcomer to TeskaLabs gets fond of. Since everything is soaked with it, I slowly started to unveil one service of this tool after another. And yet, there is always that awkward and uneven learning curve; it took me over a month to discover, over a beer, that ASAB is a framework. (As if I heard Aleš saying, “Eliška, you don’t read the documentation!”) So for the record, ASAB (Asynchronous Server Application Boilerplate) is an opensource asynchronous framework.

ASAB provides the functionality that is needed by every microservice. Typically, it is a webserver with a REST API or WebSocket connection. This communication relies on the aiohttp library, which documentation has with a little exaggeration become my homepage. ASAB also handles other vital functions such as logging, configuration or authorization. There are also less essential functionalities, but typically beneficial for all applications. Yes, I’m talking about my beloved metrics.

“It doesn’t work.”
“What’s not working?”
“Some asynchronous bullshit.”
“Eliška, it’s not bullshit, it’s coroutine.”

The heart of the ASAB is an asynchronous loop. The main point of this framework is to allow even a greenhorn like me to create a fully asynchronous application. ASAB handles this asynchronous loop, connects individual parts of the application to it, and supplies the tools to solve the asynchronous puzzles. I had to adopt a whole new way of thinking about such code, and further, to accept that before one coroutine is executed, many other asynchronous tasks might be launched in the application life-cycle. However, in time of need, ASAB can help, for example with its TaskService, which gracefully takes care of the so-called “fire-and-forget” coroutines.

I could keep on talking about ASAB. And I certainly will again, but I challenge you to take it beyond this story—start exploring! I’d like to challenge all small and big Python enthusiasts who search for a fast and simple tool for input/output processes. I’d like to appeal to all Python beginners who want to build their first application. Try ASAB! All you need to do is pip install asab.
Přemek’s videos can guide you through the first steps. Or chat with my cute animals. And now, as I recommend that you visit the documentation page, maybe even I will become a better person and start reading the documentation myself before panicking.

🇨🇿 ASAB mi přirostl k srdci

O mikroslužbách, korutinách, o failech i nadšení. A hlavně o ASABu. To jsou mé první měsíce v TeskaLabs.


Před nějakou dobou jsem psala o svém nástupu do TeskaLabs. Po prvním měsíci, kdy jsem se učila nové věci raketovým tempem a osvojovala si základní slovíčka, přišlo období, které jsem nazvala lag fází. Měla jsem pocit, že mi nic nejde. Rozčilovala jsem se, nadávala. Protože vždycky je to taková blbost! Špatné číslo portu, chybějící konfigurace, jiná IP adresa, stará verze package, vypnutá VPN…. Často si říkám, že aspoň už takovou blbost podruhé neudělám. A pak se stejně znovu snažím pustit něco bez configu.

Bod zlomu

Při jednom workshopu mi Přemek popisoval obrázek, na kterém bylo schéma Logmana. „… úplně dole jsou technologie, které využívá. Ty už asi všechny znáš.“ Na chvilku jsem Přemka přestala poslouchat a zírala na tu řádku ikon, protože jsem si v tu chvíli uvědomila: Tyjo, vždyť já už všechny znám!

Za dva měsíce v Teskalabs jsem vedle Promethea, o kterém jsem již psala, poznala také ElasticSearch, Kafku, ZooKeeper a Grafanu. Kvůli Dockeru už nepláču, bez Postmana nedám ani ránu, přešla jsem na Linux, a dokonce pronikám do sítí a tunelů serverů. Když už mě to všechno přestane bavit, tak si hraji s HTML. Mám z toho radost! A když mě přece jen ještě někdy přepadnou chmury, zaručeně je dokáže zaplašit zelenající se lišta pod mou fotkou na GitHubu.

Ze všeho nejvíc mě těší, že občas dokážu dostat správný objekt na správné místo. Řeším méně problémů typu „nejde mi to nainstalovat, připojit, rozběhat‟ a více se musím zamýšlet nad smysluplností a použitelností kódu, který tvořím. Dokonce začínám psát svoji první opravdickou mikroslužbu! Je to jako plácat z hlíny mocného Golema. Je úžasné, že mohu něco aktivně vytvářet, a za tuto možnost tvořit vděčím ASABu.

To nejsou blbiny, ale korutiny

ASAB je první věc, která asi každému nováčkovi v TeskaLabs přiroste k srdci. Protože je jím prosyceno úplně všechno, začala jsem pomalu rozkrývat jednu službu tohoto nástroje po druhé. Nicméně to, že ASAB je framework, jsem se dozvěděla až po více než měsíci u piva. (Jako bych slyšela Aleše říkat: „Eliško, ty nečteš dokumentaci!‟) Takže pro pořádek: ASAB (Asynchronous Server Application Boilerplate) je opensource asynchronní framework.

ASAB zajišťuje základní funcionality, které potřebuje každá mikroslužba. Typicky tedy webserver s REST API nebo WebSocket spojením. Tato komunikace se opírá o knihovnu aiohttp, jejíž dokumentace se s trochou nadsázky stala mou domovskou stránkou. ASAB také řeší další vitální funkce jako jsou logování, konfigurace nebo autorizace. Najdou se zde i méně nezbytné funkcionality, které ale typicky prosycují všechny aplikace. Ano, mluvím o svých oblíbených metrikách.

„Nefunguje to.‟
„Co ti nefunguje?‟
„Nějaký asynchronní blbiny.‟
„Eliško, to nejsou blbiny, ale korutiny.‟

Srdcem ASABu je smyčka, asynchronní „loop‟. Hlavním smyslem tohoto frameworku je umožnit i začátečníkovi, jako jsem já, vytvořit plně asynchronní aplikaci. ASAB obsluhuje tuto asynchronní smyčku, napojuje do ní jednotlivé části aplikace a dodává nástroje k rozlousknutí asynchronních oříšků. Musela jsem si osvojit zcela nový způsob uvažování nad takovým kódem a přijmout, že než se vykoná jedna korutina, může se v životním běhu aplikace spustit mnoho jiných asynchronních úkolů. V nebezpečných chvílích ale umí ASAB přispěchat na pomoc třeba se svou TaskService, která se elegantně postará o tzv. “fire-and-forget” korutiny.

O ASABu bych mohla vyprávět zaníceně dál. A jistě ještě budu, ale nenechte si to jen vyprávět – pusťte se do objevování! Chtěla bych vyzvat všechny malé i velké Python nadšence, kteří hledají rychlý a jednoduchý nástroj pro input/output procesy. Chtěla bych oslovit všechny Python začátečníky, kteří si chtějí postavit první aplikaci. Zkuste ASAB! Stačí k tomu jediné: pip install asab.
Prvními kroky vás mohou provést Přemkova videa. Nebo si pokecejte s mými zvířátky. A když vám teď poradím navštívit stránku s dokumentací, třeba se i já polepším a začnu dřív číst dokumentaci než propadat panice.

About the Author

Eliška Novotná

Junior backend developer at TeskaLabs. Python and unicorns lover.




You Might Be Interested in Reading These Articles

SeaCat tutorial - Chapter 2: Simple Post (iOS)

The goal of this article is to create a simple iOS client which generates a simple POST Request which will be read in host written in Node.js and the output generated in the console. The whole comunication will be handled by SeaCat which help us to establish fast and secure connection among our key components.

Continue reading ...

tech tutorial ios osx

Published on September 09, 2014

Key Areas and Best Practices to Focus for Mobile API Security

With APIs (Application Programming Interfaces) becoming a crucial factor in any web or mobile application, security feels more like a journey than a destination. Of all the constituents that encompass an application, API gateway offers easy access points for a hacker to break in and steal your data. A single error in API can cause immense problems for any organization using your API.

Continue reading ...

security mobile development

Published on November 22, 2016

What's More Important For Mobile App Developers: Prioritizing Privacy, Security or Ease of Use?

The industry of mobile app development is rising quicker than the speed of light. However, the apps seem to have problems with security and privacy even though they are easy to use. Mobile apps are developed in a few months without regards to security, privacy, or the fact they can easily be breached by hackers. Some companies have known for months about a security issue, but don't do anything until there is a breach.

Continue reading ...

development

Published on February 17, 2015