package nextflow.k8s

interface K8sSchedulingStrategy {
    /**
     * Selects the next task to run from the given task queue.
     * If the scheduler should wait, returns {@code null} instead
     *
     * @param scheduler the calling scheduler object
     * @param queue Pending scheduling requests
     * @return A launch decision, or {@code null} when no task should be launched now
     */
    K8sSchedulingDecision schedule(K8sTaskScheduler scheduler, List<K8sSchedulingRequest> queue)

    /**
     * Decides if the scheduler should immediately invoke the @ref schedule method of the strategy
     * @param scheduler the calling scheduler object
     * @param queue pending scheduling requests
     * @return {@code true} if @ref schedule should immediately be called
     */
    boolean scheduleImmediately(K8sTaskScheduler scheduler, List<K8sSchedulingRequest> queue)
}
