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

Enable printing the database while limiting it to a specific library #349

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def run(self, library_filter=""):
'LoggingProvider': SimpleLogger({'local': True, 'level': 5})
})
try:
db.print()
db.print(args.library_filter)
except Exception as e:
print("Error printing database:")
print(e)
Expand Down
16 changes: 12 additions & 4 deletions components/dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def get_all_jobs_for_library(self, library, jobtype):
jobs = self.db.get_all_jobs_for_library(library)
return [j for j in jobs if j.type == jobtype]

def get_all_jobs_for_library_by_name(self, library_name):
jobs = self.db.get_all_jobs()
return [j for j in jobs if library_name in j.library_shortname]

def get_job(self, library, new_version):
return self.db.get_job(library, new_version)

Expand Down Expand Up @@ -83,7 +87,7 @@ def add_try_run(self, existing_job, try_revision, try_run_type):
def add_phab_revision(self, existing_job, phab_revision, phab_revision_type):
return self.db.add_phab_revision(existing_job, phab_revision, phab_revision_type)

def print(self):
def print(self, library_filter=None):
def get_column_widths(objects, columns):
widths = []

Expand Down Expand Up @@ -134,10 +138,14 @@ def print_objects(name, objects, columns):

job_columns = ['id', 'type', 'created', 'library_shortname', 'version',
'status', 'outcome', 'relinquished', 'bugzilla_id', 'ff_versions']
print_objects("JOBS", self.get_all_jobs(), job_columns)
if library_filter:
jobs = self.get_all_jobs_for_library_by_name(library_filter)
else:
jobs = self.get_all_jobs()
print_objects("JOBS", jobs, job_columns)

try_run_columns = ['id', 'revision', 'job_id', 'purpose']
print_objects("TRY RUNS", self.get_all_try_runs(), try_run_columns)
print_objects("TRY RUNS", [t for t in self.get_all_try_runs() if t.job_id in [j.id for j in jobs]], try_run_columns)

phab_revision_columns = ['id', 'revision', 'job_id', 'purpose']
print_objects("PHABRICATOR REVISIONS", self.get_all_phabricator_revisions(), phab_revision_columns)
print_objects("PHABRICATOR REVISIONS", [r for r in self.get_all_phabricator_revisions() if r.job_id in [j.id for j in jobs]], phab_revision_columns)
Loading