aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/insert_samples.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/insert_samples.py b/scripts/insert_samples.py
index 43c6a38..6b6faf1 100644
--- a/scripts/insert_samples.py
+++ b/scripts/insert_samples.py
@@ -42,21 +42,25 @@ def insert_samples(conn: mdb.Connection,# pylint: disable=[too-many-arguments]
firstlineheading: bool,
quotechar: str):
"""Insert the samples into the database."""
+ print("Checking for errors:")
species = species_by_id(conn, speciesid)
if not bool(species):
logging.error("Species with id '%s' does not exist.", str(speciesid))
return 1
+ print(f"\tSpecies with ID '{speciesid}' found")
population = population_by_id(conn, populationid)
if not bool(population):
logging.error("Population with id '%s' does not exist.",
str(populationid))
return 1
- logging.info("Inserting samples ...")
+ print(f"\tPopulations with ID '{populationid}' found")
+ print("No errors found. Continuing...")
+ print("\nInserting samples ...")
save_samples_data(
conn,
speciesid,
read_samples_file(samplesfile, separator, firstlineheading))
- logging.info("Cross-referencing samples with their populations.")
+ print("Cross-referencing samples with their populations.")
cross_reference_samples(
conn,
speciesid,
@@ -66,7 +70,7 @@ def insert_samples(conn: mdb.Connection,# pylint: disable=[too-many-arguments]
separator,
firstlineheading,
quotechar=quotechar)))
-
+ print("Samples upload successfully completed.")
return 0
if __name__ == "__main__":
@@ -133,8 +137,6 @@ if __name__ == "__main__":
with (Redis.from_url(args.redisuri, decode_responses=True) as rconn,
database_connection(args.databaseuri) as dbconn):
- print("We got here...")
- print(args)
return insert_samples(dbconn,
rconn,
args.speciesid,