diff options
author | Guillaume Tucker <guillaume.tucker@collabora.com> | 2018-02-08 11:57:57 +0000 |
---|---|---|
committer | Guillaume Tucker <guillaume.tucker@collabora.com> | 2018-02-23 09:46:08 +0000 |
commit | 785a84e5c447b718eeb74af3bec2a9b5b41847e0 (patch) | |
tree | 8fb89dbcaffb97998e445916c1e06256893a4483 /lava-v2-jobs-from-api.py | |
parent | a9f19fe1c52386f5764e139b05db55de05cc12bd (diff) |
lava-v2-jobs-from-api.py: add --builds to read local JSON file
Add the --builds option to read a local JSON file containing the
builds meta-data rather than polling the KernelCI API. This is
especially useful for builds and boots that are not being stored in
the backend, such as bisection iterations which use many unique builds
that get booted only once.
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Diffstat (limited to 'lava-v2-jobs-from-api.py')
-rwxr-xr-x | lava-v2-jobs-from-api.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lava-v2-jobs-from-api.py b/lava-v2-jobs-from-api.py index c6923c0..ff31868 100755 --- a/lava-v2-jobs-from-api.py +++ b/lava-v2-jobs-from-api.py @@ -349,18 +349,26 @@ def main(args): token = config.get('token') api = config.get('api') storage = config.get('storage') + builds_json = config.get('builds') + + print("Working on kernel {}/{}".format( + config.get('tree'), config.get('branch'))) - if not token: - raise Exception("No KernelCI API token provided") - if not api: - raise Exception("No KernelCI API URL provided") if not storage: raise Exception("No KernelCI storage URL provided") - print("Working on kernel {}/{}".format( - config.get('tree'), config.get('branch'))) + if builds_json: + print("Getting builds from {}".format(builds_json)) + with open(builds_json) as json_file: + builds = json.load(json_file) + else: + print("Getting builds from KernelCI API") + if not token: + raise Exception("No KernelCI API token provided") + if not api: + raise Exception("No KernelCI API URL provided") + builds = get_builds(api, token, config) - builds = get_builds(api, token, config) print("Number of builds: {}".format(len(builds))) jobs = get_jobs_from_builds(config, builds) @@ -379,6 +387,8 @@ if __name__ == '__main__': help="KernelCI API URL") parser.add_argument("--storage", help="KernelCI storage URL") + parser.add_argument("--builds", + help="Path to a JSON file to use rather than the API") parser.add_argument("--lab", required=True, help="KernelCI Lab Name") parser.add_argument("--jobs", |