File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
ads/jobs/builders/infrastructure Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 9
9
import inspect
10
10
import logging
11
11
import os
12
+ import re
12
13
import time
13
14
import traceback
14
15
import uuid
@@ -582,6 +583,25 @@ def logging(self) -> OCILog:
582
583
id = self .log_id , log_group_id = self .log_details .log_group_id , ** auth
583
584
)
584
585
586
+ @property
587
+ def exit_code (self ):
588
+ """The exit code of the job run from the lifecycle details.
589
+ Note that,
590
+ None will be returned if the job run is not finished or failed without exit code.
591
+ 0 will be returned if job run succeeded.
592
+ """
593
+ if self .lifecycle_state == self .LIFECYCLE_STATE_SUCCEEDED :
594
+ return 0
595
+ if not self .lifecycle_details :
596
+ return None
597
+ match = re .search (r"exit code (\d+)" , self .lifecycle_details )
598
+ if not match :
599
+ return None
600
+ try :
601
+ return int (match .group (1 ))
602
+ except Exception :
603
+ return None
604
+
585
605
@staticmethod
586
606
def _format_log (message : str , date_time : datetime .datetime ) -> dict :
587
607
"""Formats a message as log record with datetime.
You can’t perform that action at this time.
0 commit comments