@@ -344,6 +344,15 @@ def parent_job_id(self):
344344 """
345345 return _helpers ._get_sub_prop (self ._properties , ["statistics" , "parentJobId" ])
346346
347+ @property
348+ def script_statistics (self ):
349+ resource = _helpers ._get_sub_prop (
350+ self ._properties , ["statistics" , "scriptStatistics" ]
351+ )
352+ if resource is None :
353+ return None
354+ return ScriptStatistics (resource )
355+
347356 @property
348357 def num_child_jobs (self ):
349358 """The number of child jobs executed.
@@ -3456,3 +3465,82 @@ def from_api_repr(cls, resource, client):
34563465 resource ["jobReference" ] = job_ref_properties
34573466 job ._properties = resource
34583467 return job
3468+
3469+
3470+ class ScriptStackFrame (object ):
3471+ """Stack frame showing the line/column/procedure name where the current
3472+ evaluation happened.
3473+
3474+ Args:
3475+ resource (Map[str, Any]):
3476+ JSON representation of object.
3477+ """
3478+
3479+ def __init__ (self , resource ):
3480+ self ._properties = resource
3481+
3482+ @property
3483+ def procedure_id (self ):
3484+ """str: Name of the active procedure, empty if in a top-level
3485+ script.
3486+ """
3487+ return self ._properties .get ("procedureId" )
3488+
3489+ @property
3490+ def text (self ):
3491+ """str: Text of the current statement/expression."""
3492+ return self ._properties .get ("text" )
3493+
3494+ @property
3495+ def start_line (self ):
3496+ """int: One-based start line."""
3497+ return _helpers ._int_or_none (self ._properties .get ("startLine" ))
3498+
3499+ @property
3500+ def start_column (self ):
3501+ """int: One-based start column."""
3502+ return _helpers ._int_or_none (self ._properties .get ("startColumn" ))
3503+
3504+ @property
3505+ def end_line (self ):
3506+ """int: One-based end line."""
3507+ return _helpers ._int_or_none (self ._properties .get ("endLine" ))
3508+
3509+ @property
3510+ def end_column (self ):
3511+ """int: One-based end column."""
3512+ return _helpers ._int_or_none (self ._properties .get ("endColumn" ))
3513+
3514+
3515+ class ScriptStatistics (object ):
3516+ """Statistics for a child job of a script.
3517+
3518+ Args:
3519+ resource (Map[str, Any]):
3520+ JSON representation of object.
3521+ """
3522+
3523+ def __init__ (self , resource ):
3524+ self ._properties = resource
3525+
3526+ @property
3527+ def stack_frames (self ):
3528+ """List[ScriptStackFrame]: Stack trace where the current evaluation
3529+ happened.
3530+
3531+ Shows line/column/procedure name of each frame on the stack at the
3532+ point where the current evaluation happened.
3533+
3534+ The leaf frame is first, the primary script is last.
3535+ """
3536+ return [
3537+ ScriptStackFrame (frame ) for frame in self ._properties .get ("stackFrames" , [])
3538+ ]
3539+
3540+ @property
3541+ def evaluation_kind (self ):
3542+ """str: Indicates the type of child job.
3543+
3544+ Possible values include ``STATEMENT`` and ``EXPRESSION``.
3545+ """
3546+ return self ._properties .get ("evaluationKind" )
0 commit comments