From 6bda0e006cbdafbd33dc444920115560d3780576 Mon Sep 17 00:00:00 2001 From: Colin McFadden Date: Tue, 25 Jun 2024 12:37:12 -0500 Subject: [PATCH] add aws batch queueing --- .../models/filehandlers/Filehandlerbase.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/application/models/filehandlers/Filehandlerbase.php b/application/models/filehandlers/Filehandlerbase.php index 1cdb508c..c2a1eb3c 100644 --- a/application/models/filehandlers/Filehandlerbase.php +++ b/application/models/filehandlers/Filehandlerbase.php @@ -1,6 +1,9 @@ $this->config->item('awsQueueRegion'), // e.g., 'us-west-2' + 'version' => 'latest', + 'credentials' => [ + 'key' => $this->config->item('awsQueueAccessKey'), + 'secret' => $this->config->item('awsQueueSecretKey'), + ], + ]); + $params = [ + 'jobName' => 'transcode_' . $fileObjectId, + 'jobQueue' => 'PrimaryJobQueue', + 'jobDefinition' => $this->config->item('awsQueueJobDefinition'), + 'containerOverrides' => [ + 'command' => ['php', 'index.php', 'beltdrive', 'processAWSBatchJob', $fileObjectId], + ], + ]; + try { + $result = $batchClient->submitJob($params); + } catch (AwsException $e) { + $this->logging->processingInfo("taskFailed",get_class($this),"Failed to submit job to AWS Batch" . $e->getMessage(),$fileObjectId,0); + } + + } /**