MCPcopy
hub / github.com/apache/caldera / get_preferred_executor

Method get_preferred_executor

app/objects/c_agent.py:172–189  ·  view source on GitHub ↗

Get preferred executor for ability Will return None if the agent is not capable of running any executors in the given ability. :param ability: Ability to get preferred executor for :type ability: Ability :return: Preferred executor or None :rtype: Unio

(self, ability)

Source from the content-addressed store, hash-verified

170 return capabilities
171
172 async def get_preferred_executor(self, ability):
173 """Get preferred executor for ability
174 Will return None if the agent is not capable of running any
175 executors in the given ability.
176 :param ability: Ability to get preferred executor for
177 :type ability: Ability
178 :return: Preferred executor or None
179 :rtype: Union[Executor, None]
180 """
181 potential_executors = ability.find_executors(self.executors, self.platform)
182 if not potential_executors:
183 return None
184
185 preferred_executor_name = self._get_preferred_executor_name()
186 for executor in potential_executors:
187 if executor.name == preferred_executor_name:
188 return executor
189 return potential_executors[0]
190
191 async def heartbeat_modification(self, **kwargs):
192 now = datetime.now(timezone.utc)

Calls 2

find_executorsMethod · 0.80