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

Allow user to omit credentials. #65

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading