Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit530cadf

Browse files
authored
skip files that are already mapped for enhanced stack traces (temporalio#574)
1 parent38d9eef commit530cadf

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

‎temporalio/worker/_workflow_instance.py‎

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,28 +1870,36 @@ def _enhanced_stack_trace(self) -> temporalio.api.sdk.v1.EnhancedStackTrace:
18701870

18711871
# this is to use `open`
18721872
withtemporalio.workflow.unsafe.sandbox_unrestricted():
1873-
sources=dict()
1874-
stacks= []
1873+
sources:Dict[str,temporalio.api.sdk.v1.StackTraceFileSlice]=dict()
1874+
stacks:List[temporalio.api.sdk.v1.StackTrace]= []
1875+
1876+
# future TODO
1877+
# site package filter list -- we want to filter out traces from Python's internals and our sdk's internals. This is what `internal_code` is for, but right now it's just set to false.
18751878

18761879
fortaskinlist(self._tasks):
1877-
locations= []
1880+
locations:List[temporalio.api.sdk.v1.StackTraceFileLocation]= []
1881+
18781882
forframeintask.get_stack():
18791883
filename=frame.f_code.co_filename
18801884
line_number=frame.f_lineno
18811885
func_name=frame.f_code.co_name
18821886

1883-
try:
1884-
withopen(filename,"r")asf:
1885-
code=f.read()
1886-
exceptOSErrorasose:
1887-
code=f"Cannot access code.\n---\n{ose.strerror}"
1888-
# TODO possibly include sentinel/property for success of src scrape? work out with ui
1889-
exceptException:
1890-
code=f"Generic Error.\n\n{traceback.format_exc()}"
1891-
1892-
file_slice=temporalio.api.sdk.v1.StackTraceFileSlice(
1893-
line_offset=0,content=code
1894-
)
1887+
iffilenamenotinsources.keys():
1888+
try:
1889+
withopen(filename,"r")asf:
1890+
code=f.read()
1891+
exceptOSErrorasose:
1892+
code=f"Cannot access code.\n---\n{ose.strerror}"
1893+
# TODO possibly include sentinel/property for success of src scrape? work out with ui
1894+
exceptException:
1895+
code=f"Generic Error.\n\n{traceback.format_exc()}"
1896+
1897+
file_slice=temporalio.api.sdk.v1.StackTraceFileSlice(
1898+
line_offset=0,content=code
1899+
)
1900+
1901+
sources[filename]=file_slice
1902+
18951903
file_location=temporalio.api.sdk.v1.StackTraceFileLocation(
18961904
file_path=filename,
18971905
line=line_number,
@@ -1900,7 +1908,6 @@ def _enhanced_stack_trace(self) -> temporalio.api.sdk.v1.EnhancedStackTrace:
19001908
internal_code=False,
19011909
)
19021910

1903-
sources[filename]=file_slice
19041911
locations.append(file_location)
19051912

19061913
stacks.append(temporalio.api.sdk.v1.StackTrace(locations=locations))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp