micromegas 0.3.2__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- micromegas/__init__.py +0 -3
- {micromegas-0.3.2.dist-info → micromegas-0.4.0.dist-info}/METADATA +1 -1
- {micromegas-0.3.2.dist-info → micromegas-0.4.0.dist-info}/RECORD +4 -6
- micromegas/client.py +0 -117
- micromegas/request.py +0 -36
- {micromegas-0.3.2.dist-info → micromegas-0.4.0.dist-info}/WHEEL +0 -0
micromegas/__init__.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
micromegas/__init__.py,sha256=
|
2
|
-
micromegas/client.py,sha256=7d0aah179a5cfjmBRxcaq7jTPvmGg625D_ixzdvtgCw,3670
|
1
|
+
micromegas/__init__.py,sha256=TYFODSzzeVqdR3E1T3kTy73sOAYiQ9uh4rk8yMJ0hyM,284
|
3
2
|
micromegas/flightsql/FlightSql_pb2.py,sha256=s3CVAQ4W77ALQ9QYFlPZnPqVsRHTD5Ma0fzabQv_8Mc,28207
|
4
3
|
micromegas/flightsql/FlightSql_pb2_grpc.py,sha256=dCQT-tKxsz3dQgD4Cr0-8F4H0zCwNkXLHzlrbWfMiBA,890
|
5
4
|
micromegas/flightsql/Flight_pb2.py,sha256=nPe1utv8n59IdNsiv5sJYY10-K04pDVOhKDgV5t-h1A,12513
|
@@ -10,7 +9,6 @@ micromegas/flightsql/arrow_ipc_reader.py,sha256=3rxyEgqo5100e0TT9ZKZxNe7lX6Lk0mS
|
|
10
9
|
micromegas/flightsql/client.py,sha256=v4igU4nHZdaqBAw5qDtDNl6UBYiLvVnCJk1qDeO8LjE,11241
|
11
10
|
micromegas/flightsql/time.py,sha256=EH3SUEpFvY0lNMj9mOcvfUJuSgrQ3YX4aJnwteK2qhk,582
|
12
11
|
micromegas/perfetto.py,sha256=yuIe5iKvca61aWMBQNziSGM-DHcOEsiobtKx2SsNQ3E,7829
|
13
|
-
micromegas/request.py,sha256=NV0urom5P3_P2q94gX51hxW_Fnrp_DDRorsP3mUb5NM,941
|
14
12
|
micromegas/thirdparty/perfetto/protos/perfetto/common/android_energy_consumer_descriptor_pb2.py,sha256=l8QNXqnB-mJIkuFr2s1YoLQXHm3G-ZcOGp_OW_hQ0TE,1887
|
15
13
|
micromegas/thirdparty/perfetto/protos/perfetto/common/android_log_constants_pb2.py,sha256=O5zDZkV8Nji0O2ryJRP4FTWdgdOBlDymWNcpNNDOFxk,2017
|
16
14
|
micromegas/thirdparty/perfetto/protos/perfetto/common/builtin_clock_pb2.py,sha256=7qLL_BENTxRFQH8DfHDvyWAkgwy0VHrOaE8XhL8iZgk,1822
|
@@ -217,6 +215,6 @@ micromegas/thirdparty/perfetto/protos/perfetto/trace/translation/translation_tab
|
|
217
215
|
micromegas/thirdparty/perfetto/protos/perfetto/trace/trigger_pb2.py,sha256=We7Yi8o3cEcrSNxY1zLUUO6tEWnD36C2f3O_s8_qv0I,1435
|
218
216
|
micromegas/thirdparty/perfetto/protos/perfetto/trace/ui_state_pb2.py,sha256=Af-SXwhroNhRXMrtw6e2eU1liCImMRxSdmkt_AuSHf8,1752
|
219
217
|
micromegas/time.py,sha256=eD9fWF2UHxaf-92yd1X2SEgUcpKypqPsvjBosLdpnQA,1026
|
220
|
-
micromegas-0.
|
221
|
-
micromegas-0.
|
222
|
-
micromegas-0.
|
218
|
+
micromegas-0.4.0.dist-info/METADATA,sha256=XCqcxBrAlumvF1iUfQtuZdq7y9yE-enxWdKqDCAp_jA,30640
|
219
|
+
micromegas-0.4.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
220
|
+
micromegas-0.4.0.dist-info/RECORD,,
|
micromegas/client.py
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
from . import request
|
2
|
-
from . import time
|
3
|
-
import cbor2
|
4
|
-
|
5
|
-
|
6
|
-
class Client:
|
7
|
-
def __init__(self, base_url, headers={}):
|
8
|
-
self.analytics_base_url = base_url + "analytics/"
|
9
|
-
self.headers = headers
|
10
|
-
|
11
|
-
def find_process(self, process_id):
|
12
|
-
return request.request(
|
13
|
-
self.analytics_base_url + "find_process",
|
14
|
-
{"process_id": process_id},
|
15
|
-
headers=self.headers,
|
16
|
-
)
|
17
|
-
|
18
|
-
def find_stream(self, stream_id):
|
19
|
-
return request.request(
|
20
|
-
self.analytics_base_url + "find_stream",
|
21
|
-
{"stream_id": stream_id},
|
22
|
-
headers=self.headers,
|
23
|
-
)
|
24
|
-
|
25
|
-
def query_streams(self, begin, end, limit, process_id=None, tag_filter=None):
|
26
|
-
args = {
|
27
|
-
"begin": time.format_datetime(begin),
|
28
|
-
"end": time.format_datetime(end),
|
29
|
-
"limit": limit,
|
30
|
-
"process_id": process_id,
|
31
|
-
"tag_filter": tag_filter,
|
32
|
-
}
|
33
|
-
|
34
|
-
return request.request(
|
35
|
-
self.analytics_base_url + "query_streams",
|
36
|
-
args,
|
37
|
-
headers=self.headers,
|
38
|
-
)
|
39
|
-
|
40
|
-
def query_blocks(self, begin, end, limit, stream_id):
|
41
|
-
args = {
|
42
|
-
"begin": time.format_datetime(begin),
|
43
|
-
"end": time.format_datetime(end),
|
44
|
-
"limit": limit,
|
45
|
-
"stream_id": stream_id,
|
46
|
-
}
|
47
|
-
|
48
|
-
return request.request(
|
49
|
-
self.analytics_base_url + "query_blocks",
|
50
|
-
args,
|
51
|
-
headers=self.headers,
|
52
|
-
)
|
53
|
-
|
54
|
-
def query_view(self, view_set_name, view_instance_id, begin, end, sql):
|
55
|
-
return request.request(
|
56
|
-
self.analytics_base_url + "query_view",
|
57
|
-
{
|
58
|
-
"view_set_name": view_set_name,
|
59
|
-
"view_instance_id": view_instance_id,
|
60
|
-
"begin": time.format_datetime(begin),
|
61
|
-
"end": time.format_datetime(end),
|
62
|
-
"sql": sql,
|
63
|
-
},
|
64
|
-
headers=self.headers,
|
65
|
-
)
|
66
|
-
|
67
|
-
def query(self, sql, begin=None, end=None):
|
68
|
-
return request.request(
|
69
|
-
self.analytics_base_url + "query",
|
70
|
-
{
|
71
|
-
"sql": sql,
|
72
|
-
"begin": time.format_datetime(begin),
|
73
|
-
"end": time.format_datetime(end),
|
74
|
-
},
|
75
|
-
headers=self.headers,
|
76
|
-
)
|
77
|
-
|
78
|
-
def query_partitions(self):
|
79
|
-
args = {}
|
80
|
-
return request.request(
|
81
|
-
self.analytics_base_url + "query_partitions",
|
82
|
-
args,
|
83
|
-
headers=self.headers,
|
84
|
-
)
|
85
|
-
|
86
|
-
def __stream_request(self, endpoint, args):
|
87
|
-
response = request.streamed_request(
|
88
|
-
self.analytics_base_url + endpoint,
|
89
|
-
args,
|
90
|
-
headers=self.headers,
|
91
|
-
)
|
92
|
-
while response.raw.readable():
|
93
|
-
try:
|
94
|
-
print(cbor2.load(response.raw))
|
95
|
-
except cbor2.CBORDecodeEOF:
|
96
|
-
break
|
97
|
-
|
98
|
-
def materialize_partitions(
|
99
|
-
self, view_set_name, view_instance_id, begin, end, partition_delta_seconds
|
100
|
-
):
|
101
|
-
args = {
|
102
|
-
"view_set_name": view_set_name,
|
103
|
-
"view_instance_id": view_instance_id,
|
104
|
-
"begin": time.format_datetime(begin),
|
105
|
-
"end": time.format_datetime(end),
|
106
|
-
"partition_delta_seconds": partition_delta_seconds,
|
107
|
-
}
|
108
|
-
self.__stream_request("materialize_partitions", args)
|
109
|
-
|
110
|
-
def retire_partitions(self, view_set_name, view_instance_id, begin, end):
|
111
|
-
args = {
|
112
|
-
"view_set_name": view_set_name,
|
113
|
-
"view_instance_id": view_instance_id,
|
114
|
-
"begin": time.format_datetime(begin),
|
115
|
-
"end": time.format_datetime(end),
|
116
|
-
}
|
117
|
-
self.__stream_request("retire_partitions", args)
|
micromegas/request.py
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
import cbor2
|
2
|
-
import io
|
3
|
-
import pyarrow.parquet as pq
|
4
|
-
import requests
|
5
|
-
|
6
|
-
|
7
|
-
def request(url, args, headers={}):
|
8
|
-
response = requests.post(
|
9
|
-
url,
|
10
|
-
headers=headers,
|
11
|
-
data=cbor2.dumps(args),
|
12
|
-
)
|
13
|
-
if response.status_code != 200:
|
14
|
-
raise Exception(
|
15
|
-
"http request url={2} failed with code={0} text={1}".format(
|
16
|
-
response.status_code, response.text, url
|
17
|
-
)
|
18
|
-
)
|
19
|
-
table = pq.read_table(io.BytesIO(response.content))
|
20
|
-
return table.to_pandas()
|
21
|
-
|
22
|
-
def streamed_request(url, args, headers={}):
|
23
|
-
response = requests.post(
|
24
|
-
url,
|
25
|
-
headers=headers,
|
26
|
-
data=cbor2.dumps(args),
|
27
|
-
stream=True,
|
28
|
-
timeout=300,
|
29
|
-
)
|
30
|
-
if response.status_code != 200:
|
31
|
-
raise Exception(
|
32
|
-
"http request url={2} failed with code={0} text={1}".format(
|
33
|
-
response.status_code, response.text, url
|
34
|
-
)
|
35
|
-
)
|
36
|
-
return response
|
File without changes
|