Error logging in regards to cause of failure
This commit is contained in:
parent
98437a0891
commit
91588392a3
@ -4,6 +4,9 @@ import mu.KotlinLogging
|
|||||||
import no.iktdev.eventi.core.ConsumableEvent
|
import no.iktdev.eventi.core.ConsumableEvent
|
||||||
import no.iktdev.eventi.core.WGson
|
import no.iktdev.eventi.core.WGson
|
||||||
import no.iktdev.eventi.data.EventStatus
|
import no.iktdev.eventi.data.EventStatus
|
||||||
|
import no.iktdev.eventi.data.dataAs
|
||||||
|
import no.iktdev.eventi.data.eventId
|
||||||
|
import no.iktdev.eventi.data.referenceId
|
||||||
import no.iktdev.mediaprocessing.coordinator.Coordinator
|
import no.iktdev.mediaprocessing.coordinator.Coordinator
|
||||||
import no.iktdev.mediaprocessing.coordinator.CoordinatorEventListener
|
import no.iktdev.mediaprocessing.coordinator.CoordinatorEventListener
|
||||||
import no.iktdev.mediaprocessing.coordinator.tasksV2.mapping.EncodeWorkArgumentsMapping
|
import no.iktdev.mediaprocessing.coordinator.tasksV2.mapping.EncodeWorkArgumentsMapping
|
||||||
@ -36,6 +39,12 @@ class EncodeWorkArgumentsTaskListener: CoordinatorEventListener() {
|
|||||||
override fun shouldIProcessAndHandleEvent(incomingEvent: Event, events: List<Event>): Boolean {
|
override fun shouldIProcessAndHandleEvent(incomingEvent: Event, events: List<Event>): Boolean {
|
||||||
val state = super.shouldIProcessAndHandleEvent(incomingEvent, events)
|
val state = super.shouldIProcessAndHandleEvent(incomingEvent, events)
|
||||||
val eventType = events.map { it.eventType }
|
val eventType = events.map { it.eventType }
|
||||||
|
|
||||||
|
val startOperation = events.findFirstOf(Events.ProcessStarted)?.dataAs<StartEventData>() ?: return false
|
||||||
|
if (startOperation.operations.none { it == OperationEvents.ENCODE }) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return state && eventType.containsAll(listensForEvents)
|
return state && eventType.containsAll(listensForEvents)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,36 +54,35 @@ class EncodeWorkArgumentsTaskListener: CoordinatorEventListener() {
|
|||||||
log.error { "Event is null and should not be available! ${WGson.gson.toJson(incomingEvent.metadata())}" }
|
log.error { "Event is null and should not be available! ${WGson.gson.toJson(incomingEvent.metadata())}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val started = events.find { it.eventType == Events.ProcessStarted }?.az<MediaProcessStartEvent>() ?: return
|
||||||
|
|
||||||
active = true
|
active = true
|
||||||
val started = events.find { it.eventType == Events.ProcessStarted }?.az<MediaProcessStartEvent>()
|
|
||||||
if (started == null) {
|
val streamsParsed = events.findEventOf<MediaFileStreamsParsedEvent>()
|
||||||
active = false
|
val streams = streamsParsed?.data
|
||||||
return
|
|
||||||
}
|
|
||||||
if (started.data == null || started.data?.operations?.contains(OperationEvents.ENCODE) == false) {
|
|
||||||
active = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val streams = events.find { it.eventType == Events.StreamParsed }?.az<MediaFileStreamsParsedEvent>()?.data
|
|
||||||
if (streams == null) {
|
if (streams == null) {
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "No Streams found for event ${streamsParsed?.metadata?.eventId} with referenceId ${event.metadata.referenceId}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val mediaInfo = events.find { it.eventType == Events.ReadOutNameAndType }?.az<MediaOutInformationConstructedEvent>()
|
val mediaInfoEvent = events.findEventOf<MediaOutInformationConstructedEvent>()
|
||||||
if (mediaInfo?.data == null) {
|
val mediaInfo = mediaInfoEvent?.data
|
||||||
|
val mediaInfoData = mediaInfo?.toValueObject()
|
||||||
|
if (mediaInfo == null) {
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "No media info data was provided for event ${mediaInfoEvent?.eventId()} with referenceId ${event.referenceId()}" }
|
||||||
return
|
return
|
||||||
}
|
} else if (mediaInfoData == null) {
|
||||||
val mediaInfoData = mediaInfo.data?.toValueObject()
|
|
||||||
if (mediaInfoData == null) {
|
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "Media info data was provided but could not be converted to proper value object for event ${mediaInfoEvent?.eventId()} with referenceId ${event.referenceId()}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val inputFile = started.data?.file
|
val inputFile = started.data?.file
|
||||||
if (inputFile == null) {
|
if (inputFile == null) {
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "No input file was provided for the start event ${started.metadata.eventId} with referenceId ${event.referenceId()}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val mapper = EncodeWorkArgumentsMapping(
|
val mapper = EncodeWorkArgumentsMapping(
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import mu.KotlinLogging
|
|||||||
import no.iktdev.eventi.core.ConsumableEvent
|
import no.iktdev.eventi.core.ConsumableEvent
|
||||||
import no.iktdev.eventi.core.WGson
|
import no.iktdev.eventi.core.WGson
|
||||||
import no.iktdev.eventi.data.EventStatus
|
import no.iktdev.eventi.data.EventStatus
|
||||||
|
import no.iktdev.eventi.data.eventId
|
||||||
|
import no.iktdev.eventi.data.referenceId
|
||||||
import no.iktdev.mediaprocessing.coordinator.Coordinator
|
import no.iktdev.mediaprocessing.coordinator.Coordinator
|
||||||
import no.iktdev.mediaprocessing.coordinator.CoordinatorEventListener
|
import no.iktdev.mediaprocessing.coordinator.CoordinatorEventListener
|
||||||
import no.iktdev.mediaprocessing.coordinator.tasksV2.mapping.ExtractWorkArgumentsMapping
|
import no.iktdev.mediaprocessing.coordinator.tasksV2.mapping.ExtractWorkArgumentsMapping
|
||||||
@ -44,32 +46,35 @@ class ExtractWorkArgumentsTaskListener: CoordinatorEventListener() {
|
|||||||
log.error { "Event is null and should not be available! ${WGson.gson.toJson(incomingEvent.metadata())}" }
|
log.error { "Event is null and should not be available! ${WGson.gson.toJson(incomingEvent.metadata())}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
active = true
|
|
||||||
val started = events.find { it.eventType == Events.ProcessStarted }?.az<MediaProcessStartEvent>() ?: return
|
val started = events.find { it.eventType == Events.ProcessStarted }?.az<MediaProcessStartEvent>() ?: return
|
||||||
if (started.data == null || started.data?.operations?.contains(OperationEvents.EXTRACT) == false) {
|
|
||||||
active = false
|
active = true
|
||||||
return
|
|
||||||
}
|
val streamsParsed = events.findEventOf<MediaFileStreamsParsedEvent>()
|
||||||
val streams = events.find { it.eventType == Events.StreamParsed }?.az<MediaFileStreamsParsedEvent>()?.data
|
val streams = streamsParsed?.data
|
||||||
if (streams == null) {
|
if (streams == null) {
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "No Streams found for event ${streamsParsed?.metadata?.eventId} with referenceId ${event.metadata.referenceId}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val mediaInfo = events.find { it.eventType == Events.ReadOutNameAndType }?.az<MediaOutInformationConstructedEvent>()
|
val mediaInfoEvent = events.findEventOf<MediaOutInformationConstructedEvent>()
|
||||||
if (mediaInfo?.data == null) {
|
val mediaInfo = mediaInfoEvent?.data
|
||||||
|
val mediaInfoData = mediaInfo?.toValueObject()
|
||||||
|
if (mediaInfo == null) {
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "No media info data was provided for event ${mediaInfoEvent?.eventId()} with referenceId ${event.referenceId()}" }
|
||||||
return
|
return
|
||||||
}
|
} else if (mediaInfoData == null) {
|
||||||
val mediaInfoData = mediaInfo.data?.toValueObject()
|
|
||||||
if (mediaInfoData == null) {
|
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "Media info data was provided but could not be converted to proper value object for event ${mediaInfoEvent?.eventId()} with referenceId ${event.referenceId()}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val inputFile = started.data?.file
|
val inputFile = started.data?.file
|
||||||
if (inputFile == null) {
|
if (inputFile == null) {
|
||||||
active = false
|
active = false
|
||||||
|
log.error { "No input file was provided for the start event ${started.metadata.eventId} with referenceId ${event.referenceId()}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user