175 Assumes script name has been removed from the list of arguments.
176 Hence, arguments[0] is the subcommand.
179 top_level_parser.add_argument(
"--db", type=str, required=
False, default=
"frontier://FrontierProd/CMS_CONDITIONS")
180 top_level_parser.add_argument(
"--mode", type=str, required=
False, default=
"w")
181 top_level_parser.add_argument(
"--secrets", type=str, required=
False)
182 top_level_parser.add_argument(
"--limit", type=int, required=
False, default=10)
184 subparser = top_level_parser.add_subparsers(title=
"Subcommands")
186 list_parser = subparser.add_parser(
"list", description=
"Lists the Metadata objects contained within the given object.")
187 list_parser.add_argument(
"--tag", required=
False, help=
"List all IOVs in a Tag.")
188 list_parser.add_argument(
"--gt", required=
False, help=
"List all Global Tag Maps linked to a Global Tag.")
189 list_parser.add_argument(
"--gts-for-tag", required=
False, help=
"List all Global Tags that contain a Tag.")
191 list_parser.set_defaults(func=list_object)
193 diff_parser = subparser.add_parser(
"diff-tags", description=
"Gives the differences in payload hashes used by IOVs between Tags.")
194 diff_parser.add_argument(
"--tag1", required=
True, help=
"First Tag to use in the comparison.")
195 diff_parser.add_argument(
"--tag2", required=
True, help=
"Second Tag to use in the comparison.")
197 diff_parser.set_defaults(func=diff_of_tags)
199 gt_diff_parser = subparser.add_parser(
"diff-gts", description=
"Gives the differences in Global Tag Maps contained within Global Tag.")
200 gt_diff_parser.add_argument(
"--gt1", required=
True, help=
"First Global Tag to use in the comparison.")
201 gt_diff_parser.add_argument(
"--gt2", required=
True, help=
"Second Global Tag to use in the comparison.")
203 gt_diff_parser.set_defaults(func=diff_of_gts)
205 copy_tag_parser = subparser.add_parser(
"copy-tag", description=
"Copies a Tag with its IOVs and Payloads to a destination database."
206 +
"\nFor copying to official databases, use cmsDbCondUpload (https://cms-conddb-dev.cern.ch/cmsDbCondUpload).")
207 copy_tag_parser.add_argument(
"--dest-db", required=
True, help=
"Database to copy the Tag and its IOVs to.")
208 copy_tag_parser.add_argument(
"--input-tag", required=
True, help=
"Tag to take data from in source database.")
209 copy_tag_parser.add_argument(
"--dest-tag", required=
True, help=
"Tag to copy input Tag to in the destination database.")
210 copy_tag_parser.add_argument(
"--start", required=
True, help=
"Since to start from. If this is between two, the highest one is taken (no adjustments are made).")
211 copy_tag_parser.add_argument(
"--end", required=
True, help=
"Since to finidh at. If this is between two, the lowest one is taken (no adjustments are made).")
213 copy_tag_parser.set_defaults(func=copy_tag)
215 parsed_arguments = top_level_parser.parse_args()
217 print(
"Using database '%s'." % parsed_arguments.db)
219 parsed_arguments.func(parsed_arguments)