From 79057eda96a5d636c4f5d786f3d7db774ad14272 Mon Sep 17 00:00:00 2001 From: Brianna Smart Date: Mon, 6 Nov 2023 16:24:42 -0800 Subject: [PATCH] Update version input --- python/lsst/alert/packet/updateSchema.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/python/lsst/alert/packet/updateSchema.py b/python/lsst/alert/packet/updateSchema.py index 0872e2c..9320dd6 100644 --- a/python/lsst/alert/packet/updateSchema.py +++ b/python/lsst/alert/packet/updateSchema.py @@ -147,7 +147,7 @@ def create_schema(name, field_dictionary_array, version): schema = dict(sorted(schema.items(), reverse=True)) return schema -def update_schema(apdb_filepath, update_version=False): +def update_schema(apdb_filepath, update_version=None): """Compare an avro schemas docstrings with the apdb.yaml file. If there are no docstrings, add the field. If the docstrings do @@ -161,8 +161,9 @@ def update_schema(apdb_filepath, update_version=False): Input string for the apdb.yaml file where the docstrings will be compared. - update_version: 'bool' - If True, version will be updated minor version one number. + update_version: 'string' + If a string is included, update schema to provided version. + Example: "5.1" """ @@ -176,9 +177,9 @@ def update_schema(apdb_filepath, update_version=False): apdb = yaml.safe_load(file) if update_version: - version_name = str(int(version.split(".")[0]) + 1) + "_0" + version_name = update_version.split(".")[0] + "_" + update_version.split(".")[1] else: - version_name = version.split(".")[0] + "_0" + version_name = version.split(".")[0] + "_" + version.split(".")[1] # The first 4 columns in the apdb are the ones we use for alerts for x in range(0, 4): @@ -193,9 +194,10 @@ def update_schema(apdb_filepath, update_version=False): if __name__ == '__main__': parser = argparse.ArgumentParser(description='Update the schema docstrings so that they' - 'match the docstrings in apdb.yaml. Example input:' + 'match the docstrings in apdb.yaml and include the ' + 'desired version number. Example input:' 'python3 updateSchema.py ' - '"Path/To/Yaml/sdm_schemas/yml/apdb.yaml" False') + '"Path/To/Yaml/sdm_schemas/yml/apdb.yaml" "6.0"') parser.add_argument('apdb_filepath') parser.add_argument('update_version')