Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import io.dropwizard.setup.{Bootstrap, Environment}
import io.dropwizard.websockets.WebsocketBundle
import org.apache.texera.amber.config.StorageConfig
import org.apache.texera.amber.engine.common.Utils
import org.apache.texera.service.util.LargeBinaryManager
import org.apache.texera.amber.util.ObjectMapperUtils
import org.apache.texera.auth.SessionUser
import org.apache.texera.dao.SqlServer
Expand Down Expand Up @@ -104,6 +105,9 @@ class TexeraWebApplication
StorageConfig.jdbcPassword
)

// ensure the large-binary S3 bucket exists before any workflow execution attempts to use it
LargeBinaryManager.initialize()

// redirect all 404 to index page, according to Angular routing requirements
val eph = new ErrorPageErrorHandler
eph.addErrorPage(404, "/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@ import java.util.UUID
object LargeBinaryManager extends LazyLogging {
private val DEFAULT_BUCKET = "texera-large-binaries"

/**
* Ensures the large-binary bucket exists. Should be called once at service startup.
*/
def initialize(): Unit = {
S3StorageClient.createBucketIfNotExist(DEFAULT_BUCKET)
}

/**
* Creates a new LargeBinary reference.
* The actual data upload happens separately via LargeBinaryOutputStream.
*
* @return S3 URI string for the new LargeBinary (format: s3://bucket/key)
*/
def create(): String = {
S3StorageClient.createBucketIfNotExist(DEFAULT_BUCKET)

val objectKey = s"objects/${System.currentTimeMillis()}/${UUID.randomUUID()}"
val uri = s"s3://$DEFAULT_BUCKET/$objectKey"

Expand Down
Loading