Skip to content

Commit

Permalink
remove inordinately verbose debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxcapades committed Oct 1, 2024
1 parent 27fb4a2 commit 95d1413
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 39 deletions.
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Project settings
group = "org.veupathdb.eda"
version = "5.0.0"
version = "5.0.1"

plugins {
`java-library`
Expand All @@ -25,10 +25,6 @@ tasks.withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

//tasks.named("jar") {
// duplicatesStrategy =
//}

val test by tasks.getting(Test::class) {
// use junit platform for unit tests
useJUnitPlatform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ private static CloseableIterator<Map<String, String>> oracleTabularSubsetIterato
TreeNode<Entity> prunedEntityTree = pruneTree(study.getEntityTree(), filters, outputEntity);

String sql = generateTabularSqlForTallRows(appDbSchema, outputVariables, outputEntity, filters, prunedEntityTree);
LOG.debug("Generated the following tabular SQL: {} with schema {}.", sql, appDbSchema);

// gather the output columns; these will be used for the standard header and to look up DB column values
List<String> outputColumns = getTabularOutputColumns(outputEntity, outputVariables);
Expand Down Expand Up @@ -225,7 +224,6 @@ public static void produceTabularSubset(DataSource dataSource, String appDbSchem
String sql = reportConfig.requiresSorting()
? generateTabularSqlForWideRows(appDbSchema, outputVariables, outputEntity, filters, reportConfig, prunedEntityTree)
: generateTabularSqlForTallRows(appDbSchema, outputVariables, outputEntity, filters, prunedEntityTree);
LOG.debug("Generated the following tabular SQL: " + sql);

// gather the output columns; these will be used for the standard header and to look up DB column values
List<String> outputColumns = getColumns(outputEntity, outputVariables, Entity::getPKColName, Variable::getId);;
Expand Down Expand Up @@ -464,7 +462,6 @@ public static Stream<TwoTuple<String, Long>> produceVariableDistribution(
DataSource datasource, String appDbSchema, TreeNode<Entity> prunedEntityTree, Entity outputEntity,
VariableWithValues distributionVariable, List<Filter> filters) {
String sql = generateDistributionSql(appDbSchema, outputEntity, distributionVariable, filters, prunedEntityTree);
LOG.info("Generated the following distribution SQL: " + NL + sql + NL);
return ResultSets.openStream(datasource, sql, "Produce variable distribution", row -> Optional.of(
new TwoTuple<>(distributionVariable.getType().convertRowValueToStringValue(row), row.getLong(COUNT_COLUMN_NAME))));
}
Expand Down Expand Up @@ -530,8 +527,6 @@ static List<String> getEntityIdsInFilters(List<Filter> filters) {
*/
static String generateTabularSqlForTallRows(String appDbSchema, List<VariableWithValues> outputVariables, Entity outputEntity, List<Filter> filters, TreeNode<Entity> prunedEntityTree) {

LOG.debug("--------------------- generateTabularSql ------------------");

String tallTblAbbrev = "tall";
String ancestorTblAbbrev = "subset";
return
Expand Down Expand Up @@ -579,8 +574,6 @@ static String generateTabularSqlForTallRows(String appDbSchema, List<VariableWit
*/
static String generateTabularSqlForWideRows(String appDbSchema, List<VariableWithValues> outputVariables, Entity outputEntity, List<Filter> filters,
TabularReportConfig reportConfig, TreeNode<Entity> prunedEntityTree) {
LOG.debug("--------------------- generateTabularSql paging sorting ------------------");

String wideTabularWithClauseName = "wide_tabular";
String subsetWithClauseName = "subset";
String rowColName = "r";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,40 @@
import java.util.Optional;

/**
* Implementation of {@link BinaryMetadataProvider} that reads metadata from a meta.json file. This is designed to be
* used by a consumer of the generated binary files.
* Implementation of {@link BinaryMetadataProvider} that reads metadata from a
* <code>meta.json</code> file. This is designed to be used by a consumer of the
* generated binary files.
*/
public class MetadataFileBinaryProvider implements BinaryMetadataProvider {

private static final Logger LOG = LogManager.getLogger(MetadataFileBinaryProvider.class);
private static final Logger LOG = LogManager.getLogger(MetadataFileBinaryProvider.class);

private BinaryFilesManager binaryFilesManager;
private final BinaryFilesManager binaryFilesManager;

public MetadataFileBinaryProvider(BinaryFilesManager binaryFilesManager) {
this.binaryFilesManager = binaryFilesManager;
public MetadataFileBinaryProvider(BinaryFilesManager binaryFilesManager) {
this.binaryFilesManager = binaryFilesManager;
}

@Override
public Optional<BinaryProperties> getBinaryProperties(String studyAbbrev, Entity entity, String variableId) {
if (!binaryFilesManager.studyHasFiles(studyAbbrev)) {
LOG.error("Could not find files for study '{}' (using entity '{}' and variable '{}') while trying to find binary properties for a variable.", studyAbbrev, entity.getId(), variableId);
return Optional.empty();
}

Optional<BinaryFilesManager.Metadata> metadata = binaryFilesManager.readMetadata(studyAbbrev, entity);
if (metadata.isEmpty()) {
LOG.error("Unable to read metadata file for study '{}' (using entity '{}') even though files are present.", studyAbbrev, entity.getId());
return Optional.empty();
}

@Override
public Optional<BinaryProperties> getBinaryProperties(String studyAbbrev, Entity entity, String variableId) {
if (!binaryFilesManager.studyHasFiles(studyAbbrev)) {
LOG.error("Could not find files for study '" + studyAbbrev + "' (using entity '" + entity.getId() + "' and variable '" + variableId + "') while trying to find binary properties for a variable.");
return Optional.empty();
}
Optional<BinaryFilesManager.Metadata> metadata = binaryFilesManager.readMetadata(studyAbbrev, entity);
if (metadata.isEmpty()) {
LOG.error("Unable to read metadata file for study '" + studyAbbrev + "' (using entity '" + entity.getId() + "') even though files are present.");
return Optional.empty();
}
Optional<BinaryFilesManager.VariableMeta> varMetadata = metadata.flatMap(meta -> meta.getVariableMetadata().stream()
.filter(varMeta -> varMeta.getVariableId().equals(variableId))
.findFirst());
if (varMetadata.isEmpty()) {
LOG.error("Unable to find metadata object for study '" + studyAbbrev + "', entity '" + entity.getId() + "', and variable '" + variableId + "' in metadata file.");
return Optional.empty();
}
BinaryProperties binaryProperties = varMetadata.get().getProperties();
LOG.info("Returning binary properties for study '" + studyAbbrev + "', entity '" + entity.getId() + "', and variable '" + variableId + "': " + binaryProperties);
return Optional.of(binaryProperties);
Optional<BinaryFilesManager.VariableMeta> varMetadata = metadata.flatMap(meta -> meta.getVariableMetadata().stream()
.filter(varMeta -> varMeta.getVariableId().equals(variableId))
.findFirst());
if (varMetadata.isEmpty()) {
LOG.error("Unable to find metadata object for study '{}', entity '{}', and variable '{}' in metadata file.", studyAbbrev, entity.getId(), variableId);
}

return varMetadata.map(BinaryFilesManager.VariableMeta::getProperties);
}
}

0 comments on commit 95d1413

Please sign in to comment.