Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikuoja committed Nov 22, 2024
1 parent a2945c9 commit 25af8f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions database/ryhti_client/ryhti_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def __init__(
plan_uuid: Optional[str] = None,
debug_json: Optional[bool] = False, # save JSON files for debugging
) -> None:
LOGGER.info("Initializing Ryhti client...")
self.event_type = event_type
self.debug_json = debug_json

Expand Down Expand Up @@ -267,17 +268,16 @@ def __init__(
# Otherwise, we may access old plan data without having to create a session
# and query.
with self.Session(expire_on_commit=False) as session:
LOGGER.info("Caching requested plans from database...")
# Only process specified plans
plan_query: Query = session.query(models.Plan)
if plan_uuid:
LOGGER.info(f"Only fetching plan {plan_uuid}")
plan_query = plan_query.filter_by(id=plan_uuid)
self.plans = {plan.id: plan for plan in plan_query.all()}
print(plan_query.all())
if not self.plans:
print("no plans")
LOGGER.info("No plans found in database.")
else:
print("got plans")
LOGGER.info("Client initialized with plans to process:")
LOGGER.info(self.plans)

Expand Down

0 comments on commit 25af8f7

Please sign in to comment.