Sobes.tech

Look at the count_pairs function. What is its complexity? Write a more efficient version.

Middle
107

FastAPI allows implementing functions as asynchronous and synchronous — how does this affect behavior? How to parallelize requests in an async function?

Middle
107

What is a partition in Kafka? What is a consumer group?

Senior
106

What are the types and kinds of software testing?

Junior
106

Tell me about the Saga pattern. How did you implement it? How did you notify services about the rollback?

Middle
105

What is encapsulation? What are its features from the perspective of Python?

Senior
101

broker = KafkaBroker("localhost:9092") app = FastStream(broker) @broker.subscriber("raw_texts_topic", group_id="text_parsers") async def handle_text(text_data: dict): # Парсинг и сохранение в БД занимает ~10 секунд parse_text_and_save_to_postgres(text_data)

Middle+
101

Why is encapsulation necessary? What are the risks of directly accessing an object's data?

Senior
101

Write a Dockerfile for a Python application that does the following: - Uses the latest Python image - Sets the working directory to /app - Copies the current directory contents into the container - Installs the dependencies listed in requirements.txt - Exposes port 8000 - Runs the application using the command: python app.py

Middle
101

# How long does it take for asyncio.run(main()) to execute?

Middle+
97

How to create a data structure that cannot have values inserted or modified but can be accessed by key?

Middle
96

How to handle a blocking function from an old library so as not to block the event loop?

Middle+
93

async def get_user(user_id: int, db: AsyncSession): try: user = await db.get(User, user_id) return user finally: await db.close() return None a = await get_user(15, db) # a?

Middle+
80

app = FastAPI() def get_db(): db = SessionLocal() try: yield db finally: db.close() def heavy_text_parser(file_id: int, db: Session): # Parsing a file that takes 5 minutes parse_and_save(file_id, db) @app.post("/upload") async def upload_file( background_tasks: BackgroundTasks, db: Session = Depends(get_db) ): file_id = save_file_to_db(db) db.commit() background_tasks.add_task(heavy_text_parser, file_id, db) return {"status": "parsing started"}

Middle+
79

What is the object returned by a function with `yield`, and what return type annotation is suitable here instead of `list[str]`?

Middle+
72

Tell us a little about yourself and your technical experience.

Middle+
68

What is the pattern called where `Engine` is created once for the application and manages a shared connection pool?

Middle+
64

What happens if the Kafka consumer pod crashes during message processing before committing the offset?

Middle+
63

What are the advantages of a modular monolith compared to microservices in such a situation?

Senior
57
/20