File tree Expand file tree Collapse file tree 3 files changed +34
-6
lines changed
plugins/nf-cws/src/main/nextflow/cws/k8s Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -112,10 +112,12 @@ k8s {
112112
113113| Attribute | Required | Explanation |
114114| :----------------------| ----------| -------------------------------------------------------------------------------------------------|
115- | localPath | yes | Host path for the local mount
116- | localStorageMountPath | no | Container path for the local mount
117- | storage.copyStrategy | no | Strategy to copy the files between nodes - currently only supports 'ftp' (and its alias 'copy')
118- | storage.workdir | no | Working directory to use - must be inside of the locally mounted directory
115+ | localPath | yes | Host path for the local mount |
116+ | localStorageMountPath | no | Container path for the local mount |
117+ | storage.copyStrategy | no | Strategy to copy the files between nodes - currently only supports 'ftp' (and its alias 'copy') |
118+ | storage.workdir | no | Working directory to use - must be inside of the locally mounted directory |
119+ | storage.cpu | no | CPU to use for daemons running on all nodes, default: empty - no limits |
120+ | storage.memory | no | Memory to use for daemons running on all nodes, default: 256Mi |
119121
120122### Tracing
121123
Original file line number Diff line number Diff line change @@ -180,5 +180,17 @@ class CWSK8sConfig extends K8sConfig {
180180 String getCmd () {
181181 target. cmd as String
182182 }
183+
184+ Double getCpu () {
185+ if ( target. cpu ) {
186+ return target. cpu as double
187+ }
188+ return null
189+ }
190+
191+ String getMemory () {
192+ target. memory as String ?: ' 256Mi'
193+ }
194+
183195 }
184196}
Original file line number Diff line number Diff line change @@ -272,19 +272,33 @@ class CWSK8sExecutor extends K8sExecutor implements ExtensionPoint {
272272 mounts << claim
273273 }
274274
275+ CWSK8sConfig.Storage storage = (k8sConfig as CWSK8sConfig ). getStorage()
276+
275277 String name = " mount-${ session.runName.replace('_', '-')} "
278+ def resources = [
279+ limits : [
280+ memory : storage. getMemory()
281+ ],
282+ requests : [
283+ memory : storage. getMemory()
284+ ]
285+ ]
286+ if ( storage. getCpu() ) {
287+ (resources. limits as Map ). put( ' cpu' , storage. getCpu() )
288+ (resources. requests as Map ). put( ' cpu' , storage. getCpu() )
289+ }
276290 def spec = [
277291 containers : [ [
278292 name : name,
279293 image : (k8sConfig as CWSK8sConfig ). getStorage(). getImageName(),
280294 volumeMounts : mounts,
281- imagePullPolicy : ' IfNotPresent'
295+ imagePullPolicy : ' IfNotPresent' ,
296+ resources : resources
282297 ] ],
283298 volumes : volumes,
284299 serviceAccount : client. config. serviceAccount
285300 ]
286301
287- CWSK8sConfig.Storage storage = (k8sConfig as CWSK8sConfig ). getStorage()
288302 if ( storage. getNodeSelector() )
289303 spec. put( ' nodeSelector' , storage. getNodeSelector(). toSpec() as Serializable )
290304
You can’t perform that action at this time.
0 commit comments