Skip to content

Commit

Permalink
[FLOAT-4537] Failed to execute user binary.
Browse files Browse the repository at this point in the history
When we update the LD_LIBRARY_PATH, it may also affect the user
executables.

So instead of updating the environment variable, use a function
to redirect the call to our aws cli when it is not found in the path.
  • Loading branch information
jealous committed Sep 25, 2024
1 parent cce3f14 commit 9784a20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ class FloatGridExecutor extends AbstractGridExecutor {
if (floatConf.s3cred.isValid()) {
// if we have s3 credential, make sure aws cli is available in path
result += floatConf.s3cred.getExportS3CredScript(getRunName())
result += "export PATH=\$PATH:/opt/aws/dist\n"
result += "export LD_LIBRARY_PATH=\$LIBRARY_PATH:/opt/aws/dist\n"
result += '''
if ! command -v aws >/dev/null 2>&1 && ! type aws >/dev/null 2>&1; then
aws() {
LD_LIBRARY_PATH=/opt/aws/dist:\$LD_LIBRARY_PATH /opt/aws/dist/aws \$@
}
fi
'''
}
return result
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/nf-float/src/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Plugin-Class: com.memverge.nextflow.FloatPlugin
Plugin-Id: nf-float
Plugin-Version: 0.4.5
Plugin-Version: 0.4.6
Plugin-Provider: MemVerge Corp.
Plugin-Requires: >=23.04.0
16 changes: 6 additions & 10 deletions plugins/nf-float/src/test/com/memverge/nextflow/GlobalTest.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.memverge.nextflow

import nextflow.processor.TaskConfig

import java.nio.file.Paths

class GlobalTest extends FloatBaseTest {
def "get env var. of any names"() {
given:
Expand Down Expand Up @@ -68,7 +64,7 @@ class GlobalTest extends FloatBaseTest {
given:
setEnv("AWS_ACCESS_KEY", "A")
setEnv("AWS_SECRET_KEY", "B")
def config = [aws:[]]
def config = [aws: []]

when:
def res = Global.getAwsCredentials(config)
Expand Down Expand Up @@ -97,7 +93,7 @@ class GlobalTest extends FloatBaseTest {
def "retrieve aws credentials from system env, with token"() {
given:
setAwsEnvs()
def config = [aws:[]]
def config = [aws: []]

when:
def res = Global.getAwsCredentials(config)
Expand All @@ -114,11 +110,11 @@ class GlobalTest extends FloatBaseTest {
def "update arg map with aws credential"() {
given:
setAwsEnvs()
def config = [aws:[]]
def config = [aws: []]

when:
def res = Global.getAwsCredentials(config)
def argMap = res.updateMap(['banana':'apple'])
def argMap = res.updateMap(['banana': 'apple'])

then:
res.isValid() == true
Expand All @@ -134,7 +130,7 @@ class GlobalTest extends FloatBaseTest {
def "update env map with aws credential"() {
given:
setAwsEnvs()
def config = [aws:[]]
def config = [aws: []]

when:
def res = Global.getAwsCredentials(config)
Expand All @@ -160,7 +156,7 @@ class GlobalTest extends FloatBaseTest {
def script = exec.getHeaderScript(task)

then:
script.contains("PATH:/opt/aws/dist")
script.contains('/opt/aws/dist:$LD_LIBRARY_PATH')

cleanup:
clearAwsEnvs()
Expand Down

0 comments on commit 9784a20

Please sign in to comment.