Skip to content

Commit b65d1a6

Browse files
committed
Added/tweaked logging
1 parent 0a6545f commit b65d1a6

File tree

8 files changed

+21
-12
lines changed

8 files changed

+21
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ start_env.sh
2424
*secrets*
2525
*kustomization*
2626
src/.venv/
27+
src/server/secrets_dict.py
28+

src/server/api/.optic/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/server/api/API_ingest/ingest_sources_from_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def start():
1010
logger.debug(" Finished fetching Salesforce contacts")
1111

1212
logger.debug(" Fetching Shelterluv people")
13-
shelterluv_people.store_shelterluv_people_all()
14-
logger.debug(" Finished fetching Shelterluv people")
13+
slp_count = shelterluv_people.store_shelterluv_people_all()
14+
logger.debug(" Finished fetching Shelterluv people - %d records" , slp_count)
1515

1616
logger.debug(" Fetching Shelterluv events")
1717
sle_count = sl_animal_events.store_all_animals_and_events()

src/server/api/API_ingest/salesforce_contacts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def store_contacts_all():
1818
logger.debug("retrieving the latest salesforce contacts data")
1919
sf = Salesforce(domain=os.getenv('SALESFORCE_DOMAIN'), password=os.getenv('SALESFORCE_PW'), username=os.getenv('SALESFORCE_USERNAME'), security_token=os.getenv('SALESFORCE_SECURITY_TOKEN'))
2020
results = sf.query("SELECT Contact_ID_18__c, FirstName, LastName, Contact.Account.Name, MailingCountry, MailingStreet, MailingCity, MailingState, MailingPostalCode, Phone, MobilePhone, Email FROM Contact")
21+
logger.debug("Query returned %d Salesforce contact records", len(results['records']) )
22+
2123
done = False
2224
while not done:
2325
for row in results['records']:

src/server/api/API_ingest/shelterluv_people.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def store_shelterluv_people_all():
7070
animal_ids=person["Animal_ids"]))
7171
offset += LIMIT
7272
has_more = response["has_more"] if not TEST_MODE else response["has_more"] and offset < 1000
73+
if offset % 1000 == 0:
74+
logger.debug("Reading offset %s", str(offset))
7375
session.commit()
7476

75-
logger.debug("Finish getting shelterluv contacts from people table")
77+
logger.debug("Finished getting shelterluv contacts from people table")
78+
return offset
7679

src/server/api/admin_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ def start_job():
224224

225225
if running_job :
226226
# There was a running job already
227-
logger.warn("Request to start job, but job_id " + str(running_job) + " already executing")
227+
logger.warn("Request to start job, but job_id %s already executing", str(running_job))
228228
return None
229229
else:
230-
logger.info("Assigned job_id %s" + str(job_id ) )
230+
logger.info("Assigned job_id %s" , str(job_id ) )
231231
return job_id
232232

233233

src/server/pipeline/flow_script.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,26 @@ def start_flow():
6767
# 6. Update each row in pdp_contacts to give it a match id
6868
# corresponding to its connected componenet.
6969

70-
logger.info("Clearing pdp_contacts to prepare for match")
70+
logger.debug("Clearing pdp_contacts to prepare for match")
7171
reset_pdp_contacts_with_unmatched(conn)
7272

73-
logger.info("Computing matches")
73+
logger.debug("Computing automatic matches")
7474
automatic_matches = get_automatic_matches(conn)
75+
logger.debug("Computing manual matches")
7576
manual_matches = get_manual_matches(conn)
7677

7778
match_graph = Graph()
79+
logger.debug("Adding automatic matches to graph")
7880
match_graph.add_edges_from(automatic_matches)
81+
logger.debug("Adding manual matches to graph")
7982
match_graph.add_edges_from(manual_matches)
83+
logger.debug("Processing graph")
8084
match_groups = connected_components(match_graph)
8185

82-
logger.info("Updating pdp_contacts with match ids")
86+
logger.debug("Updating pdp_contacts with match ids")
8387
update_matching_ids(match_groups, conn)
8488

85-
logger.info("Finished flow script run")
89+
logger.debug("Finished flow script run")
8690
job_outcome = "completed"
8791
log_db.log_exec_status(job_id, "flow", "complete", "")
8892

src/server/shifts_importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def validate_import_vs(filename, conn):
130130
# parent will commit. Don't commit here!
131131

132132

133-
logger.info("Total rows: %s Dupes: %s Missing volgistics id: ", str(row_count), str(dupes), str(missing_volgistics_id) )
133+
logger.info("Total rows: %s Dupes: %s Missing volgistics id: %s", str(row_count), str(dupes), str(missing_volgistics_id) )
134134
logger.info("Other integrity exceptions: %s Other exceptions: %s", str(other_exceptions), str(other_integrity) )
135135
wb.close()
136136
return { True : "File imported" }

0 commit comments

Comments
 (0)