Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ BRAPI_READ_TIMEOUT=60m
# Max number of records to POST to the BrAPI service per request
POST_CHUNK_SIZE=1000

# Request cache records paginating through available records per program by CACHE_BRAPI_FETCH_PAGE_SIZE
CACHE_PAGINATE_GERMPLASM=false
CACHE_BRAPI_FETCH_PAGE_SIZE=65000
# Amount of records to page at a time through a BrAPI search request result. See BrAPIDAOUtil.searchInternalReturnResponse.
# Should not exceed 65k for now due to BrAPI limitations
BRAPI_PAGE_THRU_PAGE_SIZE=65000

# BrAPI Server Variables
BRAPI_SERVER_PORT=8083
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public BrAPIGermplasmController(@Property(name = "brapi.server.reference-source"
this.programService = programService;
}

// NOTE: bypasses cache and makes api request directly to brapi service
// Needs to convert DeltaBreed UUIDs to BrAPI Service DbIds and back
// NOTE: Makes api request directly to BrAPI service
// Needs to convert DeltaBreed program UUID to BrAPI programDbId and back
@Post("/programs/{programId}" + BrapiVersion.BRAPI_V2 + "/search/germplasm")
@Produces(MediaType.APPLICATION_JSON)
@ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.PROGRAM_SCOPED_ROLES})
Expand All @@ -115,8 +115,8 @@ public HttpResponse<Object> searchGermplasm(
return getObjectHttpResponse(brapiGermplasm, program.get().getKey());
}

// NOTE: bypasses cache and makes api request directly to brapi service
// Needs to convert BrAPIService dbIds to DeltaBreed UUIDs
// NOTE: Makes api request directly to BrAPI service
// Needs to convert DeltaBreed program UUID to BrAPI programDbId and back
@Get("/programs/{programId}" + BrapiVersion.BRAPI_V2 + "/search/germplasm/{searchResultId}{?queryParams*}")
@Produces(MediaType.APPLICATION_JSON)
@ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.PROGRAM_SCOPED_ROLES})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public BrAPIObservationDAO(ProgramDAO programDAO,
BrAPIObservationUnitDAO observationUnitDAO,
BrAPIDAOUtil brAPIDAOUtil,
BrAPIEndpointProvider brAPIEndpointProvider,
@Property(name = "brapi.cache.fetch-page-size") int brapiFetchPageSize,
@Property(name = "brapi.page-thru.page-size") int brapiFetchPageSize,
TraitService traitService) {
this.programDAO = programDAO;
this.importDAO = importDAO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public BrAPIObservationUnitDAO(ProgramDAO programDAO,
BrAPIGermplasmService germplasmService,
ProgramService programService,
@Property(name = "brapi.server.reference-source") String referenceSource,
@Property(name = "brapi.cache.fetch-page-size") int brapiFetchPageSize) {
@Property(name = "brapi.page-thru.page-size") int brapiFetchPageSize) {
this.programDAO = programDAO;
this.importDAO = importDAO;
this.brAPIDAOUtil = brAPIDAOUtil;
Expand Down Expand Up @@ -203,7 +203,7 @@ public List<BrAPIObservationUnit> getObservationUnitsForDatasetAndEnvs(@NotNull
}).collect(Collectors.toList());
}

// Note: does not use cache, impractical to implement all search parameters client-side.
// Note: impractical to implement all search parameters client-side.
public List<BrAPIObservationUnit> getObservationUnits(Program program,
Optional<String> observationUnitId,
Optional<String> observationUnitName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class BrAPIStudyDAO {
@Property(name = "brapi.server.reference-source")
private String referenceSource;

@Property(name = "brapi.cache.fetch-page-size")
@Property(name = "brapi.page-thru.page-size")
private int brapiMaxPageSize;

private ProgramDAO programDAO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public List<BrAPIListSummary> getListSummariesByTypeAndXref(
itemsFromEachList.put(list.getListDbId(), listDetails.getResult().getData().get(0));
}
if (type == BrAPIListTypes.GERMPLASM) {
// Fetch one germplasm for each list from cache.
// Fetch one germplasm for each list.
List<BrAPIGermplasm> germplasmRepresentatives = germplasmDAO.getGermplasmByRawName((new ArrayList<>(itemsFromEachList.values())), program.getId());
// Build hashmap of germplasm by name.
HashMap<String, BrAPIGermplasm> germplasmByName = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.breedinginsight.brapps.importer.services.processors.experiment.create.workflow.steps;

import io.micronaut.http.HttpResponse;
import io.micronaut.http.server.exceptions.InternalServerException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.CaseInsensitiveMap;
Expand Down Expand Up @@ -186,8 +185,8 @@ public void process(ProcessContext processContext, ProcessedData processedData)
// Do this check here, directly before creating new trials instead of in earlier step to minimize time window of race condition
if (!newTrials.isEmpty()) {
try {
List<BrAPITrial> cachedTrials = brapiTrialDAO.getTrials(program.getId());
List<String> existingTrialNames = cachedTrials.stream().map(BrAPITrial::getTrialName).collect(Collectors.toList());
List<BrAPITrial> programTrials = brapiTrialDAO.getTrials(program.getId());
List<String> existingTrialNames = programTrials.stream().map(BrAPITrial::getTrialName).collect(Collectors.toList());
List<String> newTrialNames = newTrials.stream().map(t -> Utilities.removeProgramKey(t.getTrialName(), program.getKey())).collect(Collectors.toList());
log.debug("** Trials Duplicate Check: {} -> {}", existingTrialNames, newTrialNames);
if (newTrialNames.stream().anyMatch(existingTrialNames::contains)) {
Expand All @@ -213,7 +212,6 @@ public void process(ProcessContext processContext, ProcessedData processedData)
trialByNameNoScope.get(createdTrialName)
.getBrAPIObject()
.setTrialDbId(createdTrial.getTrialDbId());
// TODO: May need to set the main ID for pending objects with the BrAPI ID for downstream usage once cache is removed.
trialByNameNoScope.get(createdTrialName)
.setId(UUID.fromString(createdTrial.getTrialDbId()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,7 @@ public PendingImportObject<BrAPIStudy> constructPIOFromBrapiStudy(BrAPIStudy brA

// TODO: used by both workflows
public String seasonDbIdToYear(String seasonDbId, UUID programId) {
String year = null;
// TODO: add season objects to redis cache then just extract year from those
// removing this for now here
//if (this.seasonDbIdToYearCache.containsKey(seasonDbId)) { // get it from cache if possible
// year = this.seasonDbIdToYearCache.get(seasonDbId);
//} else {
year = seasonDbIdToYearFromDatabase(seasonDbId, programId);
// this.seasonDbIdToYearCache.put(seasonDbId, year);
//}
return year;
return seasonDbIdToYearFromDatabase(seasonDbId, programId);
}

// TODO: used by both workflows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,7 @@ public PendingImportObject<BrAPIStudy> processAndCacheStudy(

// TODO: used by both workflows
private String seasonDbIdToYear(String seasonDbId, UUID programId) {
String year = null;
// TODO: add season objects to redis cache then just extract year from those
// removing this for now here
//if (this.seasonDbIdToYearCache.containsKey(seasonDbId)) { // get it from cache if possible
// year = this.seasonDbIdToYearCache.get(seasonDbId);
//} else {
year = seasonDbIdToYearFromDatabase(seasonDbId, programId);
// this.seasonDbIdToYearCache.put(seasonDbId, year);
//}
return year;
return seasonDbIdToYearFromDatabase(seasonDbId, programId);
}

// TODO: used by both workflows
Expand Down

This file was deleted.

213 changes: 0 additions & 213 deletions src/main/java/org/breedinginsight/daos/cache/ProgramCache.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ public Optional<SampleSubmission> updateSubmissionStatus(Program program, UUID s

/**
* Deletes BrAPI plates and submission objects as well as sample submission record in bidb
* We do not currently cache plates or samples so don't need to worry about that
* @param submissionId sample submission UUID to delete
* @return result describing whether the submission was deleted or why deletion was rejected
* @exception ApiException if a BrAPI call fails
Expand Down
Loading
Loading