def cancel(self, task_id): """ Cancel an agent request by task ID. :param task_id: The ID of a task associated with an agent request. :type task_id: str """ agent = Agent(self.context.uuid, url=self.context.url, secret=self.context.secret, async=True) admin = agent.Admin() admin.cancel(criteria={'eq': task_id})
def cancel(context, task_id): """ Cancel an agent request by task ID. :param task_id: The ID of a task associated with an agent request. :type task_id: str """ with context: agent = Agent(context.url, context.address, authenticator=context.authenticator, wait=0) admin = agent.Admin() criteria = {'match': {'task_id': task_id}} admin.cancel(criteria=criteria)