if __name__ == '__main__':
test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
-
raise Exception(':: Value Paramter of key: \'{}\' NOT a string! Values should be string ::'.format(k))
return True
-
+
def query_range(map_of_parameters):
list_of_result_sets = []
set_log_config()
LOG.info(':::Validation of map_of_parameters done::')
load_and_validate_env_vars(LIST_OF_ENV_VARIABLES)
LOG.info("Forming the query_range request ...")
-
+
list_of_substrings = []
list_of_substrings.append(MAP_ENV_VARIABLES['DATA_ENDPOINT'])
list_of_substrings.append(QUERY_RANGE_API_VERSION)
LOG.info('::::::::::RESULTS OF QUERY_RANGE::::::::::::: {}'.format(map_of_parameters))
list_of_result_sets.append(results)
- return list_of_result_sets
\ No newline at end of file
+ return list_of_result_sets
# print("msg-value-type:: {}".format(type(msg.value().decode('utf-8'))))
self.processMessage(msg.key(), msg.value())
- self.consumer.close()
\ No newline at end of file
+ self.consumer.close()
if __name__ == '__main__':
- main()
\ No newline at end of file
+ main()
logging.error('%s raised an error', err)
else:
logging.info("Message delivered to %s on partition %s",
- msg.topic(), msg.partition())
\ No newline at end of file
+ msg.topic(), msg.partition())
def readFile(self, fileName):
pass
-
demo_query()
demo_query_range()
-
+
if __name__ == "__main__":
main()
secure=False)
-def load_model(bucket_name, object_name, filepath):
+def load_model(bucket_name, object_name, filepath):
try:
client.fget_object(bucket_name, object_name, filepath)
except ResponseError as err:
for object_name in objects:
print(f"Load model from s3://{bucket_name}/{object_name} to {filepath+object_name}")
load_model(bucket_name, object_name, filepath+object_name)
- time.sleep(300)
\ No newline at end of file
+ time.sleep(300)
secure=False)
-def load_model(bucket_name, object_name, filepath):
+def load_model(bucket_name, object_name, filepath):
try:
client.fget_object(bucket_name, object_name, filepath)
except ResponseError as err:
filepath = "/app/" + model
if not client.bucket_exists(bucket_name):
client.make_bucket(bucket_name, location=location)
-
+
found = False
try:
client.stat_object(bucket_name, model);
found = True
except Exception as err:
found = False
-
+
metadata = {
"X-Amz-Meta-model-description": "Sample numpy model",
"X-Amz-Meta-model-type": "scikit-learn/numpy",
client.fput_object(bucket_name, model, filepath, metadata=metadata)
except expression as identifier:
print(err)
-
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
def set_404_content(url):
'''
Called at initialization to set the base URL so that we can serve helpful
- diagnostics as part of the 404 response.
+ diagnostics as part of the 404 response.
'''
global base_url
base_url = url
def notfound_404(environ, start_response):
'''
Serve the 404 Not Found response.
-
+
Provides diagnostics in the 404 response showing the hierarchy of valid
REST resources.
'''