1616
1717class Executor (BaseHTTPRequestHandler ):
1818 def do_POST (self ):
19- content_length = int (self .headers ['Content-Length' ])
20- post_data = self .rfile .read (content_length )
21- request = json .loads (post_data .decode ('utf-8' ))
19+ content_length = 0
20+ post_data = None
21+ request = { }
22+ raw_content_length = self .headers ['Content-Length' ]
23+ if raw_content_length :
24+ content_length = int (raw_content_length )
25+ post_data = self .rfile .read (content_length )
26+ print (f" POST: Received post_data: { post_data } " )
27+ request = json .loads (post_data .decode ('utf-8' ))
2228
2329 if not "invoke" in self .path :
2430 self .send_response (404 )
@@ -57,14 +63,13 @@ def do_POST(self):
5763 }
5864 }
5965 '''
60- print (params )
6166 data_url = str (params .get ("data_url" , DATA_URL ))
6267 local_temp_dir = str (params .get ("local_dir" , OUTPUT_PATH ))
6368 data_object_name = str (params .get ("object_name" , OBJECT_NAME ))
6469
6570 print (f"Running function 'retriever' with params { data_url } , { local_temp_dir } , { data_object_name } " )
6671 result = retriever .handler (data_url = data_url , local_temp_path = local_temp_dir , object_name = data_object_name )
67- # result = True
72+
6873 elif func == "train" or HANDLER_ENV .lower () == "train" :
6974 ''' Invocation example:
7075
@@ -83,9 +88,9 @@ def do_POST(self):
8388 }
8489 }
8590 '''
86- print (f"Running function 'handle_train ' with params { params } , { context } " )
91+ print (f"Running function 'train ' with params { params } " )
8792 result = ml_model .handler_train (params , context )
88-
93+
8994 elif func == "evaluate" or HANDLER_ENV .lower () == "evaluate" :
9095 ''' Invocation example:
9196
0 commit comments