def receiveExtractionTask(): reqData = request.get_json() if not ('resumes' in reqData and type(reqData['resumes']) is list): return Response.BadRequest() print(reqData['resumes']) rw.addResumes(reqData['resumes']) if rw.getThread() is None or not rw.getThread().isAlive(): extractionThread = threading.Thread(target=extractJob, args=()) rw.setThread(extractionThread) extractionThread.start() return Response.Success('The task is in process')
def rankingResumes(): print('ranking') try: reqData = request.get_json() if not ('resumes' in reqData and type(reqData['resumes']) is list and 'criterions' in reqData and type(reqData['criterions']) is dict): return Response.BadRequest() rankingThread = threading.Thread(target=rankingResumesJob, args=(reqData['_id'], reqData['criterions'], reqData['resumes'])) rankingThread.start() return Response.Success() except: return Response.InternalError()