Skip to content

Commit

Permalink
implement datacenters directive
Browse files Browse the repository at this point in the history
closes #42

Signed-off-by: Jorge Aguilera <[email protected]>
  • Loading branch information
jagedn committed Jun 16, 2024
1 parent 7ed26c2 commit a2f9f30
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package nextflow.nomad.config

import nextflow.nomad.NomadConfig

class VolumeSpec {

final static public String VOLUME_DOCKER_TYPE = "docker"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@

package nextflow.nomad.executor


import nextflow.executor.BashWrapperBuilder
import nextflow.executor.SimpleFileCopyStrategy
import nextflow.processor.TaskBean
import nextflow.util.Escape

/**
* Custom bash wrapper builder for Nomad jobs/tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,7 @@ import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import io.nomadproject.client.ApiClient
import io.nomadproject.client.api.JobsApi
import io.nomadproject.client.model.Affinity
import io.nomadproject.client.model.AllocationListStub
import io.nomadproject.client.model.Constraint
import io.nomadproject.client.model.Job
import io.nomadproject.client.model.JobRegisterRequest
import io.nomadproject.client.model.JobRegisterResponse
import io.nomadproject.client.model.ReschedulePolicy
import io.nomadproject.client.model.Resources
import io.nomadproject.client.model.RestartPolicy
import io.nomadproject.client.model.Task
import io.nomadproject.client.model.TaskGroup
import io.nomadproject.client.model.VolumeMount
import io.nomadproject.client.model.VolumeRequest
import io.nomadproject.client.model.*
import nextflow.nomad.NomadConfig
import nextflow.nomad.config.VolumeSpec
import nextflow.processor.TaskRun
Expand Down Expand Up @@ -236,7 +224,7 @@ class NomadService implements Closeable{
}

protected Job assignDatacenters(TaskRun task, Job job){
def datacenters = task.processor.config.get("datacenters")
def datacenters = task.processor?.config?.get("datacenters")
if( datacenters ){
if( datacenters instanceof List<String>) {
job.datacenters( datacenters as List<String>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
*/
package nextflow.nomad.executor


import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import io.nomadproject.client.model.Resources
import io.nomadproject.client.model.TaskGroupSummary
import nextflow.exception.ProcessSubmitException
import nextflow.exception.ProcessUnrecoverableException
import nextflow.executor.BashWrapperBuilder
Expand All @@ -31,7 +28,6 @@ import nextflow.processor.TaskHandler
import nextflow.processor.TaskRun
import nextflow.processor.TaskStatus
import nextflow.util.Escape
import nextflow.util.MemoryUnit

import java.nio.file.Path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,19 @@
*/
package nextflow.nomad

import groovy.util.logging.Slf4j

import groovyx.gpars.dataflow.DataflowBroadcast
import nextflow.Session
import nextflow.executor.Executor
import nextflow.executor.ExecutorFactory
import nextflow.nomad.executor.NomadExecutor
import nextflow.processor.TaskHandler
import nextflow.processor.TaskMonitor
import nextflow.processor.TaskRun
import nextflow.processor.TaskStatus
import nextflow.script.BaseScript
import nextflow.script.ChannelOut
import nextflow.script.ScriptRunner
import nextflow.script.ScriptType

import java.nio.file.Paths

/**
* Mock runner for test
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ package nextflow.nomad.executor

import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import io.nomadproject.client.model.Resources
import nextflow.executor.Executor
import nextflow.nomad.NomadConfig
import nextflow.processor.TaskBean
import nextflow.processor.TaskConfig
import nextflow.processor.TaskProcessor
import nextflow.processor.TaskRun
import nextflow.script.ProcessConfig
import nextflow.util.MemoryUnit
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Specification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ package nextflow.nomad.executor
import nextflow.exception.ProcessSubmitException
import nextflow.executor.Executor
import nextflow.nomad.NomadConfig
import nextflow.processor.TaskBean
import nextflow.processor.TaskConfig
import nextflow.processor.TaskProcessor
import nextflow.processor.TaskRun
import nextflow.processor.TaskStatus
import nextflow.script.ProcessConfig
import nextflow.processor.*
import spock.lang.Specification

import java.nio.file.Files
Expand Down
2 changes: 1 addition & 1 deletion src/docs/asciidoc/parts/directives.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

You can tag your processes with following directives:

- datacenters (a strings list)
- datacenters (a strings list or a closure returning a String)

0 comments on commit a2f9f30

Please sign in to comment.