From eac7275651949b3bb6b6cba72a5ecce59cd8d13a Mon Sep 17 00:00:00 2001 From: superstar54 Date: Thu, 9 Jan 2025 15:36:01 +0000 Subject: [PATCH] Add exit status and message --- src/aiidalab_qe/app/utils/search_jobs.py | 35 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/aiidalab_qe/app/utils/search_jobs.py b/src/aiidalab_qe/app/utils/search_jobs.py index f8446244d..8606d4a26 100644 --- a/src/aiidalab_qe/app/utils/search_jobs.py +++ b/src/aiidalab_qe/app/utils/search_jobs.py @@ -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", @@ -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", @@ -78,6 +97,9 @@ def load_data(self): "Structure", "ctime", "State", + "Status", + "Exit_status", + "Exit_message", "Label", "Description", "Relax_type", @@ -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", @@ -130,6 +153,9 @@ def load_data(self): "Creation time relative", "Structure", "State", + "Status", + "Exit_status", + "Exit_message", "Label", "Description", "Relax_type", @@ -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: