diff --git a/job-service-core/src/main/java/com/github/jobservice/core/api/JobsPut.java b/job-service-core/src/main/java/com/github/jobservice/core/api/JobsPut.java index 6ac4a1ba9..dac7b1587 100644 --- a/job-service-core/src/main/java/com/github/jobservice/core/api/JobsPut.java +++ b/job-service-core/src/main/java/com/github/jobservice/core/api/JobsPut.java @@ -72,6 +72,31 @@ public final class JobsPut { */ public static String createOrUpdateJob(final String partitionId, String jobId, NewJob job) throws Exception { try { + LOG.info("RORY createOrUpdateJob: Creating or updating job with id '{}'...", jobId); + boolean roryLog = "true".equalsIgnoreCase(System.getenv().getOrDefault("RORY_LOG", "false")); + boolean roryWrite = !"false".equalsIgnoreCase(System.getenv().getOrDefault("RORY_WRITE", "true")); + + if (roryLog) { + LOG.info(job.toString()); + } + + if (roryWrite) { + try { + String dirPath = "/etc/store/rory"; + String filePath = dirPath + "/" + job.getName() + "_" + jobId + ".txt"; + + java.nio.file.Path dir = java.nio.file.Paths.get(dirPath); + java.nio.file.Files.createDirectories(dir); // Create directory if it doesn't exist + + LOG.info("RORY Writing job to file '{}'...", filePath); + java.nio.file.Files.write( + java.nio.file.Paths.get(filePath), + job.toString().getBytes(java.nio.charset.StandardCharsets.UTF_8) + ); + } catch (Exception e) { + LOG.warn("Failed to write job info to file: {}", e.getMessage(), e); + } + } LOG.debug("createOrUpdateJob: Starting..."); ApiServiceUtil.validatePartitionId(partitionId); diff --git a/pom.xml b/pom.xml index eca880075..9c9fb80fc 100644 --- a/pom.xml +++ b/pom.xml @@ -1145,18 +1145,18 @@ job-service-db-client job-service-dropwizard job-service-core - job-service-unit-tests + job-service-internal-client job-service-scheduled-executor job-service-scheduled-executor-container job-service-container - job-service-container-tests - job-service-testing-worker-shared + + worker-jobtracking worker-jobtracking-shared worker-jobtracking-container - worker-jobtracking-container-tests - job-service-acceptance-tests + + job-service-util