Skip to content

Commit c35781b

Browse files
committed
fix: add runtime_id to factory new_runtime
1 parent f0ad959 commit c35781b

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ from uipath.runtime import (
162162
)
163163

164164
class MyRuntimeFactory:
165-
async def new_runtime(self, entrypoint: str) -> UiPathRuntimeProtocol:
165+
async def new_runtime(self, entrypoint: str, runtime_id: str) -> UiPathRuntimeProtocol:
166166
return MyRuntime()
167167

168168
def discover_runtimes(self) -> list[UiPathRuntimeProtocol]:
@@ -173,7 +173,7 @@ class MyRuntimeFactory:
173173

174174

175175
factory = MyRuntimeFactory()
176-
runtime = await factory.new_runtime("example")
176+
runtime = await factory.new_runtime("example", "id")
177177

178178
result = await runtime.execute()
179179
print(result.output) # {'message': 'Hello from MyRuntime'}
@@ -343,7 +343,7 @@ class OrchestratorRuntime:
343343

344344
for i, child_input in enumerate(child_inputs):
345345
# Use the factory to create a new child runtime
346-
child_runtime = await self.factory.new_runtime(entrypoint=f"child-{i}")
346+
child_runtime = await self.factory.new_runtime(entrypoint=f"child-{i}", runtime_id=f"child-{i}")
347347

348348
# Wrap child runtime with tracing + logs
349349
execution_id = f"child-{i}"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.0.14"
3+
version = "0.0.15"
44
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/runtime/factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def discover_entrypoints(self) -> list[str]:
2020
class UiPathRuntimeCreatorProtocol(Protocol):
2121
"""Protocol for creating a UiPath runtime given an entrypoint."""
2222

23-
async def new_runtime(self, entrypoint: str) -> UiPathRuntimeProtocol:
23+
async def new_runtime(
24+
self, entrypoint: str, runtime_id: str
25+
) -> UiPathRuntimeProtocol:
2426
"""Create a new runtime instance."""
2527
...
2628

tests/test_executor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ class UiPathTestRuntimeFactory:
113113
def __init__(self, runtime_class: type[UiPathRuntimeProtocol]):
114114
self.runtime_class = runtime_class
115115

116-
async def new_runtime(self, entrypoint: str) -> UiPathRuntimeProtocol:
116+
async def new_runtime(
117+
self, entrypoint: str, runtime_id: str
118+
) -> UiPathRuntimeProtocol:
117119
return self.runtime_class()
118120

119121

@@ -128,21 +130,21 @@ async def test_multiple_factories_same_executor():
128130
factory_c = UiPathTestRuntimeFactory(MockRuntimeC)
129131

130132
# Execute runtime A
131-
runtime_a = await factory_a.new_runtime(entrypoint="")
133+
runtime_a = await factory_a.new_runtime(entrypoint="", runtime_id="runtime-a")
132134
execution_runtime_a = UiPathExecutionRuntime(
133135
runtime_a, trace_manager, "runtime-a-span", execution_id="exec-a"
134136
)
135137
result_a = await execution_runtime_a.execute({"input": "a"})
136138

137139
# Execute runtime B
138-
runtime_b = await factory_b.new_runtime(entrypoint="")
140+
runtime_b = await factory_b.new_runtime(entrypoint="", runtime_id="runtime-b")
139141
execution_runtime_b = UiPathExecutionRuntime(
140142
runtime_b, trace_manager, "runtime-b-span", execution_id="exec-b"
141143
)
142144
result_b = await execution_runtime_b.execute({"input": "b"})
143145

144146
# Execute runtime C with custom spans
145-
runtime_c = await factory_c.new_runtime(entrypoint="")
147+
runtime_c = await factory_c.new_runtime(entrypoint="", runtime_id="runtime-c")
146148
execution_runtime_c = UiPathExecutionRuntime(
147149
runtime_c, trace_manager, "runtime-c-span", execution_id="exec-c"
148150
)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)