phet commented on code in PR #3694:
URL: https://github.com/apache/gobblin/pull/3694#discussion_r1189465710
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/job_monitor/KafkaJobMonitor.java:
##########
@@ -136,14 +138,30 @@ protected void
processMessage(DecodeableKafkaRecord<byte[],byte[]> message) {
break;
case DELETE:
this.removedSpecs.mark();
- URI jobSpecUri = parsedMessage.getUri();
- this.jobCatalog.remove(jobSpecUri);
+ this.jobCatalog.remove(parsedMessage.getUri());
// Delete the job state if it is a delete spec request
- deleteStateStore(jobSpecUri);
+ deleteStateStore(parsedMessage.getUri());
break;
case CANCEL:
- this.cancelledSpecs.mark();
- this.jobCatalog.remove(parsedMessage.getUri(), true);
+ // Validate that the flow execution ID of the running flow matches
the one in the incoming job spec
+ URI specUri = parsedMessage.getUri();
+ if
(!parsedMessage.getConfig().hasPath(ConfigurationKeys.FLOW_EXECUTION_ID_KEY)) {
+ this.cancelledSpecs.mark();
+ this.jobCatalog.remove(specUri, true);
+ } else {
+ try {
+ JobSpec spec = this.jobCatalog.getJobSpec(specUri);
+ String flowIdToCancel =
parsedMessage.getConfig().getString(ConfigurationKeys.FLOW_EXECUTION_ID_KEY);
+ if
(spec.getConfig().getString(ConfigurationKeys.FLOW_EXECUTION_ID_KEY).equals(flowIdToCancel))
{
+ this.cancelledSpecs.mark();
+ this.jobCatalog.remove(specUri, true);
+ } else {
+ log.warn("Could not find job spec {} with flow execution ID
{} to cancel", specUri, flowIdToCancel);
Review Comment:
let's log what the value of
`spec.getConfig().getString(ConfigurationKeys.FLOW_EXECUTION_ID_KEY)` actually
is.
also, could this ever be `null`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]