FLINK-5911: Orchestrator cleanup in status.py (PR 4/4)#4286
Conversation
…, BaseException]] Addresses nemacysts review comment on PR #4285.
Removes direct imports of get_flink_config/overview/jobs_from_paasta_api_client and calls them via flink_tools.* — consistent with all other flink helpers.
These are called cross-module from status.py so the _ prefix is misleading. Addresses nemacysts review comment on PR #4285.
Addresses nemacysts review comment on PR #4285.
…mport Initializes dashboard_url/overview/jobs/job_ids/checkpoint_data upfront and groups all API fetch calls (config, overview, jobs, checkpoints) inside a single if-running block. Removes FlinkJobs import and FlinkJobs() fallback.
…oint_data optional job_ids was never used inside the function (job IDs are accessed via job["jid"]). checkpoint_data defaults to None so callers don't need to pass an empty dict.
Covers verbose job ID display, 3-job non-verbose limit, verbose shows all jobs, failed state color, checkpoint/restart display, and None dashboard_url guard.
There was a problem hiding this comment.
Pull request overview
Final cleanup for FLINK-5911 (part 4/4): completes the refactor so status.py is primarily orchestration while Flink-specific logic (formatting + async fetch helpers) lives in flink_tools.py.
Changes:
- Made Flink job detail/checkpoint fetch helpers public (
fetch_flink_job_details,fetch_flink_job_checkpoints) and adjusted call sites accordingly. - Simplified
format_flink_jobs_table()signature (removed unusedjob_ids, madecheckpoint_dataoptional with aNonedefault). - Added focused unit tests for
format_flink_jobs_table()rendering behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
paasta_tools/flink_tools.py |
Publicizes fetch helpers; simplifies jobs table formatter signature; minor refactor in should_job_info_be_shown. |
paasta_tools/cli/cmds/status.py |
Consolidates Flink API calls behind flink_tools.* and simplifies orchestration/variable initialization. |
tests/test_flink_tools.py |
Adds a new test class covering job table formatting behaviors and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
paasta_tools/cli/cmds/status.py
Outdated
| except Exception: | ||
| pass # checkpoints are informational, don't fail status | ||
|
|
||
| job_details = flink_tools.collect_flink_job_details(status, overview, []) |
There was a problem hiding this comment.
collect_flink_job_details() accepts a jobs list and returns it in the details dict, but this call always passes [] even though jobs has just been fetched. Consider passing the jobs variable here (or, if jobs are intentionally unused in the details struct, remove the jobs parameter from collect_flink_job_details to avoid misleading call sites).
The jobs field in FlinkJobDetailsDict was stored but never read back — format_flink_jobs_table receives jobs directly from status.py. Addresses nemacysts review comment on PR #4286.
nemacysts
left a comment
There was a problem hiding this comment.
less code in status.py is always nice :D
Ticket: https://jira.yelpcorp.com/browse/FLINK-5911
Part 4 of 4. Final cleanup — all Flink logic now lives in `flink_tools.py`; `status.py` is a thin orchestrator.
Also addresses feedback from PR 3 (#4285):
Changes
`paasta_tools/flink_tools.py`
`paasta_tools/cli/cmds/status.py`
`tests/test_flink_tools.py`