Skip to content

Commit

Permalink
Update version input
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmartradio committed Nov 7, 2023
1 parent b602c68 commit 79057ed
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions python/lsst/alert/packet/updateSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
"""

Expand All @@ -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):
Expand All @@ -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')

Expand Down

0 comments on commit 79057ed

Please sign in to comment.