Skip to content

Commit

Permalink
allow imagehandlers to provide per file overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Elevator Dev (ubuntu) committed Sep 14, 2024
1 parent 2a9414e commit 421408e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions application/models/filehandlers/Filehandlerbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ public function save() {

}

public function getCustomJobOverrides() {
return [];
}

public function queueBatchItem($asset, $sourceFile) {
$fileObjectId = $asset->getFileObjectId();
$fileSize = $sourceFile->getFileSize();
Expand All @@ -425,6 +429,10 @@ public function queueBatchItem($asset, $sourceFile) {
else {
$size = "large";
}

$overrides = $this->getCustomJobOverrides();


$jobDefinition = $this->config->item('awsQueueJobDefinition') . "-" . $size;

$batchClient = new BatchClient([
Expand All @@ -444,6 +452,7 @@ public function queueBatchItem($asset, $sourceFile) {
],
'containerOverrides' => [
'command' => ['bash', 'runJob.sh', $fileObjectId],
'resourceRequirements' => $overrides
],
];
try {
Expand Down
9 changes: 9 additions & 0 deletions application/models/filehandlers/Imagehandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,15 @@ public function priority() {
return 0;
}

public function getCustomJobOverrides() {
//if the file type is czi bump the memory
if($this->sourceFile->getType() == "czi") {
return [
["type"=>"MEMORY",
"value"=>"4096"]
];
}
}


}
Expand Down

0 comments on commit 421408e

Please sign in to comment.