From b331ea7044dd208ec18c862c3c22e6a3cb43f129 Mon Sep 17 00:00:00 2001 From: Arnaud Mengus Date: Thu, 30 May 2024 09:05:35 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20SiloIngestorJob=20progress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dragon/job/silo/SiloIngestorJobHandler.java | 15 ++++++++++----- ...orRequest.java => SiloIngestorJobRequest.java} | 6 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) rename backend/src/main/java/ai/dragon/job/silo/{SiloIngestorRequest.java => SiloIngestorJobRequest.java} (71%) diff --git a/backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobHandler.java b/backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobHandler.java index 406bea7d..017b9853 100644 --- a/backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobHandler.java +++ b/backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobHandler.java @@ -15,7 +15,7 @@ import ai.dragon.repository.SiloRepository; @Component -public class SiloIngestorJobHandler implements JobRequestHandler { +public class SiloIngestorJobHandler implements JobRequestHandler { private final Logger logger = new JobRunrDashboardLogger(LoggerFactory.getLogger(this.getClass())); @Autowired @@ -23,13 +23,18 @@ public class SiloIngestorJobHandler implements JobRequestHandler new ResponseStatusException(HttpStatus.NOT_FOUND, "Entity not found")); - JobDashboardProgressBar progressBar = jobContext().progressBar(100); + ingestDataToSilo(siloEntity, progressBar); + } + + private void ingestDataToSilo(SiloEntity siloEntity, JobDashboardProgressBar progressBar) { + jobContext().logger().info(String.format("Name : %s", siloEntity.getName())); progressBar.setProgress(100); - jobContext().logger().info("Job is running"); - throw new RuntimeException("test"); + + // TODO Loop => if (Thread.currentThread().isInterrupted()) throw new InterruptedException(); } } diff --git a/backend/src/main/java/ai/dragon/job/silo/SiloIngestorRequest.java b/backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobRequest.java similarity index 71% rename from backend/src/main/java/ai/dragon/job/silo/SiloIngestorRequest.java rename to backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobRequest.java index ddbff1d4..18109bff 100644 --- a/backend/src/main/java/ai/dragon/job/silo/SiloIngestorRequest.java +++ b/backend/src/main/java/ai/dragon/job/silo/SiloIngestorJobRequest.java @@ -10,7 +10,7 @@ @Accessors(fluent = true) @Getter @Setter -public class SiloIngestorRequest implements JobRequest { +public class SiloIngestorJobRequest implements JobRequest { private UUID uuid; @Override @@ -18,7 +18,7 @@ public Class getJobRequestHandler() { return SiloIngestorJobHandler.class; } - public static SiloIngestorRequest create() { - return new SiloIngestorRequest(); + public static SiloIngestorJobRequest create() { + return new SiloIngestorJobRequest(); } }