(
self,
models: Union[BaseModelBackend, List[BaseModelBackend]],
scheduling_strategy: str = "round_robin",
)
| 56 | """ |
| 57 | |
| 58 | def __init__( |
| 59 | self, |
| 60 | models: Union[BaseModelBackend, List[BaseModelBackend]], |
| 61 | scheduling_strategy: str = "round_robin", |
| 62 | ): |
| 63 | if isinstance(models, list): |
| 64 | self.models = models |
| 65 | else: |
| 66 | self.models = [models] |
| 67 | self.models_cycle = cycle(self.models) |
| 68 | self.current_model = self.models[0] |
| 69 | |
| 70 | # Set the scheduling strategy; default is round-robin |
| 71 | try: |
| 72 | self.scheduling_strategy = getattr(self, scheduling_strategy) |
| 73 | except AttributeError: |
| 74 | logger.warning( |
| 75 | f"Provided strategy: {scheduling_strategy} is not implemented." |
| 76 | f"Using default 'round robin'" |
| 77 | ) |
| 78 | self.scheduling_strategy = self.round_robin |
| 79 | |
| 80 | @property |
| 81 | def model_type(self) -> UnifiedModelType: |
nothing calls this directly
no outgoing calls
no test coverage detected