Skip to content

Commit ea7ed67

Browse files
committed
drop kusto
1 parent fa7a447 commit ea7ed67

File tree

2 files changed

+2
-55
lines changed

2 files changed

+2
-55
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,17 +1174,8 @@ jobs:
11741174
azdev statistics list-command-table CLI --statistics-only
11751175
# CLI + EXT repos
11761176
azdev statistics list-command-table --statistics-only > /tmp/codegen_report.json
1177-
# azure-kusto is not compatible with azure-cli
1178-
# so we need run azdev statistics before installing azure-kusto to avoid the error `No module named azure.cli`
1179-
pip install azure-kusto-data azure-kusto-ingest
11801177
python s/scripts/ci/codegen_report.py
11811178
env:
11821179
BUILD_ID: $(Build.BuildId)
11831180
BUILD_BRANCH: $(Build.SourceBranchName)
1184-
KUSTO_CLIENT_ID: $(KUSTO_CLIENT_ID)
1185-
KUSTO_CLIENT_SECRET: $(KUSTO_CLIENT_SECRET)
1186-
KUSTO_CLUSTER: $(KUSTO_CLUSTER)
1187-
KUSTO_DATABASE: $(KUSTO_DATABASE)
1188-
KUSTO_TABLE: $(KUSTO_TABLE)
1189-
KUSTO_TENANT_ID: $(KUSTO_TENANT_ID)
1190-
enabled: false
1181+
enabled: true

scripts/ci/codegen_report.py

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,10 @@
55
# Licensed under the MIT License. See License.txt in the project root for license information.
66
# --------------------------------------------------------------------------------------------
77

8-
from azure.kusto.data import KustoConnectionStringBuilder
9-
from azure.kusto.data.data_format import DataFormat
10-
from azure.kusto.ingest import (
11-
IngestionProperties,
12-
QueuedIngestClient,
13-
ReportLevel,
14-
)
15-
import csv
168
import datetime
179
import json
1810
import logging
1911
import os
20-
import subprocess
21-
import sys
2212

2313
logger = logging.getLogger(__name__)
2414
logger.setLevel(logging.DEBUG)
@@ -28,14 +18,6 @@
2818

2919
BUILD_ID = os.environ.get('BUILD_ID', None)
3020
BUILD_BRANCH = os.environ.get('BUILD_BRANCH', None)
31-
# authenticate with AAD application.
32-
KUSTO_CLIENT_ID = os.environ.get('KUSTO_CLIENT_ID')
33-
KUSTO_CLIENT_SECRET = os.environ.get('KUSTO_CLIENT_SECRET')
34-
KUSTO_CLUSTER = os.environ.get('KUSTO_CLUSTER')
35-
KUSTO_DATABASE = os.environ.get('KUSTO_DATABASE')
36-
KUSTO_TABLE = os.environ.get('KUSTO_TABLE')
37-
# get tenant id from https://docs.microsoft.com/en-us/onedrive/find-your-office-365-tenant-id
38-
KUSTO_TENANT_ID = os.environ.get('KUSTO_TENANT_ID')
3921

4022

4123
def generate_csv():
@@ -53,31 +35,5 @@ def generate_csv():
5335
return data
5436

5537

56-
def send_to_kusto(data):
57-
logger.info('Start send codegen report csv data to kusto db')
58-
59-
with open(f'/tmp/codegen_report.csv', mode='w', newline='') as file:
60-
writer = csv.writer(file)
61-
writer.writerows(data)
62-
63-
kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(KUSTO_CLUSTER, KUSTO_CLIENT_ID, KUSTO_CLIENT_SECRET, KUSTO_TENANT_ID)
64-
# The authentication method will be taken from the chosen KustoConnectionStringBuilder.
65-
client = QueuedIngestClient(kcsb)
66-
67-
# there are a lot of useful properties, make sure to go over docs and check them out
68-
ingestion_props = IngestionProperties(
69-
database=KUSTO_DATABASE,
70-
table=KUSTO_TABLE,
71-
data_format=DataFormat.CSV,
72-
report_level=ReportLevel.FailuresAndSuccesses
73-
)
74-
75-
# ingest from file
76-
result = client.ingest_from_file(f"/tmp/codegen_report.csv", ingestion_properties=ingestion_props)
77-
# Inspect the result for useful information, such as source_id and blob_url
78-
print(repr(result))
79-
logger.info('Finsh send codegen report csv data to kusto db.')
80-
81-
8238
if __name__ == '__main__':
83-
send_to_kusto(generate_csv())
39+
generate_csv()

0 commit comments

Comments
 (0)