Skip to content

Commit

Permalink
Add exit status and message
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Jan 9, 2025
1 parent 02a989c commit eac7275
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions src/aiidalab_qe/app/utils/search_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,37 @@
"killed": "❌",
}


def determine_state_icon(row):
state = row["State"].lower()
if state == "finished" and row["Exit_status"] != 0:
return f"Finished{STATE_ICONS['excepted']}"
return f"{state.capitalize()}{STATE_ICONS.get(state, '')}"


COLUMNS = {
"ID": {"headerName": "ID 🔗", "dataType": "link", "editable": False},
"Creation time absolute": {
"headerName": "Creation time ⏰ (absolute)",
"type": "date",
"width": 150,
"width": 100,
"editable": False,
},
"Creation time relative": {
"headerName": "Creation time ⏰ (relative)",
"width": 150,
"width": 100,
"editable": False,
},
"Structure": {"headerName": "Structure", "editable": False},
"State": {"headerName": "State 🟢", "editable": False},
"Status": {"headerName": "Status", "editable": False, "hide": True},
"Exit_status": {
"headerName": "Exit status",
"type": "number",
"editable": False,
"hide": True,
},
"Exit_message": {"headerName": "Exit message", "editable": False},
"Label": {"headerName": "Label", "width": 300, "editable": True},
"Description": {
"headerName": "Description",
Expand Down Expand Up @@ -67,6 +83,9 @@ def load_data(self):
"extras.structure",
"ctime",
"attributes.process_state",
"attributes.process_status",
"attributes.exit_status",
"attributes.exit_message",
"label",
"description",
"extras.workchain.relax_type",
Expand All @@ -78,6 +97,9 @@ def load_data(self):
"Structure",
"ctime",
"State",
"Status",
"Exit_status",
"Exit_message",
"Label",
"Description",
"Relax_type",
Expand Down Expand Up @@ -122,6 +144,7 @@ def load_data(self):
# Initialize empty columns for an empty DataFrame
df["Creation time"] = pd.Series(dtype="str")
df["Delete"] = pd.Series(dtype="str")
print(df[0:5])
return df[
[
"PK_with_link",
Expand All @@ -130,6 +153,9 @@ def load_data(self):
"Creation time relative",
"Structure",
"State",
"Status",
"Exit_status",
"Exit_message",
"Label",
"Description",
"Relax_type",
Expand Down Expand Up @@ -271,9 +297,8 @@ def update_table_value(self, display_df):
)

#
display_df["State"] = display_df["State"].apply(
lambda x: f"{x.capitalize()}{STATE_ICONS.get(x.lower())}"
)
if not display_df.empty:
display_df["State"] = display_df.apply(determine_state_icon, axis=1)
display_df = display_df.drop(columns=["Properties", "ctime"])
columns = []
for col in display_df.columns:
Expand Down

0 comments on commit eac7275

Please sign in to comment.