Пример #1
0
 def get(self, requests, modelName):
     try:
         jsonData = json.loads(requests.GET['jsonRecord'])
         if not jsonData:
             raise Exception("Invalid Request Parameter")
     except:
         return JsonResponse({'error': 'Invalid Request Parameter'},
                             status=400)
     return Scoring().predictTestDataWithModificationReturnJson(
         None, modelName, jsonData)
Пример #2
0
 def test_04_unloadModelForError(self):
     logging.info("Test Case : Remove a loaded model from memory. (1)")
     modelName = 'mpgSKModel1'
     result = Scoring().removeModelfromMemory(modelName)
     self.assertEqual(result.status_code, 500)
     self.assertEqual(
         'message' in json.loads(result.__dict__['_container'][0]), True)
     self.assertEqual(
         json.loads(result.__dict__['_container'][0])['message'],
         'Not able to locate, make sure the model was loaded')
     result = Scoring.getListOfModelinMemory()
     self.assertEqual(len(json.loads(result.__dict__['_container'][0])), 1)
     logging.info("PASSED")
Пример #3
0
 def test_05_unloadModelForCorrectness(self):
     logging.info("Test Case : Remove a loaded model from memory. (2)")
     modelName = 'mpgSKModel'
     result = Scoring().removeModelfromMemory(modelName)
     self.assertEqual(result.status_code, 200)
     self.assertEqual(
         'message' in json.loads(result.__dict__['_container'][0]), True)
     self.assertEqual(
         json.loads(result.__dict__['_container'][0])['message'],
         'Model unloaded successfully, now it will not be available for predictions.'
     )
     result = Scoring.getListOfModelinMemory()
     self.assertEqual(len(json.loads(result.__dict__['_container'][0])), 0)
     logging.info("PASSED")
Пример #4
0
 def delete(self, requests, modelName):
     print('>>>>>>>>>>>>>>', modelName)
     return Scoring().removeModelfromMemory(modelName)