File tree Expand file tree Collapse file tree 4 files changed +9
-5
lines changed
prediction/runtime/runtimes Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ fun ModelDto.toEntity(creatorId: String): Model {
103
103
}
104
104
105
105
fun Model.toPredictionModelDto (
106
- rawModel : ByteArray ,
106
+ rawModel : ByteArray? ,
107
107
doas : List <PredictionDoaDto >,
108
108
rawPreprocessor : ByteArray?
109
109
): PredictionModelDto {
@@ -113,7 +113,7 @@ fun Model.toPredictionModelDto(
113
113
independentFeatures = this .independentFeatures.map { it.toDto() },
114
114
type = this .type.toDto(),
115
115
task = this .task.toDto(),
116
- rawModel = this .encodeRawModel(rawModel),
116
+ rawModel = rawModel?. let { this .encodeRawModel(rawModel) } ,
117
117
rawPreprocessor = this .encodeRawPreprocessor(rawPreprocessor),
118
118
doas = doas,
119
119
selectedFeatures = this .selectedFeatures ? : emptyList(),
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ class ModelService(
78
78
ModelTypeDto .R_TREE_REGR ,
79
79
)
80
80
private val logger = KotlinLogging .logger {}
81
+ const val FIVE_MEGABYTES_IN_BYTES = 5e+ 6
81
82
82
83
fun storeRawModelToStorage (model : Model , storageService : StorageService , modelRepository : ModelRepository ) {
83
84
if (model.rawModel == null ) {
@@ -321,7 +322,11 @@ class ModelService(
321
322
val rawModel = if (model.isQsarToolboxModel()) {
322
323
byteArrayOf()
323
324
} else {
324
- storageService.readRawModel(model)
325
+ if (storageService.readRawModelMetadata(model).contentLength() > FIVE_MEGABYTES_IN_BYTES ) {
326
+ null
327
+ } else {
328
+ storageService.readRawModel(model)
329
+ }
325
330
}
326
331
val rawPreprocessor = storageService.readRawPreprocessor(model)
327
332
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ abstract class RESTRuntime : RuntimeBase() {
111
111
112
112
113
113
val legacyPredictionRequestDto = LegacyPredictionRequestDto (
114
- rawModel = arrayOf(predictionModelDto.rawModel),
114
+ rawModel = arrayOf(predictionModelDto.rawModel!! ),
115
115
dataset = LegacyDatasetDto (
116
116
LegacyDataEntryDto (values = values),
117
117
features = predictionModelDto.independentFeatures.mapIndexed { index, it ->
Original file line number Diff line number Diff line change @@ -2520,7 +2520,6 @@ components:
2520
2520
- dependentFeatures
2521
2521
- independentFeatures
2522
2522
- type
2523
- - rawModel
2524
2523
- task
2525
2524
properties :
2526
2525
id :
You can’t perform that action at this time.
0 commit comments