def get(peer_id): task = TaskManager.getTask(peer_id) if task == 0: return jsonify(), 500 print('started json') json = TaskController.getAsJson(task) print('finished json') return json
def testShizzle(self): matrixA = "sample_matrices/A20" matrixB = "sample_matrices/B20" job = JobController.create(matrixA, matrixB) job2 = JobController.create(matrixA, matrixB) task1 = TaskManager.getTask(1) assert task1 task2 = TaskManager.getTask(1) assert task2 array = Matrix.matrices[job.getTaskMatrix()] MatrixController.writeArrayToFile(array, "result_matrices/test_job_cancelling_1") time.sleep(2) task3 = TaskManager.getTask(1) assert task3 task4 = TaskManager.getTask(1) MatrixController.writeArrayToFile(array, "result_matrices/test_job_cancelling_2") TaskManager.cancelLongRunningTasks() MatrixController.writeArrayToFile(array, "result_matrices/test_job_cancelling_3")
def testShizzle(self): matrixA = "sample_matrices/A20" matrixB = "sample_matrices/B20" job = JobController.create(matrixA, matrixB) job2 = JobController.create(matrixA, matrixB) task1 = TaskManager.getTask(1) assert task1 task2 = TaskManager.getTask(1) assert task2 array = Matrix.matrices[job.getTaskMatrix()] MatrixController.writeArrayToFile( array, "result_matrices/test_job_cancelling_1") time.sleep(2) task3 = TaskManager.getTask(1) assert task3 task4 = TaskManager.getTask(1) MatrixController.writeArrayToFile( array, "result_matrices/test_job_cancelling_2") TaskManager.cancelLongRunningTasks() MatrixController.writeArrayToFile( array, "result_matrices/test_job_cancelling_3")