Skip to content
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
33 changes: 31 additions & 2 deletions longbow/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ def processjobs(jobs):
for job in [a for a in jobs if "lbowconf" not in a]:

filelist = []
appplugins = getattr(apps, "PLUGINEXECS")
app = appplugins[os.path.basename(jobs[job]["executable"])]
foundflags = []
substitution = {}

Expand Down Expand Up @@ -180,6 +178,37 @@ def processjobs(jobs):
"The local job directory '{0}' cannot be found for job '{1}'"
.format(jobs[job]["localworkdir"], job))

# Here we want to support generic executable launching. To do this
# we will switch off all checking and testing and simply upload all
# files in the job directory.
try:

appplugins = getattr(apps, "PLUGINEXECS")
app = appplugins[os.path.basename(jobs[job]["executable"])]

except KeyError:

LOG.info("The software you are using is unsupported by a plugin. "
"Longbow will attempt to submit, but will assume you are"
"supplying modules manually or have used a absolute path"
"to your executable. If you think this is in error, "
"please open a ticket on github.")

jobs[job]["upload-include"] = ""
jobs[job]["upload-exclude"] = "*.log"

# Replace the input command line with the execution command line.
jobs[job]["executableargs"] = (
jobs[job]["executable"] + " " +
" ".join(jobs[job]["executableargs"]))

LOG.info("For job '%s' - execution string: %s",
job, jobs[job]["executableargs"])

LOG.info("Processing jobs - complete.")

return

# Hook to determine command-line parameter substitutions.
try:

Expand Down
49 changes: 49 additions & 0 deletions tests/unit/applications/test_processjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,52 @@ def test_processjobs_include(m_validator, m_proccommandline):

assert jobs["jobone"]["upload-include"] == \
"test.file, input, coords, topol"


def test_processjobs_genericexec1():

"""
Test that the generic executable case works with hard path
"""

jobs = {
"jobone": {
"executableargs": ["-f", "input", "-c", "file", "-p", "test"],
"localworkdir": os.getcwd(),
"executable": "/opt/somesoftware/exec",
"upload-include": "",
"upload-exclude": ""
}
}

processjobs(jobs)

assert jobs["jobone"]["executableargs"] == \
"/opt/somesoftware/exec -f input -c file -p test"
assert jobs["jobone"]["upload-include"] == ""
assert jobs["jobone"]["upload-exclude"] == "*.log"


def test_processjobs_genericexec2():

"""
Test that the generic executable case works with module and exec only.
"""

jobs = {
"jobone": {
"executableargs": ["-f", "input", "-c", "file", "-p", "test"],
"localworkdir": os.getcwd(),
"executable": "testexec",
"upload-include": "",
"upload-exclude": "",
"modules": "testsoftware"
}
}

processjobs(jobs)

assert jobs["jobone"]["executableargs"] == \
"testexec -f input -c file -p test"
assert jobs["jobone"]["upload-include"] == ""
assert jobs["jobone"]["upload-exclude"] == "*.log"