feat: config option for selecting the scheduling strategy
This commit is contained in:
@@ -242,6 +242,12 @@ class K8sConfig implements ConfigScope {
|
||||
""")
|
||||
final String runtimeRecordPath
|
||||
|
||||
@ConfigOption
|
||||
@Description("""
|
||||
Selects a scheduling strategy
|
||||
""")
|
||||
final String schedulingStrategy
|
||||
|
||||
/* required by extension point -- do not remove */
|
||||
K8sConfig() {
|
||||
this(Collections.emptyMap())
|
||||
@@ -280,6 +286,8 @@ class K8sConfig implements ConfigScope {
|
||||
workDir = opts.workDir ?: "${launchDir}/work"
|
||||
runtimeRecordPath = opts.runtimeRecordPath as String ?: "${workDir}/runtimes.csv"
|
||||
|
||||
schedulingStrategy = opts.schedulingStrategy as String ?: "Hash"
|
||||
|
||||
// -- shortcut to pod image pull-policy
|
||||
if( imagePullPolicy )
|
||||
pod.imagePullPolicy = imagePullPolicy
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package nextflow.k8s
|
||||
|
||||
import groovy.transform.CompileDynamic
|
||||
import nextflow.k8s.strategies.K8sDVFSSchedulingStrategy
|
||||
import nextflow.k8s.strategies.K8sHashSchedulingStrategy
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -98,7 +99,17 @@ class K8sExecutor extends Executor implements ExtensionPoint {
|
||||
this.runtimeRecorder = new K8sRuntimeRecorder(k8sConfig.recordTaskRuntimes, k8sConfig.runtimeRecordPath)
|
||||
this.runtimeEstimator = new K8sRuntimeEstimator(k8sConfig.runtimeRecordPath)
|
||||
|
||||
this.taskScheduler = new K8sTaskScheduler(getNodeList(), new K8sHashSchedulingStrategy())
|
||||
K8sSchedulingStrategy strategy = null
|
||||
if (k8sConfig.schedulingStrategy == "Hash") {
|
||||
strategy = new K8sHashSchedulingStrategy()
|
||||
} else if (k8sConfig.schedulingStrategy == "DVFS") {
|
||||
strategy = new K8sDVFSSchedulingStrategy()
|
||||
} else {
|
||||
log.error "[K8s] invalid scheduling strategy $k8sConfig.schedulingStrategy, falling back on \"Hash\""
|
||||
strategy = new K8sHashSchedulingStrategy()
|
||||
}
|
||||
|
||||
this.taskScheduler = new K8sTaskScheduler(getNodeList(), strategy)
|
||||
this.schedulerThread = new Thread(this.taskScheduler)
|
||||
this.schedulerThread.start()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package nextflow.k8s.strategies
|
||||
|
||||
import nextflow.k8s.K8sSchedulingDecision
|
||||
import nextflow.k8s.K8sSchedulingRequest
|
||||
import nextflow.k8s.K8sSchedulingStrategy
|
||||
import nextflow.k8s.K8sTaskScheduler
|
||||
|
||||
/**
|
||||
* Implements a scheduling strategy utilizing dvfs to reduce the energy consumption
|
||||
* of workflow execution, while attempting to maintain the same makespan.
|
||||
*/
|
||||
class K8sDVFSSchedulingStrategy implements K8sSchedulingStrategy {
|
||||
@Override
|
||||
K8sSchedulingDecision schedule(K8sTaskScheduler scheduler, List<K8sSchedulingRequest> queue) {
|
||||
return null
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean scheduleImmediately(K8sTaskScheduler scheduler, List<K8sSchedulingRequest> queue) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user