-
Notifications
You must be signed in to change notification settings - Fork 3
Add /monitor-job command and optimize /jobs with smart caching #39
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
Conversation
chuck_data/commands/monitor_job.py
Outdated
| message += f"\nCredits: {credits}" | ||
| return CommandResult(True, message=message, data=job_data) | ||
|
|
||
| if normalized_state in ["failed", "error"]: |
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.
The backend can return :unauthorized we should have if normalized_state in ["failed", "error", "unauthorized"]:
pragyan-amp
left a 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.
Overall it looks great.. I have added my comments... Most critical one being adding support to escape them monitoring command when it is running... rest are just small things... Approving it to merge.. ![]()
9de6d12 to
04beb50
Compare
- Add `/monitor-job` command for real-time job monitoring - Monitors Chuck jobs until completion with live progress updates - Shows elapsed time, record count, and credits upon completion - Calculates elapsed time from actual job start (not monitoring start) - Supports monitoring via --job-id or --run-id - Falls back to last cached job if no parameters provided - Default 30-second poll interval, 30-minute timeout - Implement smart caching for job status data - Terminal state jobs (succeeded, failed, error, unknown) served from cache - Reduces API calls from 16 to 0 for fully cached jobs - Execution time drops from ~7s to <0.1s on subsequent runs - Cache UNKNOWN state for 404/error responses to prevent retry loops - Add diagnostic logging (cache hits/misses, timing metrics) - Add "Started" date column (format: YYYY-Mon-DD HH:MM) - Sort jobs by date in descending order (most recent first) - Implement timezone-aware datetime handling for proper sorting - Display total credits used across all jobs - Extend job_cache.py to store full job data (state, records, credits, timestamps) - Add cache_job() calls for terminal states in handle_list_jobs - Remove unnecessary cached_at field (use job's own timestamps) - Add 7 comprehensive tests for /jobs caching behavior - Cache hits for terminal states - Fresh data fetching for running jobs - UNKNOWN state caching on 404/errors - Mixed cache/fetch scenarios - All 71 job status tests pass - All 8 job cache tests pass Improves developer experience with faster job listing and real-time monitoring
04beb50 to
e1864cc
Compare
Add
/monitor-jobcommand for real-time job monitoringImplement smart caching for job status data
Cache UNKNOWN state for 404/error responses to prevent retry loops
Add diagnostic logging (cache hits/misses, timing metrics)
Add "Started" date column (format: YYYY-Mon-DD HH:MM)
Sort jobs by date in descending order (most recent first)
Implement timezone-aware datetime handling for proper sorting
Display total credits used across all jobs
Extend job_cache.py to store full job data (state, records, credits, timestamps)
Add cache_job() calls for terminal states in handle_list_jobs
Remove unnecessary cached_at field (use job's own timestamps)
Add 7 comprehensive tests for /jobs caching behavior
All 71 job status tests pass
All 8 job cache tests pass
Usage:
Improves developer experience with faster job listing and real-time monitoring