From 1616a9901fd526751feadd0610d2ff22b1f375dd Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Thu, 12 Dec 2024 10:43:43 -0800 Subject: [PATCH] python: return parsed jobspec from validate_jobspec() 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(). --- src/bindings/python/flux/job/Jobspec.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bindings/python/flux/job/Jobspec.py b/src/bindings/python/flux/job/Jobspec.py index 3ba2c5073690..3564553f7a7c 100644 --- a/src/bindings/python/flux/job/Jobspec.py +++ b/src/bindings/python/flux/job/Jobspec.py @@ -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):