Tell about your experience working with Kafka and FastStream.
Python
When can we call commit on a Producer? How to avoid duplicates when manually committing a batch?
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;
Is it possible to create an infinite iterator and generator? What is needed for this?
What should be done with a problematic chunk that constantly causes exceptions during processing? How to avoid getting stuck and move on?
```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.
Tell me about decorators in Python: what is this pattern and how to implement a decorator with arguments?
Explain the behavior of a function with a mutable default argument. What will the prints output?
Tell me more about the Liskov Substitution principle.
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?
Tell us about your current team and projects at [bank/company]
Tell about the principles of OOP: encapsulation, inheritance, polymorphism, abstraction.
What do you know about our company?
Tell us about the use of data classes in your project and why you chose them.
How will you choose between multiple offers? What is important to you?
Tell us about the principles of SOLID.
if total_size > self.max_batch_size: raise ValueError("batch is too large")