-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-5197: preparation for supporting fair sub-query execution in FedX
This change adds preparational infrastructure for having different implementations of schedulers. Configuration is here prepared by means of defining a "SchedulerFactory" interface with a default implementation aside (which essentially mimics the current behavior). Note that for ease of development some aspects of ControlledWorkerScheduler are made accessible to sub-classes. The idea is that in the end version there is an abstract scheduler class providing shared functionality and different implementation (e.g. the current FIFO one and a fair implementation)
- Loading branch information
1 parent
ab02413
commit d74e6be
Showing
5 changed files
with
141 additions
and
10 deletions.
There are no files selected for viewing
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
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
44 changes: 44 additions & 0 deletions
44
.../main/java/org/eclipse/rdf4j/federated/evaluation/concurrent/DefaultSchedulerFactory.java
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,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*******************************************************************************/ | ||
package org.eclipse.rdf4j.federated.evaluation.concurrent; | ||
|
||
import org.eclipse.rdf4j.federated.FederationContext; | ||
import org.eclipse.rdf4j.query.BindingSet; | ||
|
||
/** | ||
* The default {@link SchedulerFactory} | ||
*/ | ||
public class DefaultSchedulerFactory implements SchedulerFactory { | ||
|
||
public static final DefaultSchedulerFactory INSTANCE = new DefaultSchedulerFactory(); | ||
|
||
@Override | ||
public ControlledWorkerScheduler<BindingSet> createJoinScheduler(FederationContext federationContext, | ||
int nWorkers) { | ||
return new ControlledWorkerScheduler<>(nWorkers, | ||
"Join Scheduler"); | ||
} | ||
|
||
@Override | ||
public ControlledWorkerScheduler<BindingSet> createUnionScheduler(FederationContext federationContext, | ||
int nWorkers) { | ||
return new ControlledWorkerScheduler<>(nWorkers, | ||
"Union Scheduler"); | ||
} | ||
|
||
@Override | ||
public ControlledWorkerScheduler<BindingSet> createLeftJoinScheduler(FederationContext federationContext, | ||
int nWorkers) { | ||
return new ControlledWorkerScheduler<>(nWorkers, | ||
"Left Join Scheduler"); | ||
} | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
...ion/src/main/java/org/eclipse/rdf4j/federated/evaluation/concurrent/SchedulerFactory.java
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,50 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*******************************************************************************/ | ||
package org.eclipse.rdf4j.federated.evaluation.concurrent; | ||
|
||
import org.eclipse.rdf4j.federated.FederationContext; | ||
import org.eclipse.rdf4j.query.BindingSet; | ||
|
||
/** | ||
* Factory for creating {@link ControlledWorkerScheduler} for executing subqueries (e.g. joins) in the background | ||
* | ||
* @see DefaultSchedulerFactory | ||
* @author Andreas Schwarte | ||
*/ | ||
public interface SchedulerFactory { | ||
|
||
/** | ||
* Create a {@link ControlledWorkerScheduler} for joins | ||
* | ||
* @param federationContext | ||
* @param nWorkers | ||
* @return | ||
*/ | ||
ControlledWorkerScheduler<BindingSet> createJoinScheduler(FederationContext federationContext, int nWorkers); | ||
|
||
/** | ||
* Create a {@link ControlledWorkerScheduler} for unions | ||
* | ||
* @param federationContext | ||
* @param nWorkers | ||
* @return | ||
*/ | ||
ControlledWorkerScheduler<BindingSet> createUnionScheduler(FederationContext federationContext, int nWorkers); | ||
|
||
/** | ||
* Create a {@link ControlledWorkerScheduler} for left joins | ||
* | ||
* @param federationContext | ||
* @param nWorkers | ||
* @return | ||
*/ | ||
ControlledWorkerScheduler<BindingSet> createLeftJoinScheduler(FederationContext federationContext, int nWorkers); | ||
} |