From 9c012bbb1fd9ed2c027ee5c82aabeccde105f59d Mon Sep 17 00:00:00 2001 From: bhou Date: Mon, 23 Oct 2023 18:15:14 -0700 Subject: [PATCH] Force updating the job status to KILLED when killing a job that has a connected agent but no response observer --- .../rpc/v4/endpoints/GRpcJobKillServiceImpl.java | 7 ------- .../v4/endpoints/GRpcJobKillServiceImplSpec.groovy | 13 ------------- 2 files changed, 20 deletions(-) diff --git a/genie-web/src/main/java/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImpl.java b/genie-web/src/main/java/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImpl.java index 33c2b2c0ff..ef46170f31 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImpl.java +++ b/genie-web/src/main/java/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImpl.java @@ -183,13 +183,6 @@ public void killJob( JobStatus.KILLED ); throw new GenieJobNotFoundException(e); - } catch (final Exception e) { - log.error( - "Failed to force updating the status of Job {} to {} due to unexpected exceptions", - jobId, - JobStatus.KILLED - ); - throw e; } } else { responseObserver.onNext(JobKillRegistrationResponse.newBuilder().build()); diff --git a/genie-web/src/test/groovy/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImplSpec.groovy b/genie-web/src/test/groovy/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImplSpec.groovy index bd28e88830..6ae580fea4 100644 --- a/genie-web/src/test/groovy/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImplSpec.groovy +++ b/genie-web/src/test/groovy/com/netflix/genie/web/agent/apis/rpc/v4/endpoints/GRpcJobKillServiceImplSpec.groovy @@ -182,19 +182,6 @@ class GRpcJobKillServiceImplSpec extends Specification { 0 * this.responseObserver.onCompleted() thrown(GenieJobNotFoundException) - when: "The job is active, the agent is connected, the job is local but no observer, and updating job status fails" - this.serviceSpy.killJob(this.jobId, this.reason, this.servletRequest) - - then: "The database is not updated and exception is thrown" - 1 * this.persistenceService.getJobStatus(this.jobId) >> JobStatus.CLAIMED - 1 * this.persistenceService.updateJobStatus(this.jobId, JobStatus.CLAIMED, JobStatus.KILLED, this.reason) >> { - throw new Exception() - } - 1 * this.agentRoutingService.isAgentConnectionLocal(this.jobId) >> true - 0 * this.responseObserver.onNext(_ as JobKillRegistrationResponse) - 0 * this.responseObserver.onCompleted() - thrown(Exception) - when: "The job is active, the agent is connected, and there is an observer" this.serviceSpy.registerForKillNotification(this.request, this.responseObserver) this.serviceSpy.killJob(this.jobId, this.reason, null)