TaskProcessingApiController.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Core\Controller;
  8. use OCA\Core\ResponseDefinitions;
  9. use OCP\AppFramework\Http;
  10. use OCP\AppFramework\Http\Attribute\AnonRateLimit;
  11. use OCP\AppFramework\Http\Attribute\ApiRoute;
  12. use OCP\AppFramework\Http\Attribute\ExAppRequired;
  13. use OCP\AppFramework\Http\Attribute\NoAdminRequired;
  14. use OCP\AppFramework\Http\Attribute\PublicPage;
  15. use OCP\AppFramework\Http\Attribute\UserRateLimit;
  16. use OCP\AppFramework\Http\DataDownloadResponse;
  17. use OCP\AppFramework\Http\DataResponse;
  18. use OCP\Files\File;
  19. use OCP\Files\GenericFileException;
  20. use OCP\Files\IRootFolder;
  21. use OCP\Files\NotPermittedException;
  22. use OCP\IL10N;
  23. use OCP\IRequest;
  24. use OCP\Lock\LockedException;
  25. use OCP\TaskProcessing\EShapeType;
  26. use OCP\TaskProcessing\Exception\Exception;
  27. use OCP\TaskProcessing\Exception\NotFoundException;
  28. use OCP\TaskProcessing\Exception\PreConditionNotMetException;
  29. use OCP\TaskProcessing\Exception\UnauthorizedException;
  30. use OCP\TaskProcessing\Exception\ValidationException;
  31. use OCP\TaskProcessing\IManager;
  32. use OCP\TaskProcessing\ShapeDescriptor;
  33. use OCP\TaskProcessing\Task;
  34. use RuntimeException;
  35. /**
  36. * @psalm-import-type CoreTaskProcessingTask from ResponseDefinitions
  37. * @psalm-import-type CoreTaskProcessingTaskType from ResponseDefinitions
  38. */
  39. class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
  40. public function __construct(
  41. string $appName,
  42. IRequest $request,
  43. private IManager $taskProcessingManager,
  44. private IL10N $l,
  45. private ?string $userId,
  46. private IRootFolder $rootFolder,
  47. ) {
  48. parent::__construct($appName, $request);
  49. }
  50. /**
  51. * Returns all available TaskProcessing task types
  52. *
  53. * @return DataResponse<Http::STATUS_OK, array{types: array<string, CoreTaskProcessingTaskType>}, array{}>
  54. *
  55. * 200: Task types returned
  56. */
  57. #[PublicPage]
  58. #[ApiRoute(verb: 'GET', url: '/tasktypes', root: '/taskprocessing')]
  59. public function taskTypes(): DataResponse {
  60. $taskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
  61. $serializedTaskTypes = [];
  62. foreach ($taskTypes as $key => $taskType) {
  63. $serializedTaskTypes[$key] = [
  64. 'name' => $taskType['name'],
  65. 'description' => $taskType['description'],
  66. 'inputShape' => array_map(fn (ShapeDescriptor $descriptor) =>
  67. $descriptor->jsonSerialize() + ['mandatory' => true], $taskType['inputShape'])
  68. + array_map(fn (ShapeDescriptor $descriptor) =>
  69. $descriptor->jsonSerialize() + ['mandatory' => false], $taskType['optionalInputShape']),
  70. 'outputShape' => array_map(fn (ShapeDescriptor $descriptor) =>
  71. $descriptor->jsonSerialize() + ['mandatory' => true], $taskType['outputShape'])
  72. + array_map(fn (ShapeDescriptor $descriptor) =>
  73. $descriptor->jsonSerialize() + ['mandatory' => false], $taskType['optionalOutputShape']),
  74. ];
  75. }
  76. return new DataResponse([
  77. 'types' => $serializedTaskTypes,
  78. ]);
  79. }
  80. /**
  81. * Schedules a task
  82. *
  83. * @param array<string, mixed> $input Task's input parameters
  84. * @param string $type Type of the task
  85. * @param string $appId ID of the app that will execute the task
  86. * @param string $customId An arbitrary identifier for the task
  87. *
  88. * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
  89. *
  90. * 200: Task scheduled successfully
  91. * 400: Scheduling task is not possible
  92. * 412: Scheduling task is not possible
  93. * 401: Cannot schedule task because it references files in its input that the user doesn't have access to
  94. */
  95. #[PublicPage]
  96. #[UserRateLimit(limit: 20, period: 120)]
  97. #[AnonRateLimit(limit: 5, period: 120)]
  98. #[ApiRoute(verb: 'POST', url: '/schedule', root: '/taskprocessing')]
  99. public function schedule(array $input, string $type, string $appId, string $customId = ''): DataResponse {
  100. $task = new Task($type, $input, $appId, $this->userId, $customId);
  101. try {
  102. $this->taskProcessingManager->scheduleTask($task);
  103. /** @var CoreTaskProcessingTask $json */
  104. $json = $task->jsonSerialize();
  105. return new DataResponse([
  106. 'task' => $json,
  107. ]);
  108. } catch (PreConditionNotMetException) {
  109. return new DataResponse(['message' => $this->l->t('The given provider is not available')], Http::STATUS_PRECONDITION_FAILED);
  110. } catch (ValidationException $e) {
  111. return new DataResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
  112. } catch (UnauthorizedException) {
  113. return new DataResponse(['message' => 'User does not have access to the files mentioned in the task input'], Http::STATUS_UNAUTHORIZED);
  114. } catch (Exception) {
  115. return new DataResponse(['message' => 'Internal server error'], Http::STATUS_INTERNAL_SERVER_ERROR);
  116. }
  117. }
  118. /**
  119. * Gets a task including status and result
  120. *
  121. * Tasks are removed 1 week after receiving their last update
  122. *
  123. * @param int $id The id of the task
  124. *
  125. * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
  126. *
  127. * 200: Task returned
  128. * 404: Task not found
  129. */
  130. #[PublicPage]
  131. #[ApiRoute(verb: 'GET', url: '/task/{id}', root: '/taskprocessing')]
  132. public function getTask(int $id): DataResponse {
  133. try {
  134. $task = $this->taskProcessingManager->getUserTask($id, $this->userId);
  135. /** @var CoreTaskProcessingTask $json */
  136. $json = $task->jsonSerialize();
  137. return new DataResponse([
  138. 'task' => $json,
  139. ]);
  140. } catch (NotFoundException) {
  141. return new DataResponse(['message' => $this->l->t('Task not found')], Http::STATUS_NOT_FOUND);
  142. } catch (RuntimeException) {
  143. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  144. }
  145. }
  146. /**
  147. * Deletes a task
  148. *
  149. * @param int $id The id of the task
  150. *
  151. * @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
  152. *
  153. * 200: Task deleted
  154. */
  155. #[NoAdminRequired]
  156. #[ApiRoute(verb: 'DELETE', url: '/task/{id}', root: '/taskprocessing')]
  157. public function deleteTask(int $id): DataResponse {
  158. try {
  159. $task = $this->taskProcessingManager->getUserTask($id, $this->userId);
  160. $this->taskProcessingManager->deleteTask($task);
  161. return new DataResponse(null);
  162. } catch (NotFoundException) {
  163. return new DataResponse(null);
  164. } catch (Exception) {
  165. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  166. }
  167. }
  168. /**
  169. * Returns tasks for the current user filtered by the appId and optional customId
  170. *
  171. * @param string $appId ID of the app
  172. * @param string|null $customId An arbitrary identifier for the task
  173. * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
  174. *
  175. * 200: Tasks returned
  176. */
  177. #[NoAdminRequired]
  178. #[ApiRoute(verb: 'GET', url: '/tasks/app/{appId}', root: '/taskprocessing')]
  179. public function listTasksByApp(string $appId, ?string $customId = null): DataResponse {
  180. try {
  181. $tasks = $this->taskProcessingManager->getUserTasksByApp($this->userId, $appId, $customId);
  182. /** @var CoreTaskProcessingTask[] $json */
  183. $json = array_map(static function (Task $task) {
  184. return $task->jsonSerialize();
  185. }, $tasks);
  186. return new DataResponse([
  187. 'tasks' => $json,
  188. ]);
  189. } catch (Exception) {
  190. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  191. }
  192. }
  193. /**
  194. * Returns tasks for the current user filtered by the optional taskType and optional customId
  195. *
  196. * @param string|null $taskType The task type to filter by
  197. * @param string|null $customId An arbitrary identifier for the task
  198. * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
  199. *
  200. * 200: Tasks returned
  201. */
  202. #[NoAdminRequired]
  203. #[ApiRoute(verb: 'GET', url: '/tasks', root: '/taskprocessing')]
  204. public function listTasks(?string $taskType, ?string $customId = null): DataResponse {
  205. try {
  206. $tasks = $this->taskProcessingManager->getUserTasks($this->userId, $taskType, $customId);
  207. /** @var CoreTaskProcessingTask[] $json */
  208. $json = array_map(static function (Task $task) {
  209. return $task->jsonSerialize();
  210. }, $tasks);
  211. return new DataResponse([
  212. 'tasks' => $json,
  213. ]);
  214. } catch (Exception) {
  215. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  216. }
  217. }
  218. /**
  219. * Returns the contents of a file referenced in a task
  220. *
  221. * @param int $taskId The id of the task
  222. * @param int $fileId The file id of the file to retrieve
  223. * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
  224. *
  225. * 200: File content returned
  226. * 404: Task or file not found
  227. */
  228. #[NoAdminRequired]
  229. #[Http\Attribute\NoCSRFRequired]
  230. #[ApiRoute(verb: 'GET', url: '/tasks/{taskId}/file/{fileId}', root: '/taskprocessing')]
  231. public function getFileContents(int $taskId, int $fileId): Http\DataDownloadResponse|DataResponse {
  232. try {
  233. $task = $this->taskProcessingManager->getUserTask($taskId, $this->userId);
  234. return $this->getFileContentsInternal($task, $fileId);
  235. } catch (NotFoundException) {
  236. return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
  237. } catch (Exception) {
  238. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  239. }
  240. }
  241. /**
  242. * Returns the contents of a file referenced in a task(ExApp route version)
  243. *
  244. * @param int $taskId The id of the task
  245. * @param int $fileId The file id of the file to retrieve
  246. * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
  247. *
  248. * 200: File content returned
  249. * 404: Task or file not found
  250. */
  251. #[ExAppRequired]
  252. #[ApiRoute(verb: 'GET', url: '/tasks_provider/{taskId}/file/{fileId}', root: '/taskprocessing')]
  253. public function getFileContentsExApp(int $taskId, int $fileId): Http\DataDownloadResponse|DataResponse {
  254. try {
  255. $task = $this->taskProcessingManager->getTask($taskId);
  256. return $this->getFileContentsInternal($task, $fileId);
  257. } catch (NotFoundException) {
  258. return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
  259. } catch (Exception) {
  260. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  261. }
  262. }
  263. /**
  264. * @throws NotPermittedException
  265. * @throws NotFoundException
  266. * @throws GenericFileException
  267. * @throws LockedException
  268. *
  269. * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
  270. */
  271. private function getFileContentsInternal(Task $task, int $fileId): Http\DataDownloadResponse|DataResponse {
  272. $ids = $this->extractFileIdsFromTask($task);
  273. if (!in_array($fileId, $ids)) {
  274. return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
  275. }
  276. $node = $this->rootFolder->getFirstNodeById($fileId);
  277. if ($node === null) {
  278. $node = $this->rootFolder->getFirstNodeByIdInPath($fileId, '/' . $this->rootFolder->getAppDataDirectoryName() . '/');
  279. if (!$node instanceof File) {
  280. throw new NotFoundException('Node is not a file');
  281. }
  282. } elseif (!$node instanceof File) {
  283. throw new NotFoundException('Node is not a file');
  284. }
  285. return new Http\DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType());
  286. }
  287. /**
  288. * @param Task $task
  289. * @return list<int>
  290. * @throws NotFoundException
  291. */
  292. private function extractFileIdsFromTask(Task $task): array {
  293. $ids = [];
  294. $taskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
  295. if (!isset($taskTypes[$task->getTaskTypeId()])) {
  296. throw new NotFoundException('Could not find task type');
  297. }
  298. $taskType = $taskTypes[$task->getTaskTypeId()];
  299. foreach ($taskType['inputShape'] + $taskType['optionalInputShape'] as $key => $descriptor) {
  300. if (in_array(EShapeType::getScalarType($descriptor->getShapeType()), [EShapeType::File, EShapeType::Image, EShapeType::Audio, EShapeType::Video], true)) {
  301. /** @var int|list<int> $inputSlot */
  302. $inputSlot = $task->getInput()[$key];
  303. if (is_array($inputSlot)) {
  304. $ids += $inputSlot;
  305. } else {
  306. $ids[] = $inputSlot;
  307. }
  308. }
  309. }
  310. if ($task->getOutput() !== null) {
  311. foreach ($taskType['outputShape'] + $taskType['optionalOutputShape'] as $key => $descriptor) {
  312. if (in_array(EShapeType::getScalarType($descriptor->getShapeType()), [EShapeType::File, EShapeType::Image, EShapeType::Audio, EShapeType::Video], true)) {
  313. /** @var int|list<int> $outputSlot */
  314. $outputSlot = $task->getOutput()[$key];
  315. if (is_array($outputSlot)) {
  316. $ids += $outputSlot;
  317. } else {
  318. $ids[] = $outputSlot;
  319. }
  320. }
  321. }
  322. }
  323. return array_values($ids);
  324. }
  325. /**
  326. * Sets the task progress
  327. *
  328. * @param int $taskId The id of the task
  329. * @param float $progress The progress
  330. * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
  331. *
  332. * 200: Progress updated successfully
  333. * 404: Task not found
  334. */
  335. #[ExAppRequired]
  336. #[ApiRoute(verb: 'POST', url: '/tasks_provider/{taskId}/progress', root: '/taskprocessing')]
  337. public function setProgress(int $taskId, float $progress): DataResponse {
  338. try {
  339. $this->taskProcessingManager->setTaskProgress($taskId, $progress);
  340. $task = $this->taskProcessingManager->getTask($taskId);
  341. /** @var CoreTaskProcessingTask $json */
  342. $json = $task->jsonSerialize();
  343. return new DataResponse([
  344. 'task' => $json,
  345. ]);
  346. } catch (NotFoundException) {
  347. return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
  348. } catch (Exception) {
  349. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  350. }
  351. }
  352. /**
  353. * Sets the task result
  354. *
  355. * @param int $taskId The id of the task
  356. * @param array<string,mixed>|null $output The resulting task output
  357. * @param string|null $errorMessage An error message if the task failed
  358. * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
  359. *
  360. * 200: Result updated successfully
  361. * 404: Task not found
  362. */
  363. #[ExAppRequired]
  364. #[ApiRoute(verb: 'POST', url: '/tasks_provider/{taskId}/result', root: '/taskprocessing')]
  365. public function setResult(int $taskId, ?array $output = null, ?string $errorMessage = null): DataResponse {
  366. try {
  367. // set result
  368. $this->taskProcessingManager->setTaskResult($taskId, $errorMessage, $output);
  369. $task = $this->taskProcessingManager->getTask($taskId);
  370. /** @var CoreTaskProcessingTask $json */
  371. $json = $task->jsonSerialize();
  372. return new DataResponse([
  373. 'task' => $json,
  374. ]);
  375. } catch (NotFoundException) {
  376. return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
  377. } catch (Exception) {
  378. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  379. }
  380. }
  381. /**
  382. * Cancels a task
  383. *
  384. * @param int $taskId The id of the task
  385. * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
  386. *
  387. * 200: Task canceled successfully
  388. * 404: Task not found
  389. */
  390. #[NoAdminRequired]
  391. #[ApiRoute(verb: 'POST', url: '/tasks/{taskId}/cancel', root: '/taskprocessing')]
  392. public function cancelTask(int $taskId): DataResponse {
  393. try {
  394. // Check if the current user can access the task
  395. $this->taskProcessingManager->getUserTask($taskId, $this->userId);
  396. // set result
  397. $this->taskProcessingManager->cancelTask($taskId);
  398. $task = $this->taskProcessingManager->getUserTask($taskId, $this->userId);
  399. /** @var CoreTaskProcessingTask $json */
  400. $json = $task->jsonSerialize();
  401. return new DataResponse([
  402. 'task' => $json,
  403. ]);
  404. } catch (NotFoundException) {
  405. return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
  406. } catch (Exception) {
  407. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  408. }
  409. }
  410. /**
  411. * Returns the next scheduled task for the taskTypeId
  412. *
  413. * @param list<string> $providerIds The ids of the providers
  414. * @param list<string> $taskTypeIds The ids of the task types
  415. * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask, provider: array{name: string}}, array{}>|DataResponse<Http::STATUS_NO_CONTENT, null, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}>
  416. *
  417. * 200: Task returned
  418. * 204: No task found
  419. */
  420. #[ExAppRequired]
  421. #[ApiRoute(verb: 'GET', url: '/tasks_provider/next', root: '/taskprocessing')]
  422. public function getNextScheduledTask(array $providerIds, array $taskTypeIds): DataResponse {
  423. try {
  424. // restrict $providerIds to providers that are configured as preferred for the passed task types
  425. $providerIds = array_values(array_intersect(array_unique(array_map(fn ($taskTypeId) => $this->taskProcessingManager->getPreferredProvider($taskTypeId)->getId(), $taskTypeIds)), $providerIds));
  426. // restrict $taskTypeIds to task types that can actually be run by one of the now restricted providers
  427. $taskTypeIds = array_values(array_filter($taskTypeIds, fn ($taskTypeId) => in_array($this->taskProcessingManager->getPreferredProvider($taskTypeId)->getId(), $providerIds, true)));
  428. if (count($providerIds) === 0 || count($taskTypeIds) === 0) {
  429. throw new NotFoundException();
  430. }
  431. $taskIdsToIgnore = [];
  432. while (true) {
  433. $task = $this->taskProcessingManager->getNextScheduledTask($taskTypeIds, $taskIdsToIgnore);
  434. $provider = $this->taskProcessingManager->getPreferredProvider($task->getTaskTypeId());
  435. if (in_array($provider->getId(), $providerIds, true)) {
  436. if ($this->taskProcessingManager->lockTask($task)) {
  437. break;
  438. }
  439. }
  440. $taskIdsToIgnore[] = (int)$task->getId();
  441. }
  442. /** @var CoreTaskProcessingTask $json */
  443. $json = $task->jsonSerialize();
  444. return new DataResponse([
  445. 'task' => $json,
  446. 'provider' => [
  447. 'name' => $provider->getId(),
  448. ],
  449. ]);
  450. } catch (NotFoundException) {
  451. return new DataResponse(null, Http::STATUS_NO_CONTENT);
  452. } catch (Exception) {
  453. return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR);
  454. }
  455. }
  456. }