Skip to content

Commit

Permalink
Format black
Browse files Browse the repository at this point in the history
  • Loading branch information
pyiron-runner committed Oct 25, 2022
1 parent 3f540cb commit a3ccefe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
8 changes: 6 additions & 2 deletions pyiron_base/jobs/job/extension/server/queuestatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
QUEUE_SCRIPT_PREFIX = "pi_"


def queue_table(job_ids=None, working_directory_lst=None, project_only=True, full_table=False):
def queue_table(
job_ids=None, working_directory_lst=None, project_only=True, full_table=False
):
"""
Display the queuing system table as pandas.Dataframe
Expand All @@ -39,7 +41,9 @@ def queue_table(job_ids=None, working_directory_lst=None, project_only=True, ful
pandas.DataFrame: Output from the queuing system - optimized for the Sun grid engine
"""
job_ids = [] if job_ids is None else job_ids
working_directory_lst = [] if working_directory_lst is None else working_directory_lst
working_directory_lst = (
[] if working_directory_lst is None else working_directory_lst
)
if project_only and not job_ids and not working_directory_lst:
return []
if state.queue_adapter is not None:
Expand Down
19 changes: 11 additions & 8 deletions pyiron_base/project/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ def queue_table(self, project_only=True, recursive=True, full_table=False):
return queue_table(
project_only=project_only,
full_table=full_table,
working_directory_lst=[self.path]
working_directory_lst=[self.path],
)

def queue_table_global(self, full_table=False):
Expand All @@ -938,26 +938,29 @@ def queue_table_global(self, full_table=False):
]
)
else:

def get_id_from_job_table(job_table, job_path):
job_dir = "_hdf5".join(job_path.split("_hdf5")[:-1])
job_name = os.path.basename(job_dir)
project = os.path.dirname(job_dir) + "/"
return job_table[
(job_table.job == job_name) &
(job_table.project == project)
(job_table.job == job_name) & (job_table.project == project)
].id.values[0]

job_table_df = self.job_table()

return pandas.DataFrame(
[
self.db.get_item_by_id(
int(get_id_from_job_table(
job_table=job_table_df,
job_path=working_directory
))
int(
get_id_from_job_table(
job_table=job_table_df, job_path=working_directory
)
)
)
for queue_ID, working_directory in zip(
df["jobname"], df["working_directory"]
)
for queue_ID, working_directory in zip(df["jobname"], df["working_directory"])
if str(queue_ID).startswith("pi_")
]
)
Expand Down

0 comments on commit a3ccefe

Please sign in to comment.