Skip to content

Commit 1390c6a

Browse files
committed
wip to fix small issues with submit and fluxjobs
Signed-off-by: vsoch <[email protected]>
1 parent d894600 commit 1390c6a

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ The versions coincide with releases on pip. Only major versions will be released
1515

1616
## [0.0.x](https://github.com/flux-framework/flux-restful-api/tree/main) (0.0.x)
1717
- Fixing bug with launcher always being specified (0.0.1)
18+
- catching any errors on creation of fluxjob
1819
- Project (faux) skeleton release (0.0.0)

app/library/flux.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def prepare_job(kwargs, runtime=0, workdir=None, envars=None):
7777
del kwargs[key]
7878

7979
# Assemble the flux job!
80+
print(f"⭐️ Keyword arguments for flux jobspec: {kwargs}")
8081
fluxjob = flux.job.JobspecV1.from_command(command, **kwargs)
8182
for option, value in option_flags.items():
8283
print(f"⭐️ Setting shell option: {option}={value}")

app/routers/api.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,11 @@ async def submit_job(request: Request):
187187
message = launcher.launch(kwargs, workdir=workdir, envars=envars)
188188
result = jsonable_encoder({"Message": message, "id": "MANY"})
189189
else:
190-
# Prepare the flux job!
191-
fluxjob = flux_cli.prepare_job(
192-
kwargs, runtime=runtime, workdir=workdir, envars=envars
193-
)
194-
# Submit the job and return the ID, but allow for error
190+
# Prepare and submit the job and return the ID, but allow for error
195191
try:
192+
fluxjob = flux_cli.prepare_job(
193+
kwargs, runtime=runtime, workdir=workdir, envars=envars
194+
)
196195
flux_future = flux.job.submit_async(app.handle, fluxjob)
197196
except Exception as e:
198197
result = jsonable_encoder(

app/routers/views.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,12 @@ def submit_job_helper(request, app, form):
139139
"""
140140
A helper to submit a flux job (not a launcher)
141141
"""
142-
143-
# Prepare the flux job! We don't support envars here yet
144-
fluxjob = flux_cli.prepare_job(
145-
form.kwargs, runtime=form.runtime, workdir=form.workdir
146-
)
147-
148142
# Submit the job and return the ID, but allow for error
149143
try:
144+
# Prepare the flux job! We don't support envars here yet
145+
fluxjob = flux_cli.prepare_job(
146+
form.kwargs, runtime=form.runtime, workdir=form.workdir
147+
)
150148
flux_future = flux.job.submit_async(app.handle, fluxjob)
151149
jobid = flux_future.get_id()
152150
intid = int(jobid)

templates/jobs/submit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h3>Submit a Job</h3>
6161
<div class="mb-3">
6262
<label for="workdir" class="form-label">Option Flags</label>
6363
<input class="form-control" {% if form.option_flags %}value="{{ form.option_flags }}"{% endif %} name="option_fags" id="option_flags" aria-describedby="optionFlagsHelp">
64-
<div id="optionFlagsHelp" class="form-text">One off option flags, space separated (e.g.,) -ompi=openmpi@5 (optional).</div>
64+
<div id="optionFlagsHelp" class="form-text">One off option flags, space separated (e.g., -ompi=openmpi@5) (optional).</div>
6565
</div>
6666
<div class="mb-3 form-check">
6767
<input type="checkbox" class="form-check-input" name="exclusive" {% if form.exclusive %}checked{% endif %} id="exclusive" aria-describedby="exclusiveHelp">

0 commit comments

Comments
 (0)