Skip to content

Commit bc935f3

Browse files
committed
fix: remove tracing, decouple executor
1 parent 01a125b commit bc935f3

File tree

16 files changed

+135
-951
lines changed

16 files changed

+135
-951
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.0.1"
3+
version = "0.0.2"
44
description = "UiPath Runtime abstractions"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
77
dependencies = [
88
"opentelemetry-sdk>=1.38.0",
99
"opentelemetry-instrumentation>=0.59b0",
1010
"pydantic>=2.12.3",
11+
"uipath-core>=0.0.1",
1112
]
1213
classifiers = [
1314
"Intended Audience :: Developers",

src/uipath/runtime/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from uipath.runtime.base import UiPathBaseRuntime
44
from uipath.runtime.context import UiPathRuntimeContext
55
from uipath.runtime.events import UiPathRuntimeEvent
6-
from uipath.runtime.factory import UiPathRuntimeFactory
6+
from uipath.runtime.factory import UiPathRuntimeExecutor, UiPathRuntimeFactory
77
from uipath.runtime.result import (
88
UiPathApiTrigger,
99
UiPathBreakpointResult,
@@ -16,10 +16,11 @@
1616
"UiPathRuntimeContext",
1717
"UiPathBaseRuntime",
1818
"UiPathRuntimeFactory",
19+
"UiPathRuntimeExecutor",
1920
"UiPathRuntimeResult",
2021
"UiPathRuntimeEvent",
22+
"UiPathBreakpointResult",
2123
"UiPathApiTrigger",
2224
"UiPathResumeTrigger",
2325
"UiPathResumeTriggerType",
24-
"UiPathBreakpointResult",
2526
]

src/uipath/runtime/base.py

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
import logging
55
import os
66
from abc import ABC, abstractmethod
7-
from typing import (
8-
AsyncGenerator,
9-
List,
10-
Optional,
11-
Union,
12-
)
13-
14-
from pydantic import BaseModel
7+
from typing import AsyncGenerator
158

169
from uipath.runtime.context import UiPathRuntimeContext
1710
from uipath.runtime.errors import (
@@ -26,8 +19,7 @@
2619
from uipath.runtime.logging._interceptor import UiPathRuntimeLogsInterceptor
2720
from uipath.runtime.result import UiPathRuntimeResult, UiPathRuntimeStatus
2821
from uipath.runtime.schema import (
29-
UiPathRuntimeBindingResource,
30-
UiPathRuntimeEntrypoint,
22+
UiPathRuntimeSchema,
3123
)
3224

3325
logger = logging.getLogger(__name__)
@@ -49,28 +41,8 @@ def __init__(self, context: UiPathRuntimeContext):
4941
"""Initialize the runtime with the provided context."""
5042
self.context = context
5143

52-
@classmethod
53-
def from_context(cls, context: UiPathRuntimeContext):
54-
"""Factory method to create a runtime instance from a context.
55-
56-
Args:
57-
context: The runtime context with configuration
58-
59-
Returns:
60-
An initialized Runtime instance
61-
"""
62-
runtime = cls(context)
63-
return runtime
64-
65-
async def get_binding_resources(self) -> List[UiPathRuntimeBindingResource]:
66-
"""Get binding resources for this runtime.
67-
68-
Returns: A list of binding resources.
69-
"""
70-
raise NotImplementedError()
71-
72-
async def get_entrypoint(self) -> UiPathRuntimeEntrypoint:
73-
"""Get entrypoint for this runtime.
44+
async def get_schema(self) -> UiPathRuntimeSchema:
45+
"""Get schema for this runtime.
7446
7547
Returns: A entrypoint for this runtime.
7648
"""
@@ -130,7 +102,7 @@ async def __aenter__(self):
130102
return self
131103

132104
@abstractmethod
133-
async def execute(self) -> Optional[UiPathRuntimeResult]:
105+
async def execute(self) -> UiPathRuntimeResult:
134106
"""Execute with the provided context.
135107
136108
Returns:
@@ -143,7 +115,7 @@ async def execute(self) -> Optional[UiPathRuntimeResult]:
143115

144116
async def stream(
145117
self,
146-
) -> AsyncGenerator[Union[UiPathRuntimeEvent, UiPathRuntimeResult], None]:
118+
) -> AsyncGenerator[UiPathRuntimeEvent]:
147119
"""Stream execution events in real-time.
148120
149121
This is an optional method that runtimes can implement to support streaming.
@@ -233,12 +205,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
233205
# Write the execution output to file if requested
234206
if self.context.output_file:
235207
with open(self.context.output_file, "w") as f:
236-
if isinstance(execution_result.output, BaseModel):
237-
f.write(execution_result.output.model_dump())
238-
else:
239-
json.dump(
240-
execution_result.output or {}, f, indent=2, default=str
241-
)
208+
f.write(content.get("output", "{}"))
242209

243210
# Don't suppress exceptions
244211
return False

src/uipath/runtime/context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
from uuid import uuid4
1515

1616
from pydantic import BaseModel
17+
from uipath.core.tracing.context import UiPathTraceContext
1718

18-
from .result import UiPathRuntimeResult
19-
from .tracing.context import UiPathTraceContext
19+
from uipath.runtime.result import UiPathRuntimeResult
2020

2121
C = TypeVar("C", bound="UiPathRuntimeContext")
2222

src/uipath/runtime/events/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class UiPathRuntimeEventType(str, Enum):
1212
RUNTIME_MESSAGE = "runtime_message"
1313
RUNTIME_STATE = "runtime_state"
1414
RUNTIME_ERROR = "runtime_error"
15+
RUNTIME_RESULT = "runtime_result"
1516

1617

1718
class UiPathRuntimeEvent(BaseModel):

0 commit comments

Comments
 (0)