samedi 29 septembre 2018

User Interface for filtering objects in Python

In my application I have a Job class as defined/outlined below. Instance of this job class represents a particular Job run, Job can have multiple checkpoints and each checkpoint can have multiple commands.

Job
 - JobName
 - [JobCheckpoint]
 - StartTime
 - EndTime
 - Status
 - ...

JobCheckpoint
 - JobCheckpointName
 - [JobCommand]
 - StartTime
 - EndTime
 - Status
 - ...

JobCommand
 - JobCommandName
 - [Command]
 - StartTime
 - EndTime
 - Status 
 - ...

At any given day there are like 100k different jobs that runs. I want to design a user interface in Python for querying these job objects. For example users want to query

  1. Jobs that ran between x and y interval.
  2. Jobs that run command x
  3. Jobs in failed state.
  4. All checkpoints/commands of a particular job.
  5. And many more...

To solve this, I was thinking of providing following methods in user interface.

  1. dict getJobs(Filter)
  2. dict getCommands(Job)
  3. dict getCheckpoints(Job)

I am not sure

  1. How Filter class will look like?
  2. Is returning dict correct or should I return proper Job object?
  3. Should I take dict as an input or defined classes as an input.
  4. Whether this is a best design.

Aucun commentaire:

Enregistrer un commentaire