vellum-workflow-server 0.14.72__tar.gz → 0.14.72.post2__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-0.14.72 → vellum_workflow_server-0.14.72.post2}/PKG-INFO +1 -1
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/pyproject.toml +1 -1
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/tests/test_workflow_view.py +122 -19
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/workflow_view.py +34 -6
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/code_exec_runner.py +3 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/core/executor.py +6 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/README.md +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/__init__.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/__init__.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/auth_middleware.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/healthz_view.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/tests/__init__.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/tests/test_input_display_mapping.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/api/tests/test_workflow_view_stream_workflow_route.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/config.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/core/__init__.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/core/cancel_workflow.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/core/events.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/core/workflow_executor_context.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/server.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/start.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/__init__.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/exit_handler.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/log_proxy.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/oom_killer.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/sentry.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/system_utils.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/tests/__init__.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/tests/test_system_utils.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/tests/test_utils.py +0 -0
- {vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/utils/utils.py +0 -0
|
@@ -27,10 +27,7 @@ def test_version_route__with_single_node_file(tmp_path):
|
|
|
27
27
|
from vellum.workflows.nodes import BaseNode
|
|
28
28
|
|
|
29
29
|
class TestNode(BaseNode):
|
|
30
|
-
\"""A test node for processing data
|
|
31
|
-
|
|
32
|
-
This is a detailed description of what the node does.
|
|
33
|
-
\"""
|
|
30
|
+
\"""A test node for processing data.\"""
|
|
34
31
|
"""
|
|
35
32
|
)
|
|
36
33
|
|
|
@@ -50,11 +47,26 @@ class TestNode(BaseNode):
|
|
|
50
47
|
# AND the node should have the correct metadata
|
|
51
48
|
node = nodes[0]
|
|
52
49
|
assert UUID(node["id"])
|
|
53
|
-
assert node["module"] == ["vellum_custom_nodes"]
|
|
50
|
+
assert node["module"] == ["vellum_custom_nodes", "test_node"]
|
|
54
51
|
assert node["name"] == "TestNode"
|
|
55
52
|
assert node["label"] == "Test Node"
|
|
56
53
|
assert "A test node for processing data." in node["description"]
|
|
57
|
-
assert
|
|
54
|
+
assert node["exec_config"] == {
|
|
55
|
+
"adornments": None,
|
|
56
|
+
"attributes": [],
|
|
57
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
58
|
+
"definition": {"module": ["vellum_custom_nodes", "test_node"], "name": "TestNode"},
|
|
59
|
+
"display_data": {
|
|
60
|
+
"comment": {"value": "A test node for processing data."},
|
|
61
|
+
"position": {"x": 0.0, "y": 0.0},
|
|
62
|
+
},
|
|
63
|
+
"id": "7a8b251d-f5ca-462a-b293-071d219460fb",
|
|
64
|
+
"label": "TestNode",
|
|
65
|
+
"outputs": [],
|
|
66
|
+
"ports": [{"id": "a3a0eefd-45d0-4f13-8c58-a836a9f7f9ed", "name": "default", "type": "DEFAULT"}],
|
|
67
|
+
"trigger": {"id": "a022e36c-9852-4772-9be3-3c6c147fd811", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
68
|
+
"type": "GENERIC",
|
|
69
|
+
}
|
|
58
70
|
|
|
59
71
|
|
|
60
72
|
def test_version_route__with_nodes_in_multiple_files(tmp_path):
|
|
@@ -102,14 +114,40 @@ class SomeOtherNode(BaseNode):
|
|
|
102
114
|
assert some_node["label"] == "Some Node"
|
|
103
115
|
assert some_node["description"] == "This is Some Node."
|
|
104
116
|
assert UUID(some_node["id"])
|
|
105
|
-
assert some_node["module"] == ["vellum_custom_nodes"]
|
|
117
|
+
assert some_node["module"] == ["vellum_custom_nodes", "first_node"]
|
|
118
|
+
assert some_node["exec_config"] == {
|
|
119
|
+
"adornments": None,
|
|
120
|
+
"attributes": [],
|
|
121
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
122
|
+
"definition": {"module": ["vellum_custom_nodes", "first_node"], "name": "SomeNode"},
|
|
123
|
+
"display_data": {"comment": {"value": "This is Some Node."}, "position": {"x": 0.0, "y": 0.0}},
|
|
124
|
+
"id": "1e559c2e-db82-41f0-9ceb-5e89b0c5a0a3",
|
|
125
|
+
"label": "SomeNode",
|
|
126
|
+
"outputs": [],
|
|
127
|
+
"ports": [{"id": "48e39e97-5fd4-471e-b4f2-51d3baf06456", "name": "default", "type": "DEFAULT"}],
|
|
128
|
+
"trigger": {"id": "e3381fb7-61fc-4c46-ae8e-51fc463b6a59", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
129
|
+
"type": "GENERIC",
|
|
130
|
+
}
|
|
106
131
|
|
|
107
132
|
# AND the second node should have correct metadata
|
|
108
133
|
some_other_node = nodes[1]
|
|
109
134
|
assert some_other_node["label"] == "Some Other Node"
|
|
110
135
|
assert some_other_node["description"] == "This is Some Other Node."
|
|
111
136
|
assert UUID(some_other_node["id"])
|
|
112
|
-
assert some_other_node["module"] == ["vellum_custom_nodes"]
|
|
137
|
+
assert some_other_node["module"] == ["vellum_custom_nodes", "second_node"]
|
|
138
|
+
assert some_other_node["exec_config"] == {
|
|
139
|
+
"adornments": None,
|
|
140
|
+
"attributes": [],
|
|
141
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
142
|
+
"definition": {"module": ["vellum_custom_nodes", "second_node"], "name": "SomeOtherNode"},
|
|
143
|
+
"display_data": {"comment": {"value": "This is Some Other Node."}, "position": {"x": 0.0, "y": 0.0}},
|
|
144
|
+
"id": "7aee541b-b245-4c8a-9137-3e4631d5100c",
|
|
145
|
+
"label": "SomeOtherNode",
|
|
146
|
+
"outputs": [],
|
|
147
|
+
"ports": [{"id": "fb66b46a-d970-4bc9-83ea-70c154c57ddd", "name": "default", "type": "DEFAULT"}],
|
|
148
|
+
"trigger": {"id": "13fa2714-20b3-4bc3-ab79-621a188e3bfa", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
149
|
+
"type": "GENERIC",
|
|
150
|
+
}
|
|
113
151
|
|
|
114
152
|
|
|
115
153
|
def test_version_route__no_custom_nodes_dir(tmp_path):
|
|
@@ -164,6 +202,37 @@ class HelperClass:
|
|
|
164
202
|
node_names = {node["name"] for node in nodes}
|
|
165
203
|
assert node_names == {"ProcessingNode", "TransformationNode"}
|
|
166
204
|
|
|
205
|
+
# Find and assert each node individually
|
|
206
|
+
processing_node = next(node for node in nodes if node["name"] == "ProcessingNode")
|
|
207
|
+
assert processing_node["exec_config"] == {
|
|
208
|
+
"adornments": None,
|
|
209
|
+
"attributes": [],
|
|
210
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
211
|
+
"definition": {"module": ["vellum_custom_nodes", "multiple_nodes"], "name": "ProcessingNode"},
|
|
212
|
+
"display_data": {"comment": {"value": "Processes input data."}, "position": {"x": 0.0, "y": 0.0}},
|
|
213
|
+
"id": "f92c09f0-0434-46cb-829d-a73f801d6343",
|
|
214
|
+
"label": "ProcessingNode",
|
|
215
|
+
"outputs": [],
|
|
216
|
+
"ports": [{"id": "abaa2984-b312-4491-b069-e689759f72c8", "name": "default", "type": "DEFAULT"}],
|
|
217
|
+
"trigger": {"id": "35378c2b-f089-44af-ac37-efe4ea42c817", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
218
|
+
"type": "GENERIC",
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
transformation_node = next(node for node in nodes if node["name"] == "TransformationNode")
|
|
222
|
+
assert transformation_node["exec_config"] == {
|
|
223
|
+
"adornments": None,
|
|
224
|
+
"attributes": [],
|
|
225
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
226
|
+
"definition": {"module": ["vellum_custom_nodes", "multiple_nodes"], "name": "TransformationNode"},
|
|
227
|
+
"display_data": {"comment": {"value": "Transforms data format."}, "position": {"x": 0.0, "y": 0.0}},
|
|
228
|
+
"id": "09ca32f7-c8f2-4469-97e5-1f288f85127a",
|
|
229
|
+
"label": "TransformationNode",
|
|
230
|
+
"outputs": [],
|
|
231
|
+
"ports": [{"id": "88778117-fbfc-4b44-964b-5a4994aa2f24", "name": "default", "type": "DEFAULT"}],
|
|
232
|
+
"trigger": {"id": "5d096263-7fbf-490a-83b7-e441852b5fb6", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
233
|
+
"type": "GENERIC",
|
|
234
|
+
}
|
|
235
|
+
|
|
167
236
|
|
|
168
237
|
def test_version_route__with_invalid_node_file(tmp_path, caplog):
|
|
169
238
|
caplog.set_level(logging.WARNING)
|
|
@@ -212,7 +281,20 @@ class BrokenNode(BaseNode)
|
|
|
212
281
|
assert valid_node["label"] == "Some Node"
|
|
213
282
|
assert valid_node["description"] == "This is Some Node."
|
|
214
283
|
assert UUID(valid_node["id"])
|
|
215
|
-
assert valid_node["module"] == ["vellum_custom_nodes"]
|
|
284
|
+
assert valid_node["module"] == ["vellum_custom_nodes", "valid_node"]
|
|
285
|
+
assert valid_node["exec_config"] == {
|
|
286
|
+
"adornments": None,
|
|
287
|
+
"attributes": [],
|
|
288
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
289
|
+
"definition": {"module": ["vellum_custom_nodes", "valid_node"], "name": "SomeNode"},
|
|
290
|
+
"display_data": {"comment": {"value": "This is Some Node."}, "position": {"x": 0.0, "y": 0.0}},
|
|
291
|
+
"id": "1e559c2e-db82-41f0-9ceb-5e89b0c5a0a3",
|
|
292
|
+
"label": "SomeNode",
|
|
293
|
+
"outputs": [],
|
|
294
|
+
"ports": [{"id": "48e39e97-5fd4-471e-b4f2-51d3baf06456", "name": "default", "type": "DEFAULT"}],
|
|
295
|
+
"trigger": {"id": "e3381fb7-61fc-4c46-ae8e-51fc463b6a59", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
296
|
+
"type": "GENERIC",
|
|
297
|
+
}
|
|
216
298
|
|
|
217
299
|
# AND the error should be logged with full traceback
|
|
218
300
|
assert len(caplog.records) > 0
|
|
@@ -221,7 +303,7 @@ class BrokenNode(BaseNode)
|
|
|
221
303
|
assert "invalid_node.py, line 4" in error_message
|
|
222
304
|
|
|
223
305
|
|
|
224
|
-
def
|
|
306
|
+
def test_version_route__with_attributes(tmp_path):
|
|
225
307
|
# GIVEN a temporary custom_nodes directory
|
|
226
308
|
custom_nodes_dir = tmp_path / "vellum_custom_nodes"
|
|
227
309
|
custom_nodes_dir.mkdir()
|
|
@@ -230,19 +312,13 @@ def test_version_route__with_inputs(tmp_path):
|
|
|
230
312
|
node_file = custom_nodes_dir / "addition_node.py"
|
|
231
313
|
node_file.write_text(
|
|
232
314
|
"""
|
|
233
|
-
from vellum.workflows.inputs import BaseInputs
|
|
234
315
|
from vellum.workflows.nodes import BaseNode
|
|
235
316
|
|
|
236
317
|
|
|
237
|
-
class Inputs(BaseInputs):
|
|
238
|
-
arg1: int
|
|
239
|
-
arg2: int
|
|
240
|
-
|
|
241
|
-
|
|
242
318
|
class MyAdditionNode(BaseNode):
|
|
243
319
|
\"\"\"Custom node that performs simple addition.\"\"\"
|
|
244
|
-
arg1: int
|
|
245
|
-
arg2: int
|
|
320
|
+
arg1: int
|
|
321
|
+
arg2: int
|
|
246
322
|
|
|
247
323
|
class Outputs(BaseNode.Outputs):
|
|
248
324
|
result: int
|
|
@@ -271,5 +347,32 @@ class MyAdditionNode(BaseNode):
|
|
|
271
347
|
assert node["label"] == "My Addition Node"
|
|
272
348
|
assert node["description"] == "Custom node that performs simple addition."
|
|
273
349
|
assert UUID(node["id"])
|
|
274
|
-
assert node["module"] == ["vellum_custom_nodes"]
|
|
350
|
+
assert node["module"] == ["vellum_custom_nodes", "addition_node"]
|
|
275
351
|
assert node["name"] == "MyAdditionNode"
|
|
352
|
+
assert node["exec_config"] == {
|
|
353
|
+
"adornments": None,
|
|
354
|
+
"attributes": [
|
|
355
|
+
{
|
|
356
|
+
"id": "aed3bcbb-d243-4a77-bb5e-409e9a28e868",
|
|
357
|
+
"name": "arg1",
|
|
358
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"id": "9225d225-a41b-4642-8964-f28f58dcf4bf",
|
|
362
|
+
"name": "arg2",
|
|
363
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
"base": {"module": ["vellum", "workflows", "nodes", "bases", "base"], "name": "BaseNode"},
|
|
367
|
+
"definition": {"module": ["vellum_custom_nodes", "addition_node"], "name": "MyAdditionNode"},
|
|
368
|
+
"display_data": {
|
|
369
|
+
"comment": {"value": "Custom node that performs simple addition."},
|
|
370
|
+
"position": {"x": 0.0, "y": 0.0},
|
|
371
|
+
},
|
|
372
|
+
"id": "195cd69d-3d2d-41e4-a432-16c433cb8d34",
|
|
373
|
+
"label": "MyAdditionNode",
|
|
374
|
+
"outputs": [{"id": "3d8e40cb-2aa8-44bd-ae6a-708a9fbc4779", "name": "result", "type": "NUMBER", "value": None}],
|
|
375
|
+
"ports": [{"id": "9a9e4ef6-febf-4093-a515-217bbb1373db", "name": "default", "type": "DEFAULT"}],
|
|
376
|
+
"trigger": {"id": "a5298668-d808-4a45-a62e-790943948e8a", "merge_behavior": "AWAIT_ATTRIBUTES"},
|
|
377
|
+
"type": "GENERIC",
|
|
378
|
+
}
|
|
@@ -11,10 +11,13 @@ import sys
|
|
|
11
11
|
import time
|
|
12
12
|
import traceback
|
|
13
13
|
from uuid import uuid4
|
|
14
|
-
from typing import Generator, Iterator, Union
|
|
14
|
+
from typing import Any, Dict, Generator, Iterator, Union, cast
|
|
15
15
|
|
|
16
16
|
from flask import Blueprint, Response, current_app as app, request, stream_with_context
|
|
17
17
|
from pydantic import ValidationError
|
|
18
|
+
import sentry_sdk
|
|
19
|
+
from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
|
|
20
|
+
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
|
18
21
|
|
|
19
22
|
from vellum.workflows.nodes import BaseNode
|
|
20
23
|
from vellum.workflows.utils.names import pascal_to_title_case
|
|
@@ -110,6 +113,7 @@ def stream_workflow_route() -> Response:
|
|
|
110
113
|
)
|
|
111
114
|
increment_process_count(1)
|
|
112
115
|
except Exception as e:
|
|
116
|
+
sentry_sdk.set_tag("vellum_trace_id", str(context.trace_id))
|
|
113
117
|
logger.exception(e)
|
|
114
118
|
|
|
115
119
|
vembda_fulfilled_event = VembdaExecutionFulfilledEvent(
|
|
@@ -213,6 +217,7 @@ def stream_workflow_route() -> Response:
|
|
|
213
217
|
|
|
214
218
|
continue
|
|
215
219
|
except Exception as e:
|
|
220
|
+
sentry_sdk.set_tag("vellum_trace_id", str(context.trace_id))
|
|
216
221
|
logger.exception(e)
|
|
217
222
|
break
|
|
218
223
|
|
|
@@ -325,6 +330,7 @@ def stream_node_route() -> Response:
|
|
|
325
330
|
parent=None,
|
|
326
331
|
)
|
|
327
332
|
yield vembda_fulfilled_event.model_dump(mode="json")
|
|
333
|
+
sentry_sdk.set_tag("vellum_trace_id", str(context.trace_id))
|
|
328
334
|
app.logger.exception(stream_future.exception())
|
|
329
335
|
break
|
|
330
336
|
else:
|
|
@@ -371,16 +377,27 @@ def get_version_route() -> tuple[dict, int]:
|
|
|
371
377
|
for _, name, _ in pkgutil.iter_modules([custom_nodes_path]):
|
|
372
378
|
try:
|
|
373
379
|
module = importlib.import_module(f"{CUSTOM_NODES_DIRECTORY}.{name}")
|
|
374
|
-
for
|
|
380
|
+
for _, obj in inspect.getmembers(module):
|
|
375
381
|
# Look for classes that inherit from BaseNode
|
|
376
382
|
if inspect.isclass(obj) and obj != BaseNode and issubclass(obj, BaseNode):
|
|
383
|
+
node_display_class = get_node_display_class(obj)
|
|
384
|
+
exec_config_raw = node_display_class().serialize(WorkflowDisplayContext())
|
|
385
|
+
exec_config = cast(Dict[str, Any], exec_config_raw)
|
|
386
|
+
module = exec_config["definition"]["module"]
|
|
387
|
+
label = exec_config["label"]
|
|
388
|
+
description = (
|
|
389
|
+
exec_config["display_data"]["comment"]["value"]
|
|
390
|
+
if "comment" in exec_config["display_data"]
|
|
391
|
+
else ""
|
|
392
|
+
)
|
|
377
393
|
nodes.append(
|
|
378
394
|
{
|
|
379
395
|
"id": str(uuid4()),
|
|
380
|
-
"module":
|
|
396
|
+
"module": module,
|
|
381
397
|
"name": obj.__name__,
|
|
382
398
|
"label": pascal_to_title_case(label),
|
|
383
|
-
"description":
|
|
399
|
+
"description": description,
|
|
400
|
+
"exec_config": exec_config,
|
|
384
401
|
}
|
|
385
402
|
)
|
|
386
403
|
except Exception as e:
|
|
@@ -388,6 +405,7 @@ def get_version_route() -> tuple[dict, int]:
|
|
|
388
405
|
|
|
389
406
|
resp["nodes"] = nodes
|
|
390
407
|
except Exception as e:
|
|
408
|
+
sentry_sdk.set_tag("vellum_trace_id", "unknown")
|
|
391
409
|
logger.exception(f"Failed to discover nodes: {str(e)}")
|
|
392
410
|
resp["nodes"] = []
|
|
393
411
|
|
|
@@ -396,10 +414,15 @@ def get_version_route() -> tuple[dict, int]:
|
|
|
396
414
|
|
|
397
415
|
def get_workflow_request_context(data: dict) -> WorkflowExecutorContext:
|
|
398
416
|
# not sure if this is the filter we want to pass forward?
|
|
417
|
+
trace_id = uuid4()
|
|
418
|
+
if "execution_context" in data and isinstance(data["execution_context"], dict):
|
|
419
|
+
if "trace_id" in data["execution_context"]:
|
|
420
|
+
trace_id = data["execution_context"]["trace_id"]
|
|
421
|
+
|
|
399
422
|
context_data = {
|
|
400
423
|
**data,
|
|
401
424
|
"inputs": convert_json_inputs_to_vellum(data.get("inputs") or []),
|
|
402
|
-
"trace_id":
|
|
425
|
+
"trace_id": trace_id,
|
|
403
426
|
"request_start_time": time.time_ns(),
|
|
404
427
|
}
|
|
405
428
|
|
|
@@ -407,10 +430,15 @@ def get_workflow_request_context(data: dict) -> WorkflowExecutorContext:
|
|
|
407
430
|
|
|
408
431
|
|
|
409
432
|
def get_node_request_context(data: dict) -> NodeExecutorContext:
|
|
433
|
+
trace_id = uuid4()
|
|
434
|
+
if "execution_context" in data and isinstance(data["execution_context"], dict):
|
|
435
|
+
if "trace_id" in data["execution_context"]:
|
|
436
|
+
trace_id = data["execution_context"]["trace_id"]
|
|
437
|
+
|
|
410
438
|
context_data = {
|
|
411
439
|
**data,
|
|
412
440
|
"inputs": convert_json_inputs_to_vellum(data["inputs"]),
|
|
413
|
-
"trace_id":
|
|
441
|
+
"trace_id": trace_id,
|
|
414
442
|
"request_start_time": time.time_ns(),
|
|
415
443
|
}
|
|
416
444
|
|
|
@@ -5,6 +5,8 @@ import os
|
|
|
5
5
|
from uuid import uuid4
|
|
6
6
|
from typing import Optional
|
|
7
7
|
|
|
8
|
+
import sentry_sdk
|
|
9
|
+
|
|
8
10
|
from vellum.workflows.exceptions import WorkflowInitializationException
|
|
9
11
|
from workflow_server.api.workflow_view import get_workflow_request_context
|
|
10
12
|
from workflow_server.core.events import (
|
|
@@ -69,6 +71,7 @@ def run_code_exec_stream() -> None:
|
|
|
69
71
|
|
|
70
72
|
print(f"{_EVENT_LINE}{json.dumps(fulfilled_event)}") # noqa: T201
|
|
71
73
|
except Exception as e:
|
|
74
|
+
sentry_sdk.set_tag("vellum_trace_id", str(context.trace_id) if context else "unknown")
|
|
72
75
|
logger.exception(e)
|
|
73
76
|
|
|
74
77
|
vembda_fulfilled_event = VembdaExecutionFulfilledEvent(
|
|
@@ -15,6 +15,7 @@ from uuid import uuid4
|
|
|
15
15
|
from typing import Any, Callable, Generator, Iterator, Optional, Tuple, Type
|
|
16
16
|
|
|
17
17
|
from pebble import concurrent
|
|
18
|
+
import sentry_sdk
|
|
18
19
|
from vellum_ee.workflows.display.workflows import BaseWorkflowDisplay
|
|
19
20
|
from vellum_ee.workflows.server.virtual_file_loader import VirtualFileFinder
|
|
20
21
|
|
|
@@ -66,6 +67,7 @@ def _stream_node_wrapper(executor_context: NodeExecutorContext, queue: Queue) ->
|
|
|
66
67
|
for event in stream_node(executor_context=executor_context):
|
|
67
68
|
queue.put(event)
|
|
68
69
|
except Exception as e:
|
|
70
|
+
sentry_sdk.set_tag("vellum_trace_id", str(executor_context.trace_id))
|
|
69
71
|
logger.exception(e)
|
|
70
72
|
queue.put(
|
|
71
73
|
VembdaExecutionFulfilledEvent(
|
|
@@ -104,6 +106,7 @@ def _stream_workflow_wrapper(executor_context: WorkflowExecutorContext, queue: Q
|
|
|
104
106
|
).model_dump(mode="json")
|
|
105
107
|
)
|
|
106
108
|
except Exception as e:
|
|
109
|
+
sentry_sdk.set_tag("vellum_trace_id", str(executor_context.trace_id))
|
|
107
110
|
logger.exception(e)
|
|
108
111
|
queue.put(
|
|
109
112
|
VembdaExecutionFulfilledEvent(
|
|
@@ -209,6 +212,7 @@ def stream_workflow(
|
|
|
209
212
|
event.body.display_context = display_context
|
|
210
213
|
|
|
211
214
|
if event.name.endswith("rejected") and event.body.error.code.name == "INTERNAL_ERROR": # type: ignore
|
|
215
|
+
sentry_sdk.set_tag("vellum_trace_id", str(executor_context.trace_id))
|
|
212
216
|
logger.exception(event.body.error.message) # type: ignore
|
|
213
217
|
event.body.error = WorkflowError( # type: ignore
|
|
214
218
|
code=WorkflowErrorCode.INTERNAL_ERROR.value, message="Internal Error" # type: ignore
|
|
@@ -458,6 +462,7 @@ def _gather_workflow(context: WorkflowExecutorContext) -> Tuple[BaseWorkflow, st
|
|
|
458
462
|
)
|
|
459
463
|
return workflow, namespace
|
|
460
464
|
except Exception as e:
|
|
465
|
+
sentry_sdk.set_tag("vellum_trace_id", str(context.trace_id))
|
|
461
466
|
logger.exception("Failed to initialize Workflow")
|
|
462
467
|
raise WorkflowInitializationException(f"Failed to initialize workflow: {e}") from e
|
|
463
468
|
|
|
@@ -466,5 +471,6 @@ def _gather_display_context(workflow: BaseWorkflow, namespace: str) -> Optional[
|
|
|
466
471
|
try:
|
|
467
472
|
return BaseWorkflowDisplay.gather_event_display_context(namespace, workflow.__class__)
|
|
468
473
|
except Exception:
|
|
474
|
+
sentry_sdk.set_tag("vellum_trace_id", "unknown")
|
|
469
475
|
logger.exception("Unable to Parse Workflow Display Context")
|
|
470
476
|
return None
|
|
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
|
{vellum_workflow_server-0.14.72 → vellum_workflow_server-0.14.72.post2}/src/workflow_server/start.py
RENAMED
|
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
|