Skip to content

Commit 7bfe73a

Browse files
committed
fix: address second comments
1 parent fdb125e commit 7bfe73a

5 files changed

Lines changed: 28 additions & 36 deletions

File tree

src/uipath/_cli/_evals/_progress_reporter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@ async def subscribe_to_eval_runtime_events(self, event_bus: EventBus) -> None:
276276
EvaluationEvents.UPDATE_EVAL_SET_RUN, self.handle_update_eval_set_run
277277
)
278278

279-
# Only log in debug mode during evaluations
280-
if os.getenv("UIPATH_EVAL_DEBUG", "true") == "true":
281-
logger.info("StudioWeb progress reporter subscribed to evaluation events")
279+
logger.debug("StudioWeb progress reporter subscribed to evaluation events")
282280

283281
def _extract_agent_snapshot(self, entrypoint: str) -> StudioWebAgentSnapshot:
284282
try:

src/uipath/_cli/_evals/_runtime.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,9 @@ async def execute_runtime(
258258

259259
start_time = time()
260260

261-
try:
262-
result = await self.factory.execute_in_root_span(
263-
runtime_context, root_span=eval_item.name, attributes=attributes
264-
)
265-
except Exception as e:
266-
error_msg = str(e) or "Agent execution error"
267-
raise Exception(f"Agent execution failed: {error_msg}") from None
261+
result = await self.factory.execute_in_root_span(
262+
runtime_context, root_span=eval_item.name, attributes=attributes
263+
)
268264

269265
end_time = time()
270266

src/uipath/_cli/_runtime/_contracts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ async def __aenter__(self):
527527
dir=self.context.runtime_dir,
528528
file=self.context.logs_file,
529529
job_id=self.context.job_id,
530+
execution_id=self.context.execution_id,
530531
is_debug_run=self.is_debug_run(),
531532
log_handler=self.context.log_handler,
532533
)
@@ -650,7 +651,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
650651
raise
651652
finally:
652653
# Restore original logging
653-
if hasattr(self, "logs_interceptor") and self.logs_interceptor:
654+
if hasattr(self, "logs_interceptor"):
654655
self.logs_interceptor.teardown()
655656

656657
await self.cleanup()

src/uipath/_cli/cli_eval.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ def type_cast_value(self, ctx, value):
6363
type=click.Path(exists=False),
6464
help="File path where the output will be written",
6565
)
66-
@click.option(
67-
"--debug",
68-
is_flag=True,
69-
help="Show detailed debug logging output including middleware and HTTP requests",
70-
default=False,
71-
)
7266
@track(when=lambda *_a, **_kw: os.getenv(ENV_JOB_ID) is None)
7367
def eval(
7468
entrypoint: Optional[str],
@@ -77,7 +71,6 @@ def eval(
7771
no_report: bool,
7872
workers: int,
7973
output_file: Optional[str],
80-
debug: bool,
8174
) -> None:
8275
"""Run an evaluation set against the agent.
8376
@@ -87,16 +80,7 @@ def eval(
8780
eval_ids: Optional list of evaluation IDs
8881
workers: Number of parallel workers for running evaluations
8982
no_report: Do not report the evaluation results
90-
debug: Show detailed debug logging output
9183
"""
92-
# Suppress HTTP logs unless in debug mode
93-
if not debug:
94-
logging.getLogger("httpx").setLevel(logging.WARNING)
95-
logging.getLogger("urllib3.connectionpool").setLevel(logging.WARNING)
96-
os.environ["UIPATH_EVAL_DEBUG"] = "false"
97-
else:
98-
os.environ["UIPATH_EVAL_DEBUG"] = "true"
99-
10084
if not no_report and not os.getenv("UIPATH_FOLDER_KEY"):
10185
os.environ["UIPATH_FOLDER_KEY"] = asyncio.run(
10286
get_personal_workspace_key_async()
@@ -123,11 +107,8 @@ def eval(
123107
progress_reporter = StudioWebProgressReporter(LlmOpsHttpExporter())
124108
asyncio.run(progress_reporter.subscribe_to_eval_runtime_events(event_bus))
125109

126-
# Set up console progress reporter (only when not in debug mode)
110+
# Set up console progress reporter
127111
console_reporter = None
128-
if not debug:
129-
console_reporter = ConsoleProgressReporter()
130-
asyncio.run(console_reporter.subscribe_to_eval_runtime_events(event_bus))
131112

132113
def generate_runtime_context(**context_kwargs) -> UiPathRuntimeContext:
133114
runtime_context = UiPathRuntimeContext.with_defaults(**context_kwargs)
@@ -147,6 +128,20 @@ def generate_runtime_context(**context_kwargs) -> UiPathRuntimeContext:
147128
eval_context.eval_set = eval_set or EvalHelpers.auto_discover_eval_set()
148129
eval_context.eval_ids = eval_ids
149130

131+
# Set up HTTP logging at DEBUG level but not INFO level
132+
logs_min_level_str = getattr(eval_context, "logs_min_level", "INFO")
133+
logs_min_level = getattr(logging, logs_min_level_str.upper(), logging.INFO)
134+
if logs_min_level <= logging.DEBUG:
135+
logging.getLogger("httpx").setLevel(logging.DEBUG)
136+
logging.getLogger("urllib3.connectionpool").setLevel(logging.DEBUG)
137+
else:
138+
logging.getLogger("httpx").setLevel(logging.WARNING)
139+
logging.getLogger("urllib3.connectionpool").setLevel(logging.WARNING)
140+
141+
if logs_min_level <= logging.INFO:
142+
console_reporter = ConsoleProgressReporter()
143+
asyncio.run(console_reporter.subscribe_to_eval_runtime_events(event_bus))
144+
150145
try:
151146
runtime_factory = UiPathRuntimeFactory(
152147
UiPathScriptRuntime,
@@ -165,12 +160,14 @@ async def execute():
165160
await eval_runtime.execute()
166161
await event_bus.wait_for_all(timeout=10)
167162

168-
if console_reporter and not debug:
163+
if console_reporter:
169164
console_reporter.display_final_results()
170165

171166
asyncio.run(execute())
172167
except Exception as e:
173-
console.error(f"❌ Error occurred: {e or 'Execution failed'}")
168+
console.error(
169+
f"Error occurred: {e or 'Execution failed'}", include_traceback=True
170+
)
174171

175172

176173
if __name__ == "__main__":

src/uipath/_cli/middlewares.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,20 @@ def load_plugins(cls) -> None:
121121
]
122122

123123
if middlewares:
124-
logger.info(f"Found {len(middlewares)} middleware plugins")
124+
logger.debug(f"Found {len(middlewares)} middleware plugins")
125125

126126
for entry_point in middlewares:
127127
try:
128128
register_func = entry_point.load()
129129
register_func()
130-
logger.info(f"Loaded middleware plugin: {entry_point.name}")
130+
logger.debug(f"Loaded middleware plugin: {entry_point.name}")
131131
except Exception as e:
132132
console.error(
133133
f"Failed to load middleware plugin {entry_point.name}: {str(e)}",
134134
include_traceback=True,
135135
)
136136
else:
137-
logger.info("No middleware plugins found")
137+
logger.debug("No middleware plugins found")
138138

139139
except Exception as e:
140140
logger.error(f"No middleware plugins loaded: {str(e)}")

0 commit comments

Comments
 (0)