Skip to content

Commit

Permalink
python: return parsed jobspec from validate_jobspec()
Browse files Browse the repository at this point in the history
Problem: flux.job.Jobspec.validate_jobspec() throws away the parsed
jobspec object if validation is successful. However, it could be
useful to return the resulting jobspec object.

Return a tuple of (result, jobspec) from validate_jobspec().
  • Loading branch information
grondo committed Dec 13, 2024
1 parent c6c2b31 commit a5543b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bindings/python/flux/job/Jobspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ def validate_jobspec(jobspec, require_version=None):
return (1, "Unable to parse JSON")
_validate_keys(Jobspec.top_level_keys, jobspec_obj.keys())
if require_version == 1 or jobspec_obj.get("version", 0) == 1:
JobspecV1(**jobspec_obj)
jobspec = JobspecV1(**jobspec_obj)
else:
Jobspec(**jobspec_obj)
return True
jobspec = Jobspec(**jobspec_obj)
return True, jobspec


class Jobspec(object):
Expand Down

0 comments on commit a5543b9

Please sign in to comment.