-
Notifications
You must be signed in to change notification settings - Fork 84
updated code to save the epoch time in iso format in db #2323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
updated code to save the epoch time in iso format in db #2323
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (2)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kairon/events/definitions/analytic_pipeline_handler.py (1)
200-215: Inconsistent format between add and update operations.The
_update_schedulemethod still saves adatetimeobject toscheduler_config["schedule"](line 206), while_add_one_time_schedulenow saves an ISO string (line 129). This creates inconsistent data types in the database for the same field.To align with the PR objective of saving epoch time in ISO format, apply the same conversion here:
Proposed fix
elif expression_type == "epoch": epoch_time = int(schedule) tzinfo = ZoneInfo(timezone) if timezone else ZoneInfo("UTC") run_at = datetime.fromtimestamp(epoch_time, tzinfo) + run_at = run_at.isoformat() - scheduler_config["schedule"] = run_at + scheduler_config["schedule"] = run_at Utility.request_event_server( EventClass.analytics_pipeline, payload, method="PUT", is_scheduled=True, - run_at=run_at.isoformat(), + run_at=run_at, timezone=timezone )
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
kairon/events/definitions/analytic_pipeline_handler.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Python CI
- GitHub Check: Analyze (python)
🔇 Additional comments (2)
kairon/events/definitions/analytic_pipeline_handler.py (2)
124-129: Conversion logic looks correct.The epoch-to-ISO conversion correctly applies timezone before serialization, and storing the normalized string in config ensures consistent DB representation.
Minor note: if
run_atis neitherint/floatnor already a string (e.g., adatetimepassed directly), it will be stored and forwarded as-is. If the downstream API always expects a string, consider adding validation or a fallback conversion for other types.
134-140: LGTM!Since
run_atis already converted to an ISO string at line 127, passing it directly here avoids redundant serialization.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.