File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
dataset/src/main/kotlin/com/cosmotech/dataset/service Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -328,19 +328,23 @@ class DatasetServiceImpl(
328328 DatasetSourceType .ADT ,
329329 DatasetSourceType .Twincache ,
330330 DatasetSourceType .AzureStorage -> {
331- val twingraphImportJobInfoRequest =
331+ if (dataset.status == Dataset .Status .PENDING ) {
332+ dataset.source!! .takeIf { ! it.jobId.isNullOrEmpty() }
333+ ? : throw IllegalStateException (" Dataset doesn't have a job id to get status from. Refresh dataset first." )
334+ val twingraphImportJobInfoRequest =
332335 TwingraphImportJobInfoRequest (this , dataset.source!! .jobId!! , organizationId)
333- this .eventPublisher.publishEvent(twingraphImportJobInfoRequest)
334- dataset
335- .takeIf { it.status == Dataset .Status .PENDING }
336- ?.apply {
337- when (twingraphImportJobInfoRequest.response) {
338- " Succeeded" -> status = Dataset .Status .READY
339- " Error" -> status = Dataset .Status .ERROR
340- }
341- datasetRepository.save(this )
336+
337+ this .eventPublisher.publishEvent(twingraphImportJobInfoRequest)
338+
339+ dataset.apply {
340+ when (twingraphImportJobInfoRequest.response) {
341+ " Succeeded" -> status = Dataset .Status .READY
342+ " Error" , " Failed" -> status = Dataset .Status .ERROR
342343 }
343- twingraphImportJobInfoRequest.response ? : " Unknown"
344+ datasetRepository.save(this )
345+ }
346+ }
347+ return dataset.status!! .value
344348 }
345349 }
346350 }
You can’t perform that action at this time.
0 commit comments