Skip to content

Commit

Permalink
Merge pull request #423 from pyiron/tqdm-job
Browse files Browse the repository at this point in the history
Add tqdm to Project.iter_jobs
  • Loading branch information
jan-janssen authored Sep 15, 2021
2 parents 85c1aa1 + bbfaa85 commit c125b68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyiron_base/project/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import posixpath
import shutil
from tqdm import tqdm
import pandas
import importlib
import numpy as np
Expand Down Expand Up @@ -530,7 +531,7 @@ def inspect(self, job_specifier):
"""
return self.load(job_specifier=job_specifier, convert_to_object=False)

def iter_jobs(self, path=None, recursive=True, convert_to_object=True, status=None, job_type=None):
def iter_jobs(self, path=None, recursive=True, convert_to_object=True, status=None, job_type=None, progress=True):
"""
Iterate over the jobs within the current project and it is sub projects
Expand All @@ -540,6 +541,7 @@ def iter_jobs(self, path=None, recursive=True, convert_to_object=True, status=No
convert_to_object (bool): load the full GenericJob object (default) or just the HDF5 / JobCore object
status (str/None): status of the jobs to filter for - ['finished', 'aborted', 'submitted', ...]
job_type (str/None): job type to filter for, corresponds to the 'hamilton' column in the job table
progress (bool): if True (default), add an interactive progress bar to the iteration
Returns:
yield: Yield of GenericJob or JobCore
Expand All @@ -557,6 +559,8 @@ def iter_jobs(self, path=None, recursive=True, convert_to_object=True, status=No
if job_type is not None:
mask &= df["hamilton"] == job_type
job_id_lst = list(df[mask]["id"])
if progress:
job_id_lst = tqdm(job_id_lst)
for job_id in job_id_lst:
if path is not None:
yield self.load(job_id, convert_to_object=False)[path]
Expand Down

0 comments on commit c125b68

Please sign in to comment.