[docs]classAsyncDeploymentClient(AsyncPodClient):"""Async Client to create/update/delete Deployments on remote JinaD"""_kind='deployment'_endpoint='/deployments'@if_aliveasyncdefrolling_update(self,id:Union[str,'DaemonID'],uses_with:Optional[Dict]=None,)->str:"""Update a Flow on remote JinaD (only rolling_update supported) :param id: Deployment ID :param uses_with: the uses_with to update the Executor :return: Deployment ID """asyncwithaiohttp.request(method='PUT',url=f'{self.store_api}/rolling_update/{daemonize(id,self._kind)}',json=uses_with,timeout=self.timeout,)asresponse:response_json=awaitresponse.json()ifresponse.status!=HTTPStatus.OK:error_msg=error_msg_from(response_json)self._logger.error(f'{self._kind.title()} update failed as: {error_msg}')returnerror_msgreturnresponse_json@if_aliveasyncdefscale(self,id:Union[str,'DaemonID'],replicas:int)->str:"""Scale a remote Deployment :param id: Deployment ID :param replicas: The number of replicas to scale to :return: Deployment ID """asyncwithaiohttp.request(method='PUT',url=f'{self.store_api}/scale/{daemonize(id,self._kind)}',params={'replicas':replicas},timeout=self.timeout,)asresponse:response_json=awaitresponse.json()ifresponse.status!=HTTPStatus.OK:error_msg=error_msg_from(response_json)self._logger.error(f'{self._kind.title()} update failed as: {error_msg}')returnerror_msgreturnresponse_json
[docs]classDeploymentClient(AsyncToSyncMixin,AsyncDeploymentClient):"""Client to create/update/delete Deployments on remote JinaD"""