Sobes.tech

Tell about your experience working with Kafka and FastStream.

Middle
195

When can we call commit on a Producer? How to avoid duplicates when manually committing a batch?

Middle
161

Given three tables: 1. Users: - id (user's unique identifier). - name (user's name). 2. Courses: - id (course's unique identifier). - name (course name). - price (course cost). 3. Student courses: - id (record's unique identifier). - student_id (user's identifier). - course_id (course's identifier). Required: List all users who bought courses totaling more than 10,000, in the format: - user_name (user's name). - total_price (total purchase amount). Starting code select * from users limit 10; select * from courses limit 10; select * from student_courses limit 10;

Middle
159

Is it possible to create an infinite iterator and generator? What is needed for this?

Middle
144

What should be done with a problematic chunk that constantly causes exceptions during processing? How to avoid getting stuck and move on?

Middle
135

```python import asyncio from typing import List, Optional class Chunk: def __init__(self, items: List[dict]): self.items = items @property def size(self) -> int: return len(self.items) class Producer: async def next(self) -> Optional[Chunk]: # возвращает пачку данных или None ... async def commit(self, chunks: List[Chunk]) -> None: # фиксируем успешную обработку chunks ... class Consumer: max_batch_size = 100 async def consume(self, chunks: List[Chunk]) -> None: total_size = sum(chunk.size for chunk in chunks) if total_size > self.max_batch_size: raise ValueError("batch is too large") # обработка данных ... producer = Producer() consumer = Consumer() async def process(): while True: chunk = await producer.next() if chunk is None: break try: await consumer.consume([chunk]) await producer.commit([chunk]) except Exception as e: print("error but continue:", e) continue if __name__ == "__main__": asyncio.run(process()) ``` This code defines asynchronous producer-consumer classes with batch processing and error handling. The task is to implement or complete the logic for producing, consuming, and committing chunks of data, ensuring batch size limits are respected and errors are handled gracefully.

Middle
135

Tell me about decorators in Python: what is this pattern and how to implement a decorator with arguments?

Middle
132

Explain the behavior of a function with a mutable default argument. What will the prints output?

Middle
131

Tell me more about the Liskov Substitution principle.

Middle
127

Tell me about one of your recent projects that touched your soul. What was the project, what exactly did you do there, and why did it resonate with you?

Middle
127

Tell us about your current team and projects at [bank/company]

Middle
123

Tell about the principles of OOP: encapsulation, inheritance, polymorphism, abstraction.

Middle
120

What do you know about our company?

Middle
118

Tell us about the use of data classes in your project and why you chose them.

Middle
117

How will you choose between multiple offers? What is important to you?

Middle
115

Tell us about the principles of SOLID.

Middle
108

if total_size > self.max_batch_size: raise ValueError("batch is too large")

Middle
104