-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
paulo
committed
Apr 23, 2022
1 parent
191fd19
commit 4fd0919
Showing
28 changed files
with
138 additions
and
10 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file modified
BIN
+0 Bytes
(100%)
.gradle/7.1/dependencies-accessors/dependencies-accessors.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#Thu Apr 14 22:24:00 CEST 2022 | ||
gradle.version=7.1 | ||
#Sat Apr 16 22:52:48 CEST 2022 | ||
gradle.version=6.8.3 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<Configuration status="info"> | ||
<Properties> | ||
<Property name="filename">log/logging.log</Property> | ||
</Properties> | ||
|
||
<Appenders> | ||
<Console name="Console" target="SYSTEM_OUT"> | ||
<PatternLayout pattern="%style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{yellow} %highlight{[%-5level] [%t] %c{1} - %msg}{STYLE=Logback}%n" | ||
disableAnsi="false "/> | ||
</Console> | ||
<File name="File" fileName="log/logging.log" append="false"> | ||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%t] %c{1} - %msg%n"/> | ||
</File> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="trace"> | ||
<AppenderRef ref="Console" level="info"/> | ||
<AppenderRef ref="File" level="debug" /> | ||
</Root> | ||
</Loggers> | ||
</Configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/groovy/org/example/syntheakds/read/DataProvider.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.example.syntheakds.read | ||
|
||
import com.fasterxml.jackson.databind.JsonNode | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import groovy.io.FileType | ||
import org.apache.logging.log4j.LogManager | ||
import org.apache.logging.log4j.Logger | ||
|
||
import java.nio.file.Path | ||
import java.util.concurrent.ArrayBlockingQueue | ||
import java.util.concurrent.ThreadPoolExecutor | ||
|
||
class DataProvider { | ||
|
||
private static final Logger logger = LogManager.getLogger(DataProvider.class) | ||
|
||
private final Path toDir | ||
private final int patientCount | ||
private final ObjectMapper objectMapper | ||
private final Queue<JsonNode> readQueue | ||
private final ThreadPoolExecutor ioPool | ||
|
||
DataProvider(Path toDir, int patientCount, int qCapacity, ThreadPoolExecutor ioPool){ | ||
logger.debug("Initializing DataProvider instance ...") | ||
this.toDir = toDir | ||
this.patientCount = patientCount | ||
this.objectMapper = new ObjectMapper() | ||
this.readQueue = new ArrayBlockingQueue<>(qCapacity) | ||
this.ioPool = ioPool | ||
run() | ||
} | ||
|
||
private void run(){ | ||
def files = this.findFiles() | ||
logger.debug("Reading files ...") | ||
files.each {file -> | ||
logger.debug("File @ ${file.getPath()}") | ||
this.ioPool.submit({this.readQueue.add(objectMapper.readTree(file))}) | ||
logger.debug("--Submitted to I/O pool") | ||
logger.debug("--Task count: ${this.ioPool.taskCount}") | ||
} | ||
} | ||
|
||
Queue<JsonNode> getQ(){ | ||
return this.readQueue | ||
} | ||
|
||
private List<File> findFiles(){ | ||
logger.debug("Searching for files ...") | ||
def files = [] | ||
this.toDir.eachFileMatch(type: FileType.FILES, nameFilter: ~/\*.json/){ file -> | ||
logger.debug("Found file @ ${file.toString()}") | ||
files << file.toFile() | ||
} | ||
return files | ||
} | ||
|
||
|
||
|
||
} |