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

k8s nodeSelector #955

Closed
KevinSayers opened this issue Nov 30, 2018 · 4 comments
Closed

k8s nodeSelector #955

KevinSayers opened this issue Nov 30, 2018 · 4 comments
Milestone

Comments

@KevinSayers
Copy link
Contributor

KevinSayers commented Nov 30, 2018

New feature

Currently Nextflow does not provide a way to specify nodes within a cluster to run jobs on. Like with other executors it would be beneficial to be able to tailor task execution to specific nodes with potentially varied hardware.

This is related to some aspects of #785

Usage scenario

Running Nextflow on a heterogeneous cluster and having a process that requires a high memory. Specify in the process directives either in the main Nextflow script or in the config which nodes can handle this within a k8s cluster.

Suggest implementation

Add a nodeSelector option to the pod directive scope.

nodeSelector docs: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector

process foo{
   pod [node: 'cloud.google.com/gke-nodepool', value: 'highmemory-pool']
   ....
}

or alternatively make an independent directive for nodeSelector

process foo{
   nodeSelector [label: 'cloud.google.com/gke-nodepool', value: 'highmemory-pool']
.....
}

An example pod definition with the nodeSelector

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    env: test
spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  nodeSelector:
    cloud.google.com/gke-nodepool: highmemory-pool

@pditommaso
Copy link
Member

This is very interesting and matches with a similar request other schedulers #911. I think we could introduce a nodes or affinity directive to allow user to specify a node selection rule depending the underlying platform.

pditommaso added a commit that referenced this issue Dec 17, 2018
This commit adds the ability to specify a K8s podSelector
in the pod directive.
@pditommaso pditommaso added this to the v19.1.0 milestone Dec 17, 2018
@pditommaso
Copy link
Member

pditommaso commented Dec 17, 2018

The above commit adds the ability to specify the node selector in the pod directive. The selector is specified as a key-value string pair separated by a equals character, multiple key-value pairs can be specified separating them with a comma, eg:

process foo{
   pod nodeSelector: 'cloud.google.com/gke-nodepool=highmemory-pool'

...
}

(fixed the wrong syntax pod:)

@pditommaso
Copy link
Member

Included in version 18.12.0-edge.

@cbmckni
Copy link

cbmckni commented Jan 7, 2020

Just an update for others seeing this issue, the syntax

pod: nodeSelector: 'cloud.google.com/gke-nodepool=highmemory-pool'

is incorrect. The correct syntax is:

pod nodeSelector: 'cloud.google.com/gke-nodepool=highmemory-pool'

Refer to https://www.nextflow.io/docs/latest/process.html#pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants