Skip to content

Commit 88bdda5

Browse files
committed
Fixes after testing
1 parent 8a5efb5 commit 88bdda5

File tree

3 files changed

+53
-40
lines changed

3 files changed

+53
-40
lines changed

Longbow/corelibs/applications.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,22 @@ def processjobs(jobs):
213213
flags = list(set(execdata["requiredfiles"]) - set(foundflags))
214214

215215
# If there are any missing still then tell the user.
216-
if len(flags) is not 0:
216+
if len(flags) > 0:
217+
218+
# Firstly is this due to it being an either type flag?
219+
for flag in flags:
220+
221+
if "||" in flag:
222+
223+
tmpflags = flag.split(" || ")
224+
tmpflag = list(set(tmpflags).intersection(set(foundflags)))
225+
226+
if len(tmpflag) > 0:
227+
228+
flags.remove(flag)
229+
230+
# If there are any missing still then tell the user.
231+
if len(flags) > 0:
217232

218233
raise exceptions.RequiredinputError(
219234
"In job '{0}' there are missing flags on the command line "
@@ -239,16 +254,8 @@ def processjobs(jobs):
239254
LOG.info("For job '%s' - execution string: %s",
240255
job, jobs[job]["executableargs"])
241256

242-
print "filelist = ", filelist
243-
print "includes = ", jobs[job]["upload-include"]
244-
print "excludes = ", jobs[job]["upload-exclude"]
245-
print "execargs = ", jobs[job]["executableargs"]
246-
247257
LOG.info("Processing jobs - complete.")
248258

249-
import sys
250-
sys.exit()
251-
252259

253260
def _proccommandlinetype1(job, app, cwd, filelist):
254261

@@ -290,9 +297,11 @@ def _proccommandlinetype1(job, app, cwd, filelist):
290297
# We have a replicate job so we should amend the paths.
291298
else:
292299

293-
fileitem, filelist = _procreplicatejobs(
300+
fileitem, filelist, initargs = _procreplicatejobs(
294301
app, args[1], cwd, fileitem, filelist, initargs, rep)
295302

303+
job["executableargs"] = initargs
304+
296305
# If the next argument along is a valid file.
297306
if os.path.isfile(os.path.join(cwd, fileitem)):
298307

@@ -371,9 +380,11 @@ def _proccommandlinetype2(job, app, cwd, filelist):
371380
# Otherwise we have a replicate job so check these.
372381
else:
373382

374-
fileitem, filelist = _procreplicatejobs(
383+
fileitem, filelist, initargs = _procreplicatejobs(
375384
app, arg, cwd, fileitem, filelist, initargs, rep)
376385

386+
job["executableargs"] = initargs
387+
377388
# If we have a valid file
378389
if os.path.isfile(os.path.join(cwd, fileitem)):
379390

@@ -440,9 +451,11 @@ def _proccommandlinetype3(job, app, cwd, filelist):
440451
# Otherwise we have a replicate job so check these.
441452
else:
442453

443-
fileitem, filelist = _procreplicatejobs(
454+
fileitem, filelist, initargs = _procreplicatejobs(
444455
app, arg, cwd, fileitem, filelist, initargs, rep)
445456

457+
job["executableargs"] = initargs
458+
446459
# If we have a valid file
447460
if os.path.isfile(os.path.join(cwd, fileitem)):
448461

@@ -500,9 +513,11 @@ def _proccommandlinetype4(job, app, cwd, filelist):
500513
# Otherwise we have a replicate job so we should amend the paths.
501514
else:
502515

503-
fileitem, filelist = _procreplicatejobs(
516+
fileitem, filelist, initargs = _procreplicatejobs(
504517
app, args[0], cwd, fileitem, filelist, initargs, rep)
505518

519+
job["executableargs"] = initargs
520+
506521
# If we have something to load then check that it is a valid file.
507522
if os.path.isfile(os.path.join(cwd, fileitem)):
508523

@@ -551,7 +566,8 @@ def _procsinglejob(app, arg, cwd):
551566

552567
try:
553568

554-
fileitem = getattr(apps, app.lower()).defaultfilename(cwd, arg)
569+
fileitem, _ = getattr(
570+
apps, app.lower()).defaultfilename(cwd, arg, "")
555571

556572
except AttributeError:
557573

@@ -600,8 +616,8 @@ def _procreplicatejobs(app, arg, cwd, fileitem, filelist, initargs, rep):
600616

601617
try:
602618

603-
tmpitem = getattr(apps, app.lower()).defaultfilename(
604-
cwd, os.path.join("rep" + str(rep) + arg))
619+
tmpitem, _ = getattr(apps, app.lower()).defaultfilename(
620+
cwd, os.path.join("rep" + str(rep) + arg), "")
605621

606622
except AttributeError:
607623

@@ -617,15 +633,11 @@ def _procreplicatejobs(app, arg, cwd, fileitem, filelist, initargs, rep):
617633

618634
try:
619635

620-
fileitem = getattr(apps, app.lower()).defaultfilename(cwd, arg)
621-
622-
# Also update the command line to reflect a global file.
623-
if fileitem is not "" and arg in initargs:
624-
625-
initargs[initargs.index(arg)] = os.path.join("../", arg)
636+
fileitem, initargs = getattr(
637+
apps, app.lower()).defaultfilename(cwd, arg, initargs)
626638

627639
except AttributeError:
628640

629641
pass
630642

631-
return fileitem, filelist
643+
return fileitem, filelist, initargs

Longbow/longbow

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,15 @@ def main():
161161
execlist = getattr(apps, "EXECLIST")
162162

163163
# Search for recognised executables on the commandline
164-
for exe in execlist:
164+
for item in commandlineargs:
165165

166-
if exe in commandlineargs:
166+
if item in execlist:
167167

168-
if commandlineargs.count(exe) == 1:
169-
170-
executable = exe
171-
position = commandlineargs.index(exe)
172-
longbowargs = commandlineargs[:position]
173-
execargs = commandlineargs[position+1:]
174-
break
175-
176-
else:
177-
178-
raise exceptions.CommandlineargsError(
179-
"More than one recognised executable has been specified on"
180-
" the Longbow command line. Please provide just one.")
168+
executable = item
169+
position = commandlineargs.index(item)
170+
longbowargs = commandlineargs[:position]
171+
execargs = commandlineargs[position+1:]
172+
break
181173

182174
# If an executable wasn't found perhaps it is specified in a configuration
183175
# file. Executable arguments might still be provided on the command line so

Longbow/plugins/apps/gromacs.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
}
5151

5252

53-
def defaultfilename(path, item):
53+
def defaultfilename(path, item, initargs):
5454

5555
"""Method for dealing with input files that are provided by the -deffnm
5656
flag. The reason this needs a special message is due to the fact that
@@ -64,4 +64,13 @@ def defaultfilename(path, item):
6464

6565
filename = item + ".tpr"
6666

67-
return filename
67+
if initargs != "":
68+
69+
if "-s" not in initargs and "-deffnm" in initargs:
70+
71+
index = initargs.index("-deffnm")
72+
73+
initargs.insert(index, os.path.join("../", filename))
74+
initargs.insert(index, "-s")
75+
76+
return filename, initargs

0 commit comments

Comments
 (0)