diff --git a/tooling/src/main/java/org/opencds/cqf/tooling/processor/AbstractBundler.java b/tooling/src/main/java/org/opencds/cqf/tooling/processor/AbstractBundler.java index 8ef34610d..d60ed1fdd 100644 --- a/tooling/src/main/java/org/opencds/cqf/tooling/processor/AbstractBundler.java +++ b/tooling/src/main/java/org/opencds/cqf/tooling/processor/AbstractBundler.java @@ -142,7 +142,7 @@ public void bundleResources(ArrayList refreshedLibraryNames, String igPa final Map libraryPathMap = new ConcurrentHashMap<>(IOUtils.getLibraryPathMap(fhirContext)); if (resourcesMap.isEmpty()) { - logger.info("[INFO] No " + getResourceBundlerType() + "s found. Continuing..."); + logger.info("\n\r" + "[INFO] No " + getResourceBundlerType() + "s found. Continuing...\n\r"); return; } @@ -169,7 +169,7 @@ public void bundleResources(ArrayList refreshedLibraryNames, String igPa tasks.add(() -> { //check if resourceSourcePath has been processed before: if (processedResources.contains(resourceSourcePath)) { - logger.info(getResourceBundlerType() + " processed already: " + resourceSourcePath); + logger.info("\n\r" + getResourceBundlerType() + " processed already: " + resourceSourcePath); return null; } String resourceName = FilenameUtils.getBaseName(resourceSourcePath).replace(getResourcePrefix(), ""); @@ -296,7 +296,7 @@ public void bundleResources(ArrayList refreshedLibraryNames, String igPa //Output final report: String summaryOutput = generateBundleProcessSummary(refreshedLibraryNames, fhirContext, fhirUri, verboseMessaging, persistedFileReport, bundledResources, failedExceptionMessages, cqlTranslatorErrorMessages).toString(); - logger.info(summaryOutput); + logger.info("\n\r" + summaryOutput); } /** diff --git a/tooling/src/main/java/org/opencds/cqf/tooling/processor/IGBundleProcessor.java b/tooling/src/main/java/org/opencds/cqf/tooling/processor/IGBundleProcessor.java index f578e391a..d765415a8 100644 --- a/tooling/src/main/java/org/opencds/cqf/tooling/processor/IGBundleProcessor.java +++ b/tooling/src/main/java/org/opencds/cqf/tooling/processor/IGBundleProcessor.java @@ -49,7 +49,7 @@ public void bundleIg(ArrayList refreshedLibraryNames, String igPath, Lis //run collected post calls last: if (HttpClientUtils.hasPostTasksInQueue()) { - logger.info("[Persisting Files to " + fhirUri + "]"); + logger.info("\n\r[Persisting Files to " + fhirUri + "]\n\r"); HttpClientUtils.postTaskCollection(); } diff --git a/tooling/src/main/java/org/opencds/cqf/tooling/utilities/HttpClientUtils.java b/tooling/src/main/java/org/opencds/cqf/tooling/utilities/HttpClientUtils.java index 6cae13a0a..55bb1e194 100644 --- a/tooling/src/main/java/org/opencds/cqf/tooling/utilities/HttpClientUtils.java +++ b/tooling/src/main/java/org/opencds/cqf/tooling/utilities/HttpClientUtils.java @@ -380,13 +380,19 @@ private static void reportProgress(HttpPOSTResourceType postType) { String fileGroup = ""; if (postType != null) { - fileGroup = "Current POST group: " + postType.getDisplayName() + " " + getSectionPercentage(postType) + " "; + fileGroup = "Posting: " + postType.getDisplayName() + " (" + getSectionPercentage(postType) + ")"; } double percentage = (double) currentCounter / getTotalTaskCount() * 100; - System.out.print("\rOverall Progress: " + String.format("%.2f%%", percentage) + ". " + + String progressStr = "\rOverall Progress: " + String.format("%.2f%%", percentage) + ". " + "POST response pool size: " + runningPostTaskList.size() + ". " + - fileGroup); + fileGroup; + + + String repeatedString = " ".repeat(progressStr.length() * 2); + System.out.print(repeatedString); + + System.out.print(progressStr); } @@ -420,21 +426,11 @@ public static void postTaskCollection() { ExecutorService executorService = Executors.newFixedThreadPool(1); try { - logger.info(getTotalTaskCount() + " POST calls to be made. Starting now. Please wait..."); - double percentage = 0; - System.out.print("\rPOST: " + String.format("%.2f%%", percentage) + " done. "); - - //execute the tasks for each priority ranking, sorted: - for (int i = 0; i < resourceTypePostOrder.size(); i++) { - //execute the tasks in order specified - if (mappedTasksByPriorityRank.containsKey(resourceTypePostOrder.get(i))) { - executeTasks(executorService, mappedTasksByPriorityRank.get(resourceTypePostOrder.get(i))); - } - } + logger.info("\n\r" + getTotalTaskCount() + " POST calls to be made. Starting now. Please wait..." + "\n\r"); + runPostCalls(executorService); - reportProgress(); - logger.info("Processing results..."); + logger.info("\n\r" + "Processing results..."+ "\n\r"); Collections.sort(successfulPostCalls); StringBuilder message = new StringBuilder(); @@ -446,7 +442,7 @@ public static void postTaskCollection() { successfulPostCalls = new ArrayList<>(); if (!failedPostCalls.isEmpty()) { - logger.info(failedPostCalls.size() + " tasks failed to POST. Retry these failed posts? (Y/N)"); + logger.info("\n\r" + failedPostCalls.size() + " tasks failed to POST. Retry these failed posts? (Y/N)"); Scanner scanner = new Scanner(System.in); String userInput = scanner.nextLine().trim().toLowerCase(); @@ -468,16 +464,8 @@ public static void postTaskCollection() { } } - //execute any tasks marked as having priority: - //execute the tasks for each priority ranking, sorted: - for (int i = 0; i < resourceTypePostOrder.size(); i++) { - //execute the tasks in order specified - if (mappedTasksByPriorityRank.containsKey(resourceTypePostOrder.get(i))) { - executeTasks(executorService, mappedTasksByPriorityRank.get(resourceTypePostOrder.get(i))); - } - } + runPostCalls(executorService); - reportProgress(); if (failedPostCalls.isEmpty()) { logger.info("\r\nRetry successful, all tasks successfully posted"); } @@ -520,6 +508,22 @@ public static void postTaskCollection() { } } + /** + * Executes the tasks for each priority ranking, sorted: + * @param executorService + */ + private static void runPostCalls(ExecutorService executorService) { + //execute the tasks for each priority ranking, sorted: + for (int i = 0; i < resourceTypePostOrder.size(); i++) { + //execute the tasks in order specified + if (mappedTasksByPriorityRank.containsKey(resourceTypePostOrder.get(i))) { + executeTasks(executorService, mappedTasksByPriorityRank.get(resourceTypePostOrder.get(i))); + } + } + + reportProgress(); + } + /** * Gives the user a log file containing failed POST attempts during postTaskCollection() *