Skip to content
Snippets Groups Projects
Commit 58968c2c authored by Brittany Faciane's avatar Brittany Faciane
Browse files

Merge branch 'fixDataTools' into 'main'

WS-1392: Fix indentation bug.

See merge request !1472
parents f62bfd99 17cdebe1
No related branches found
No related tags found
1 merge request!1472WS-1392: Fix indentation bug.
Pipeline #12100 passed
...@@ -67,9 +67,9 @@ def parser() -> argparse.ArgumentParser: ...@@ -67,9 +67,9 @@ def parser() -> argparse.ArgumentParser:
help="Two strings representing beginning and end date to search by.", help="Two strings representing beginning and end date to search by.",
) )
search_group.add_argument( search_group.add_argument(
"--fsid", "--external-name",
action="store", action="store",
help="A string representing the FSID to search by", help="A string representing the external name to search by",
) )
search_group.add_argument( search_group.add_argument(
"--configuration", "--configuration",
...@@ -149,7 +149,7 @@ def main(): ...@@ -149,7 +149,7 @@ def main():
args.comment = input(prompt) args.comment = input(prompt)
# Find the initial execution blocks, use them to find all relevant science product locators and proceed # Find the initial execution blocks, use them to find all relevant science product locators and proceed
ebs = get_exec_blocks(args.project_code, args.date_range, args.fsid, args.band, args.configuration, conn) ebs = get_exec_blocks(args.project_code, args.date_range, args.external_name, args.band, args.configuration, conn)
all_spls = get_all_spls_from_exec_blocks(ebs, conn) all_spls = get_all_spls_from_exec_blocks(ebs, conn)
if args.create: if args.create:
create_comments(all_spls, args.comment, args.problem_severity, args.problem_type, conn) create_comments(all_spls, args.comment, args.problem_severity, args.problem_type, conn)
...@@ -158,7 +158,7 @@ def main(): ...@@ -158,7 +158,7 @@ def main():
elif args.modify: elif args.modify:
if not args.old_comment: if not args.old_comment:
prompt = "Please type the old comment you wish to modify:\n" prompt = "Please type the old comment you wish to modify:\n"
args.old_comment = input(prompt) args.old_comment = input(prompt)
modify_comments(all_spls, args.comment, args.old_comment, args.problem_severity, args.problem_type, conn) modify_comments(all_spls, args.comment, args.old_comment, args.problem_severity, args.problem_type, conn)
conn.commit() conn.commit()
......
...@@ -24,13 +24,13 @@ def retrieve_problem_severities(connection): ...@@ -24,13 +24,13 @@ def retrieve_problem_severities(connection):
rows = cur.fetchall() rows = cur.fetchall()
return rows return rows
def get_exec_blocks(project_code, date_range, fsid, band, configuration, connection): def get_exec_blocks(project_code, date_range, external_name, band, configuration, connection):
""" """
Finds all execution blocks associated with a user's query by building and executing a SQL query Finds all execution blocks associated with a user's query by building and executing a SQL query
:param project_code: a string corresponding to the project_code field in the database :param project_code: a string corresponding to the project_code field in the database
:param date_range: a tuple corresponding to the starttime and endtime fields in the database :param date_range: a tuple corresponding to the starttime and endtime fields in the database
:param fsid: a string corresponding to the external name field in the database :param external_name: a string corresponding to the external name field in the database
:param band: a string corresponding to the band field in the database :param band: a string corresponding to the band field in the database
:param configuration: a string corresponding to the configuration field in the database :param configuration: a string corresponding to the configuration field in the database
:param connection: a MDDBConnector object to interface with the database :param connection: a MDDBConnector object to interface with the database
...@@ -39,13 +39,13 @@ def get_exec_blocks(project_code, date_range, fsid, band, configuration, connect ...@@ -39,13 +39,13 @@ def get_exec_blocks(project_code, date_range, fsid, band, configuration, connect
# Format WHERE clauses with provided search pieces # Format WHERE clauses with provided search pieces
project_code = f"project_code='{project_code}' AND " if project_code else '' project_code = f"project_code='{project_code}' AND " if project_code else ''
date_range = f"starttime>={date_range[0]} AND endtime<={date_range[1]} AND " if date_range else '' date_range = f"starttime>={date_range[0]} AND endtime<={date_range[1]} AND " if date_range else ''
fsid = f"external_name='{fsid}' AND " if fsid else '' external_name = f"external_name='{external_name}' AND " if external_name else ''
configuration = f"configuration='{configuration}' AND " if configuration else '' configuration = f"configuration='{configuration}' AND " if configuration else ''
band = f"band='{band}'" if band else '' band = f"band='{band}'" if band else ''
search_command = f"SELECT execution_block_id, execution_blocks.science_product_locator FROM execution_blocks \ search_command = f"SELECT execution_block_id, execution_blocks.science_product_locator FROM execution_blocks \
INNER JOIN science_products ON execution_blocks.science_product_locator=science_products.science_product_locator \ INNER JOIN science_products ON execution_blocks.science_product_locator=science_products.science_product_locator \
WHERE {project_code}{configuration}{date_range}{fsid}{band}" WHERE {project_code}{configuration}{date_range}{external_name}{band}"
# Remove trailing ANDs, if necessary # Remove trailing ANDs, if necessary
if search_command[-4:] == 'AND ': if search_command[-4:] == 'AND ':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment