# Retry / reboot is handled here script_dir = os.getenv('HELIX_WORKITEM_ROOT') if os.path.exists(os.path.join(script_dir, '.retry')): retry = True if os.path.exists(os.path.join(script_dir, '.reboot')): reboot = True if retry: # TODO (https://github.com/dotnet/core-eng/issues/15274): Stop sending app insights telemetry app_insights.send_metric(RETRY_METRIC_NAME, retry_exit_code, properties=retry_dimensions) send_metric(KUSTO_RETRY_METRIC_NAME, retry_exit_code, retry_dimensions, event_type=KUSTO_EVENT_TYPE) request_infra_retry( 'Requesting work item retry because an infrastructure issue was detected on this machine' ) # TODO https://github.com/dotnet/core-eng/issues/15059 # We need to remove testResults.xml so that it is not uploaded since this run will be discarded # This is a workaround until we make AzDO reporter not upload test results test_results = os.path.join(output_directory, "testResults.xml") if os.path.exists(test_results): os.remove(test_results) if reboot: # TODO (https://github.com/dotnet/core-eng/issues/15274): Stop sending app insights telemetry app_insights.send_metric(REBOOT_METRIC_NAME,
if is_device is not None: custom_dimensions['isDevice'] = 'true' if str(is_device).lower() == 'true' else 'false' if 'target' in operation: if 'targetOS' in operation: custom_dimensions['target'] = target + ':' + target_os else: custom_dimensions['target'] = target elif 'targetOS' in operation: custom_dimensions['target'] = target_os try: analyze_operation(command, platform, device, is_device, target, exit_code) except AdditionalTelemetryRequired as e: send_metric(e.metric_name, e.metric_value, custom_dimensions, event_type=EVENT_TYPE) except Exception as e: print(f' Failed to analyze operation: {e}') # Note down the dimensions that caused retry/reboot if retry and retry_dimensions is None: retry_dimensions = custom_dimensions retry_exit_code = exit_code if reboot and reboot_dimensions is None: reboot_dimensions = custom_dimensions kusto_metrics = dict() kusto_metrics[OPERATION_METRIC_NAME] = exit_code kusto_metrics[DURATION_METRIC_NAME] = duration