Created
February 11, 2025 18:59
-
-
Save msaffitz/fb65787cf1d65b87e7ef9e19d5c2e25d to your computer and use it in GitHub Desktop.
Action Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Task: | |
| def __init__(self, name: str): | |
| self.name = name | |
| class TaskExecutor: | |
| def __init__(self, id: int): | |
| self.id = id | |
| def execute(self, task: Task): | |
| """Executes a task and prints which worker processed it""" | |
| print(f"Worker {self.id} executed {task.name}") | |
| class LoadBalancer: | |
| def __init__(self, num_workers: int): | |
| """Distributes tasks to workers in a round-robin fashion""" | |
| pass | |
| def submit_task(self, task: Task): | |
| """Assigns a task to the next available worker""" | |
| pas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment