Skip to content

Commit a53c23d

Browse files
committed
black
1 parent b5d4787 commit a53c23d

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

launch/client.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313

1414
from launch.api_client import ApiClient, Configuration
1515
from launch.api_client.api.default_api import DefaultApi
16-
from launch.api_client.model.create_model_bundle_request import CreateModelBundleRequest
17-
from launch.api_client.model.create_model_endpoint_request import CreateModelEndpointRequest
18-
from launch.api_client.model.endpoint_predict_request import EndpointPredictRequest
19-
from launch.api_client.model.update_model_endpoint_request import UpdateModelEndpointRequest
16+
from launch.api_client.model.create_model_bundle_request import (
17+
CreateModelBundleRequest,
18+
)
19+
from launch.api_client.model.create_model_endpoint_request import (
20+
CreateModelEndpointRequest,
21+
)
22+
from launch.api_client.model.endpoint_predict_request import (
23+
EndpointPredictRequest,
24+
)
25+
from launch.api_client.model.update_model_endpoint_request import (
26+
UpdateModelEndpointRequest,
27+
)
2028
from launch.connection import Connection
2129
from launch.constants import (
2230
BATCH_TASK_INPUT_SIGNED_URL_PATH,
@@ -655,7 +663,10 @@ def create_model_endpoint(
655663
logger.info("Creating new endpoint")
656664
with ApiClient(self.configuration) as api_client:
657665
api_instance = DefaultApi(api_client)
658-
if not isinstance(model_bundle, ModelBundle) or model_bundle.id is None:
666+
if (
667+
not isinstance(model_bundle, ModelBundle)
668+
or model_bundle.id is None
669+
):
659670
model_bundle = self.get_model_bundle(model_bundle)
660671
create_model_endpoint_request = CreateModelEndpointRequest(
661672
cpus=cpus,
@@ -760,19 +771,27 @@ def edit_model_endpoint(
760771

761772
if model_bundle is None:
762773
model_bundle_id = None
763-
elif isinstance(model_bundle, ModelBundle) and model_bundle.id is not None:
774+
elif (
775+
isinstance(model_bundle, ModelBundle)
776+
and model_bundle.id is not None
777+
):
764778
model_bundle_id = model_bundle.id
765779
else:
766780
model_bundle = self.get_model_bundle(model_bundle)
767781
model_bundle_id = model_bundle.id
768782

769783
if model_endpoint is None:
770784
model_endpoint_id = None
771-
elif isinstance(model_endpoint, ModelEndpoint) and model_endpoint.id is not None:
785+
elif (
786+
isinstance(model_endpoint, ModelEndpoint)
787+
and model_endpoint.id is not None
788+
):
772789
model_endpoint_id = model_endpoint.id
773790
else:
774791
endpoint_name = _model_endpoint_to_name(model_endpoint)
775-
model_endpoint = self.get_model_endpoint(endpoint_name).model_endpoint
792+
model_endpoint = self.get_model_endpoint(
793+
endpoint_name
794+
).model_endpoint
776795
model_endpoint_id = model_endpoint.id
777796

778797
update_model_endpoint_request = UpdateModelEndpointRequest(
@@ -988,7 +1007,9 @@ def _sync_request(
9881007
validate_task_request(url=url, args=args)
9891008
with ApiClient(self.configuration) as api_client:
9901009
api_instance = DefaultApi(api_client)
991-
request = EndpointPredictRequest(return_pickled=return_pickled, url=url, args=args)
1010+
request = EndpointPredictRequest(
1011+
return_pickled=return_pickled, url=url, args=args
1012+
)
9921013
resp = api_instance.create_sync_inference_task_v1_sync_tasks_post(
9931014
model_endpoint_id=endpoint_id,
9941015
endpoint_predict_request=request,
@@ -1033,7 +1054,9 @@ def _async_request(
10331054
endpoint = self.get_model_endpoint(endpoint_name)
10341055
with ApiClient(self.configuration) as api_client:
10351056
api_instance = DefaultApi(api_client)
1036-
request = EndpointPredictRequest(return_pickled=return_pickled, url=url, args=args)
1057+
request = EndpointPredictRequest(
1058+
return_pickled=return_pickled, url=url, args=args
1059+
)
10371060
resp = api_instance.create_sync_inference_task_v1_sync_tasks_post(
10381061
model_endpoint_id=endpoint.model_endpoint.id,
10391062
endpoint_predict_request=request,

0 commit comments

Comments
 (0)