vellum-workflow-server 1.0.5.post2__tar.gz → 1.0.5.post3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vellum-workflow-server might be problematic. Click here for more details.
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/PKG-INFO +1 -1
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/pyproject.toml +1 -1
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/workflow_view.py +6 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/code_exec_runner.py +7 -1
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/core/executor.py +13 -1
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/README.md +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/__init__.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/__init__.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/auth_middleware.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/healthz_view.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/tests/__init__.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/tests/test_input_display_mapping.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/tests/test_workflow_view.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/api/tests/test_workflow_view_stream_workflow_route.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/config.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/core/__init__.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/core/cancel_workflow.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/core/events.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/core/utils.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/core/workflow_executor_context.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/server.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/start.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/__init__.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/exit_handler.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/log_proxy.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/oom_killer.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/sentry.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/system_utils.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/tests/__init__.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/tests/test_sentry_integration.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/tests/test_system_utils.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/tests/test_utils.py +0 -0
- {vellum_workflow_server-1.0.5.post2 → vellum_workflow_server-1.0.5.post3}/src/workflow_server/utils/utils.py +0 -0
|
@@ -111,6 +111,7 @@ def stream_workflow_route() -> Response:
|
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
cancel_signal = ThreadingEvent()
|
|
114
|
+
timeout_signal = ThreadingEvent()
|
|
114
115
|
|
|
115
116
|
process: Optional[Process] = None
|
|
116
117
|
if ENABLE_PROCESS_WRAPPER:
|
|
@@ -119,6 +120,7 @@ def stream_workflow_route() -> Response:
|
|
|
119
120
|
executor_context=context,
|
|
120
121
|
queue=process_output_queue,
|
|
121
122
|
cancel_signal=cancel_signal,
|
|
123
|
+
timeout_signal=timeout_signal,
|
|
122
124
|
)
|
|
123
125
|
increment_process_count(1)
|
|
124
126
|
except Exception as e:
|
|
@@ -150,6 +152,7 @@ def stream_workflow_route() -> Response:
|
|
|
150
152
|
context,
|
|
151
153
|
disable_redirect=True,
|
|
152
154
|
cancel_signal=cancel_signal,
|
|
155
|
+
timeout_signal=timeout_signal,
|
|
153
156
|
)
|
|
154
157
|
yield f"{SPAN_ID_EVENT}:{span_id}"
|
|
155
158
|
span_id_emitted = True
|
|
@@ -201,6 +204,9 @@ def stream_workflow_route() -> Response:
|
|
|
201
204
|
):
|
|
202
205
|
logger.error("Workflow timed out, waiting 5 seconds before ending request...")
|
|
203
206
|
cancel_signal.set()
|
|
207
|
+
# We pass this separate signal in so we can get the vembda time_out flag set to true in the vembda
|
|
208
|
+
# fulfilled event inside of exec. In the future we might have a separate timeout event in wsdk
|
|
209
|
+
timeout_signal.set()
|
|
204
210
|
timed_out_time = time.time()
|
|
205
211
|
|
|
206
212
|
if timed_out_time is not None and timed_out_time + 5 < time.time():
|
|
@@ -2,6 +2,7 @@ from datetime import datetime
|
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
|
+
from threading import Event as ThreadingEvent
|
|
5
6
|
from uuid import uuid4
|
|
6
7
|
from typing import Optional
|
|
7
8
|
|
|
@@ -47,7 +48,12 @@ def run_code_exec_stream() -> None:
|
|
|
47
48
|
print(f"{_EVENT_LINE}{initiated_event}") # noqa: T201
|
|
48
49
|
|
|
49
50
|
try:
|
|
50
|
-
stream_iterator, span_id = stream_workflow(
|
|
51
|
+
stream_iterator, span_id = stream_workflow(
|
|
52
|
+
context,
|
|
53
|
+
disable_redirect=True,
|
|
54
|
+
# Timeouts are handled at the code exec level right now so just passing in an unused threading event
|
|
55
|
+
timeout_signal=ThreadingEvent(),
|
|
56
|
+
)
|
|
51
57
|
for line in stream_iterator:
|
|
52
58
|
print(f"{_EVENT_LINE}{json.dumps(line)}") # noqa: T201
|
|
53
59
|
except WorkflowInitializationException as e:
|
|
@@ -88,10 +88,15 @@ def _stream_workflow_wrapper(
|
|
|
88
88
|
executor_context: WorkflowExecutorContext,
|
|
89
89
|
queue: Queue,
|
|
90
90
|
cancel_signal: Optional[ThreadingEvent],
|
|
91
|
+
timeout_signal: ThreadingEvent,
|
|
91
92
|
) -> None:
|
|
92
93
|
span_id_emitted = False
|
|
93
94
|
try:
|
|
94
|
-
stream_iterator, span_id = stream_workflow(
|
|
95
|
+
stream_iterator, span_id = stream_workflow(
|
|
96
|
+
executor_context=executor_context,
|
|
97
|
+
cancel_signal=cancel_signal,
|
|
98
|
+
timeout_signal=timeout_signal,
|
|
99
|
+
)
|
|
95
100
|
|
|
96
101
|
queue.put(f"{SPAN_ID_EVENT}:{span_id}")
|
|
97
102
|
span_id_emitted = True
|
|
@@ -119,6 +124,7 @@ def stream_workflow_process_timeout(
|
|
|
119
124
|
executor_context: WorkflowExecutorContext,
|
|
120
125
|
queue: Queue,
|
|
121
126
|
cancel_signal: Optional[ThreadingEvent],
|
|
127
|
+
timeout_signal: ThreadingEvent,
|
|
122
128
|
) -> Process:
|
|
123
129
|
workflow_process = Process(
|
|
124
130
|
target=_stream_workflow_wrapper,
|
|
@@ -126,6 +132,7 @@ def stream_workflow_process_timeout(
|
|
|
126
132
|
executor_context,
|
|
127
133
|
queue,
|
|
128
134
|
cancel_signal,
|
|
135
|
+
timeout_signal,
|
|
129
136
|
),
|
|
130
137
|
)
|
|
131
138
|
workflow_process.start()
|
|
@@ -150,6 +157,7 @@ def stream_workflow_process_timeout(
|
|
|
150
157
|
|
|
151
158
|
def stream_workflow(
|
|
152
159
|
executor_context: WorkflowExecutorContext,
|
|
160
|
+
timeout_signal: ThreadingEvent,
|
|
153
161
|
disable_redirect: bool = True,
|
|
154
162
|
cancel_signal: Optional[ThreadingEvent] = None,
|
|
155
163
|
) -> tuple[Iterator[dict], UUID]:
|
|
@@ -226,6 +234,7 @@ def stream_workflow(
|
|
|
226
234
|
executor_context=executor_context,
|
|
227
235
|
stream_generator=call_workflow,
|
|
228
236
|
disable_redirect=disable_redirect,
|
|
237
|
+
timeout_signal=timeout_signal,
|
|
229
238
|
),
|
|
230
239
|
stream.span_id,
|
|
231
240
|
)
|
|
@@ -265,12 +274,14 @@ def stream_node(
|
|
|
265
274
|
executor_context=executor_context,
|
|
266
275
|
stream_generator=call_node,
|
|
267
276
|
disable_redirect=disable_redirect,
|
|
277
|
+
timeout_signal=ThreadingEvent(),
|
|
268
278
|
)
|
|
269
279
|
|
|
270
280
|
|
|
271
281
|
def _call_stream(
|
|
272
282
|
executor_context: BaseExecutorContext,
|
|
273
283
|
stream_generator: Callable[[], Generator[dict[str, Any], Any, None]],
|
|
284
|
+
timeout_signal: ThreadingEvent,
|
|
274
285
|
disable_redirect: bool = True,
|
|
275
286
|
) -> Iterator[dict]:
|
|
276
287
|
log_redirect: Optional[StringIO] = None
|
|
@@ -291,6 +302,7 @@ def _call_stream(
|
|
|
291
302
|
log=log_redirect.getvalue() if log_redirect else "",
|
|
292
303
|
stderr="",
|
|
293
304
|
container_overhead_latency=executor_context.container_overhead_latency,
|
|
305
|
+
timed_out=timeout_signal.is_set(),
|
|
294
306
|
),
|
|
295
307
|
parent=None,
|
|
296
308
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|