Skip to content
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

Handle exessively long help text for jobs. #1802

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

thebjorn
Copy link

Currently, long (especially multi-line) text in the help = property of Job classes mess up the job listings (manage.py runjob -l):

 bizautuser        - bizautuser_process_transfer_request     - daily          - Remind BAs to process pending transfer requests after 3 days,
                or notify finaut after 5 days. Also processes queued requests.
 finlib            - run_rules_action_pnr                    - quarter_hourly - Process results that are awaiting in QM-db
 gos               - sample                                  -                - My sample job.

this PR, by default, extracts an 80 character digest and uses the rich library to output the listing as a table:

Job List: 47 jobs
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ appname           ┃ jobname                                 ┃ when           ┃ help                                                        ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ bizautuser        │ bizautuser_process_transfer_request     │ daily          │ Remind BAs to process pending transfer requests after 3     │
│                   │                                         │                │ days, or notify [...]                                       │
│ finlib            │ run_rules_action_pnr                    │ quarter_hourly │ Process results that are awaiting in QM-db                  │
│ gos               │ sample                                  │                │ My sample job.                                              │
└───────────────────┴─────────────────────────────────────────┴────────────────┴─────────────────────────────────────────────────────────────┘

or, if verbosity is set to 2 or higher (manage.py runjob -l -v2) outputs the entire help text, but formatted a little better:

Job List: 47 jobs
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ appname           ┃ jobname                                 ┃ when           ┃ help                                                              ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ bizautrules       │ advisors_missing_updates                │ daily          │ Find all users who is missing goals according to their            │
│                   │                                         │                │ competencyplan where the deadline has passed for at least one of  │
│                   │                                         │                │ the goals. Add these users to a list that the BA's has access to  │
│                   │                                         │                │ where the BA can select them all to set them to 'hvilende' in the │
│                   │                                         │                │ authorization scheme where the goal is missing.                   │
│                   │                                         │                │                                                                   │
│                   │                                         │                │ For users who are not authorized, but has taken an exam but has   │
│                   │                                         │                │ not updated the competency of that exam, the rules needs to be    │
│                   │                                         │                │ rerun. The reason for this is that the rules will have to say     │
│                   │                                         │                │ that a module is not ok if the competency is not updated.         │
│ bizautrules       │ rerunrules                              │ daily          │ Re-run the rules in table ReRunRules that are due to run today.   │
└───────────────────┴─────────────────────────────────────────┴────────────────┴───────────────────────────────────────────────────────────────────┘

As an added feature, rich will render any console markup (https://rich.readthedocs.io/en/latest/markup.html) present in the help text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants