Skip to content

Commit

Permalink
add aws batch queueing
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin McFadden committed Jun 25, 2024
1 parent 00d3deb commit 6bda0e0
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion application/models/filehandlers/Filehandlerbase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

//use Aws\S3\S3Client;
use Aws\Batch\BatchClient;
use Aws\Exception\AwsException;


if ( ! defined('BASEPATH')) exit('No direct script access allowed');

Expand Down Expand Up @@ -409,7 +412,29 @@ public function save() {
}

public function queueBatchItem($fileObjectId) {
// do AWS batch queueing here
$batchClient = new BatchClient([
'region' => $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);
}


}

/**
Expand Down

0 comments on commit 6bda0e0

Please sign in to comment.