Skip to content

Commit

Permalink
Allow user to omit credentials.
Browse files Browse the repository at this point in the history
Use could use `float login` to generate the credentials file.
In this case, the credentials are not required in the nextflow configuration file.
  • Loading branch information
jealous committed Oct 7, 2023
1 parent 0036d96 commit a1507e3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class FloatBin {
final Path pluginsDir = Global.getPluginsDir()
ret = pluginsDir.resolve(binName)
try {
log.info "try downloading $src to $ret"
Global.download(src, ret)
ret.setExecutable(true)
} catch (Exception ex) {
Expand Down Expand Up @@ -51,6 +52,7 @@ class FloatBin {
for (String path : paths) {
def floatPath = Paths.get(path).resolve(binName)
if (Files.exists(floatPath)) {
log.info "found float binary in $path"
return floatPath
}
}
Expand Down
21 changes: 8 additions & 13 deletions plugins/nf-float/src/main/com/memverge/nextflow/FloatConf.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FloatConf {
static final String NF_RUN_NAME = 'nextflow-io-run-name'
static final String NF_SESSION_ID = 'nextflow-io-session-id'
static final String NF_TASK_NAME = 'nextflow-io-task-name'
static final String NF_INPUT_SIZE = 'nextflow-io-input-size'
static final String NF_INPUT_SIZE = 'input-size'

/** credentials for op center */
String username
Expand Down Expand Up @@ -195,12 +195,6 @@ class FloatConf {
}

void validate() {
if (!username) {
throw new AbortOperationException("missing MMCE username")
}
if (!password) {
throw new AbortOperationException("missing MMCE password")
}
if (addresses.size() == 0) {
throw new AbortOperationException("missing MMCE OC address")
}
Expand All @@ -215,12 +209,13 @@ class FloatConf {
List<String> ret = [
bin.toString(),
"-a",
address,
"-u",
username,
"-p",
password
]
address]
if (username && password) {
ret.addAll(["-u",
username,
"-p",
password])
}
return ret
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,13 @@ class FloatGridExecutor extends AbstractGridExecutor {
throw new AbortOperationException("container is empty. " +
"you can specify a default container image " +
"with `process.container`")
} else {
log.info("got container image of the task ${container}")
}
def cmd = getSubmitCmdPrefix(task.index)
cmd << 'submit'
getMountVols(task).forEach { cmd << '--dataVolume' << it }
cmd << '--image' << task.getContainer()
cmd << '--image' << container
cmd << '--cpu' << getCpu(task).toString()
cmd << '--mem' << getMemory(task)
cmd << '--job' << getScriptFilePath(handler, scriptFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Global {
}
}
}
log.info "download ${url} to ${filename}"
log.info "downloaded ${url} to ${filename}"
// restore the factory and verifier
HttpsURLConnection.setDefaultSSLSocketFactory(dftFactory)
HttpsURLConnection.setDefaultHostnameVerifier(dftVerifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ class FloatConfTest extends BaseTest {
"-u admin -p password"
}

def "credentials are required"() {
def "address is required"() {
given:
def conf = [
float: [address: '1.2.3.4']]
float: [username: 'admin']]

when:
def fConf = FloatConf.getConf(conf)
Expand All @@ -103,6 +103,18 @@ class FloatConfTest extends BaseTest {
thrown AbortOperationException
}

def "credentials are optional"() {
given:
def conf = [float:[address:"1.2.3.4"]]

when:
def fConf = FloatConf.getConf(conf)
fConf.validate()

then:
fConf.getCliPrefix().join(' ').endsWith('float -a 1.2.3.4')
}

def "get s3 data volume"() {
given:
def conf = [
Expand Down

0 comments on commit a1507e3

Please sign in to comment.