aai-institute / jobq

https://aai-institute.github.io/jobq/latest
Apache License 2.0
2 stars 1 forks source link

Improve formatting of status CLI output #100

Closed AdrianoKF closed 2 months ago

AdrianoKF commented 2 months ago

This PR improves the readability of the jobq status command output.

It recursively turns nested objects into indented blocks and attempts to turn snake-case or camel-case identifiers into human-readable form (i.e., space separated, title cased).

Example

$ jobq status 8cb95872-3c2a-47f6-b847-6112ece94ad8    
Managed Resource Id: 8cb95872-3c2a-47f6-b847-6112ece94ad8
Execution Status: JobStatus.SUCCEEDED
Spec:
  Pod Sets:
    - Count: 1
      Name: main
      Template:
        Metadata:
            <empty>

        Spec:
          Containers:
            - Command:
                - jobs_execute
                - examples/example_hello.py
                - hello_world

              Image: localhost:5000/hello-world-dev:latest
              Image Pull Policy: IfNotPresent
              Name: workload
              Resources:
                Limits:
                  Cpu: 1
                  Memory: 1Gi

                Requests:
                  Cpu: 1
                  Memory: 1Gi

              Termination Message Path: /dev/termination-log
              Termination Message Policy: File

          Dns Policy: ClusterFirst
          Restart Policy: Never
          Scheduler Name: default-scheduler
          Security Context:
              <empty>

          Termination Grace Period Seconds: 30

  Queue Name: user-queue
  Active: True
  Priority Class Name: background
  Priority: 1
  Priority Class Source: kueue.x-k8s.io/workloadpriorityclass

Kueue Status:
  Conditions:
    - Last Transition Time: 2024-09-20T06:55:41Z
      Message: Quota reserved in ClusterQueue cluster-queue
      Observed Generation: 1
      Reason: QuotaReserved
      Status: True
      Type: QuotaReserved
    - Last Transition Time: 2024-09-20T06:55:41Z
      Message: The workload is admitted
      Observed Generation: 1
      Reason: Admitted
      Status: True
      Type: Admitted
    - Last Transition Time: 2024-09-20T06:56:05Z
      Message: Reached expected number of succeeded pods
      Observed Generation: 1
      Reason: Succeeded
      Status: True
      Type: Finished

  Admission:
    Cluster Queue: cluster-queue
    Pod Set Assignments:
      - Count: 1
        Flavors:
          Cpu: default-flavor
          Memory: default-flavor

        Name: main
        Resource Usage:
          Cpu: 1
          Memory: 1Gi

  Requeue State: None
  Reclaimable Pods: None
  Admission Checks: None

Submission Timestamp: 2024-09-20 06:55:41+00:00
Last Admission Timestamp: 2024-09-20 06:55:41+00:00
Termination Timestamp: 2024-09-20 06:56:05+00:00
Was Evicted: False
Was Inadmissible: False
Has Failed Pods: False