Skip to content

Commit cae204d

Browse files
committed
refactore
Signed-off-by: Praneeth Bedapudi <[email protected]>
1 parent 1e024cd commit cae204d

File tree

5 files changed

+240
-143
lines changed

5 files changed

+240
-143
lines changed

fastdeploy/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"--recipe",
1919
type=str,
2020
help="Path to recipe folder that contains predictor.py",
21-
required=True,
21+
required=False,
2222
)
2323

2424
parser.add_argument(

fastdeploy/_infer.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ def __init__(
4848
f"result_polling_interval: {self.result_polling_interval} timeout: {self.timeout}"
4949
)
5050

51-
_utils.logger.info(f"""fastDeploy configuration:
51+
_utils.logger.info(
52+
f"""fastDeploy configuration:
5253
result_polling_interval: {self.result_polling_interval}
5354
timeout: {self.timeout}
5455
allow_pickle: {self.allow_pickle}
55-
""")
56+
"""
57+
)
5658

5759
@property
5860
def _compressor(self):
@@ -75,7 +77,9 @@ def _decompressor(self):
7577
def read_inputs(self, unique_id, inputs, input_type, is_compressed):
7678
if input_type == "pickle":
7779
if not self.allow_pickle:
78-
_utils.logger.warning(f"{unique_id}: tried to use pickle input, but pickle is disallowed")
80+
_utils.logger.warning(
81+
f"{unique_id}: tried to use pickle input, but pickle is disallowed"
82+
)
7983
raise Exception("pickle input disallowed, use msgpack or json")
8084

8185
inputs = pickle.loads(
@@ -127,11 +131,7 @@ def create_response(self, unique_id, response, is_compressed, input_type):
127131
return success, response
128132

129133
def infer(
130-
self,
131-
inputs: bytes,
132-
unique_id: str,
133-
input_type: str,
134-
is_compressed: bool
134+
self, inputs: bytes, unique_id: str, input_type: str, is_compressed: bool
135135
):
136136
try:
137137
request_received_at = time.time()
@@ -234,7 +234,9 @@ def infer(
234234
input_type,
235235
)
236236
elif current_results["last_predictor_success"] is False:
237-
_utils.logger.warning(f"{unique_id}: predictor failed at {current_results['last_predictor_sequence']}")
237+
_utils.logger.warning(
238+
f"{unique_id}: predictor failed at {current_results['last_predictor_sequence']}"
239+
)
238240
return self.create_response(
239241
unique_id,
240242
{
@@ -252,7 +254,9 @@ def infer(
252254
and self.timeout
253255
and time.time() - request_received_at >= self.timeout
254256
):
255-
_utils.logger.debug(f"{unique_id}: predictor timedout at {current_results['last_predictor_sequence']}")
257+
_utils.logger.debug(
258+
f"{unique_id}: predictor timedout at {current_results['last_predictor_sequence']}"
259+
)
256260
return self.create_response(
257261
unique_id,
258262
{

0 commit comments

Comments
 (0)