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

Moving data and query in within subject code block for latency issue in QA #1062

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -650,21 +650,23 @@ export class ExperimentAssignmentService {
);
})
);

const allSites = [],
allTargets = [];
filteredExperiments.forEach((exp) => {
exp.partitions.forEach((partition) => {
allSites.push(partition.site);
allTargets.push(partition.target);
let monitoredLogCounts = [];
if (filteredExperiments.some((e) => e.assignmentUnit === ASSIGNMENT_UNIT.WITHIN_SUBJECTS)) {
const allWithinSubjectsSites = [];
const allWithinSubjectsTargets = [];
filteredExperiments.forEach((exp) => {
exp.partitions.forEach((partition) => {
allWithinSubjectsSites.push(partition.site);
allWithinSubjectsTargets.push(partition.target);
});
});
});
const monitoredLogCounts = await this.monitoredDecisionPointLogRepository.getAllMonitoredDecisionPointLog(
userId,
allSites,
allTargets,
logger
);
monitoredLogCounts = await this.monitoredDecisionPointLogRepository.getAllMonitoredDecisionPointLog(
userId,
allWithinSubjectsSites,
allWithinSubjectsTargets,
logger
);
}

return filteredExperiments.reduce((accumulator, experiment, index) => {
const assignment = experimentAssignment[index];
Expand Down Expand Up @@ -765,7 +767,6 @@ export class ExperimentAssignmentService {

private createExperimentPool(experiments: Experiment[]): Experiment[][] {
const pool: Experiment[][] = [];
// const localExperiment = [...experiments];

const decisionPointExperimentMap: Record<string, Experiment[]> = {};

Expand All @@ -782,36 +783,6 @@ export class ExperimentAssignmentService {
pool.push(this.createPool(decisionPointToStart, decisionPointExperimentMap, []));
}

// while (localExperiment.length > 0) {
// const poolElements = [];
// const decisionPointHashMap: Record<string, Experiment[]> = {};

// for (let i = 0; i < localExperiment.length; i++) {
// // Push single element inside the pool
// const experiment = localExperiment[i];
// if (i === 0) {
// poolElements.push(experiment);
// }

// // add to decision point hashmap
// let isIntersecting = false;
// experiment.partitions.forEach((partition) => {
// const partitionId = `${partition.site}_${partition.target}`;
// if (partitionId in decisionPointHashMap) {
// isIntersecting = true;
// }
// decisionPointHashMap[partitionId] = decisionPointHashMap[partitionId] || [];
// decisionPointHashMap[partitionId].push(experiment);
// });

// if(isIntersecting) {

// }
// }

// // remove elements from localExperiment
// }

return pool;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ExperimentOverviewComponent implements OnInit, OnDestroy {
unitOfAssignments = [
{ value: ASSIGNMENT_UNIT.INDIVIDUAL },
{ value: ASSIGNMENT_UNIT.GROUP },
{ value: ASSIGNMENT_UNIT.WITHIN_SUBJECTS },
// { value: ASSIGNMENT_UNIT.WITHIN_SUBJECTS }, // #1063 temporarily removed within-subjects until solved
];
public ASSIGNMENT_UNIT = ASSIGNMENT_UNIT;

Expand Down
Loading