Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAR-CORE-CWS: Observed multiple jobs running on worker configured to … #229

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions cws-engine-service/src/main/java/jpl/cws/engine/WorkerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,20 @@ public List<Map<String,Object>> claimWithCounter(String limitToProcDefKey) {

int queryLimit = Math.min(MaxNumForProcsOnWorker, workerMaxProcQueryLimit);

// Adjust queryLimitForProcSet to ensure total claimed won't exceed workerMaxProcQueryLimit
int totalPossibleClaims = 0;
for (Integer limit : queryLimitForProcSet.values()) {
totalPossibleClaims += limit;
}
if (totalPossibleClaims > queryLimit) {
// Scale down individual limits proportionally
double scaleFactor = (double)queryLimit / totalPossibleClaims;
for (Map.Entry<String,Integer> entry : queryLimitForProcSet.entrySet()) {
int newLimit = Math.max(1, (int)(entry.getValue() * scaleFactor));
queryLimitForProcSet.put(entry.getKey(), Math.min(newLimit, queryLimit));
}
}

Map<String,List<String>> claimRowData =
schedulerDbService.claimHighestPriorityStartReq(
workerId, currentCounts, queryLimitForProcSet, queryLimit); // pass list of procDefkey and a map of queryLimit per procDefKey
Expand Down
Loading