@@ -546,6 +546,21 @@ def set_error(self, exception, traceback_data=None, from_logs=False):
546546 from_logs = from_logs
547547 )
548548
549+ def set_warning (self , exception , traceback_data = None , from_logs = False ):
550+ """
551+ Set a warning for the current thread's trace.
552+ :param exception: The exception
553+ :param traceback_data: The traceback data.
554+ :param from_logs: True if the exception was captured from logging
555+ """
556+ if self .get_trace ():
557+ self .get_trace ().set_error (
558+ exception ,
559+ traceback_data ,
560+ from_logs = from_logs ,
561+ is_warning = True
562+ )
563+
549564 def get_trace_url (self ):
550565 """
551566 Return the trace URL based on the runner ID.
@@ -921,12 +936,19 @@ def get_log_id(self):
921936
922937 return None
923938
924- def set_error (self , exception , traceback_data = None , from_logs = False ):
939+ def set_error (
940+ self ,
941+ exception ,
942+ traceback_data = None ,
943+ from_logs = False ,
944+ is_warning = False
945+ ):
925946 """
926947 Sets the error value of the runner
927948 :param exception: Exception object or String to set.
928949 :param traceback_data: traceback string
929950 :param from_logs: True if the exception was captured from logging
951+ :param is_warning: True if set a warning type
930952 """
931953 if not self .runner :
932954 return
@@ -945,11 +967,11 @@ def set_error(self, exception, traceback_data=None, from_logs=False):
945967 # Convert exception string to Exception type
946968 if isinstance (exception , str ):
947969 exception = Exception (exception )
948-
949970 self .runner .set_exception (
950971 exception ,
951972 traceback_data ,
952- from_logs = from_logs
973+ from_logs = from_logs ,
974+ is_warning = is_warning ,
953975 )
954976
955977 def update_runner_with_labels (self ):
0 commit comments