ga-api-client 0.5.2__tar.gz → 0.5.4__tar.gz

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.
Files changed (20) hide show
  1. {ga_api_client-0.5.2/ga_api_client.egg-info → ga_api_client-0.5.4}/PKG-INFO +1 -1
  2. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/ga_api_client.py +18 -16
  3. {ga_api_client-0.5.2 → ga_api_client-0.5.4/ga_api_client.egg-info}/PKG-INFO +1 -1
  4. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/setup.cfg +1 -1
  5. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/LICENSE +0 -0
  6. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/README.md +0 -0
  7. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/__init__.py +0 -0
  8. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/average.py +0 -0
  9. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/capture.py +0 -0
  10. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/field_tree.py +0 -0
  11. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/hyper_log_log.py +0 -0
  12. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/rate.py +0 -0
  13. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/std.py +0 -0
  14. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api/tdigest.py +0 -0
  15. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api_client.egg-info/SOURCES.txt +0 -0
  16. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api_client.egg-info/dependency_links.txt +0 -0
  17. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api_client.egg-info/requires.txt +0 -0
  18. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/ga_api_client.egg-info/top_level.txt +0 -0
  19. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/pyproject.toml +0 -0
  20. {ga_api_client-0.5.2 → ga_api_client-0.5.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ga-api-client
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: License :: OSI Approved :: MIT License
6
6
  Classifier: Operating System :: OS Independent
@@ -409,16 +409,18 @@ class Reader:
409
409
  async def _exec(self, start, end):
410
410
  start = _get_utc_timestamp(start)
411
411
  end = _get_utc_timestamp(end)
412
- if 'config' not in self.pipeline:
413
- self.pipeline['config'] = {}
414
- self.pipeline['config']['start'] = start
415
- self.pipeline['config']['end'] = end
416
- self.pipeline['config']['size'] = self.size
417
- self.pipeline['config']['series'] = self.series
412
+ pipeline = self.pipeline.copy()
413
+ if 'config' not in pipeline:
414
+ pipeline['config'] = {}
415
+ pipeline['config']['start'] = start
416
+ pipeline['config']['end'] = end
417
+ pipeline['config']['size'] = self.size
418
+ pipeline['config']['series'] = self.series
418
419
  if self.fields is not None:
419
- self.pipeline['config']['fields'] = self.fields
420
- status, rlt = await self._client._request('POST', f'/record', [200], self.pipeline, self.test_fn)
421
- logging.info(f'/record status={status} start={_logtime(start)} end={_logtime(end)} series={self.series}')
420
+ pipeline['config']['fields'] = self.fields
421
+ status, rlt = await self._client._request('POST', f'/record', [200], pipeline, self.test_fn)
422
+ if status != 0:
423
+ logging.info(f'/record status={status} start={_logtime(start)} end={_logtime(end)} series={self.series}')
422
424
  if rlt is not None and len(rlt) > 0:
423
425
  self.count += len(rlt) - 1 # skip first row, which is header
424
426
  return pd.DataFrame(rlt[1:], columns=rlt[0])
@@ -451,10 +453,9 @@ class Reader:
451
453
  df = pd.concat([df, rlt], ignore_index=True, copy=False)
452
454
  if len(df) >= self.size:
453
455
  break
454
- if self.fields is None:
455
- return df.head(self.size)
456
- else:
456
+ if self.fields is not None and len(df) != 0:
457
457
  return df.head(self.size)[self.fields]
458
+ return df.head(self.size)
458
459
  except Exception as e:
459
460
  logging.error(f'execute record fail {e}')
460
461
  for task in tasks:
@@ -657,7 +658,7 @@ def _compute_kcol_mcol(pipeline):
657
658
  moper = []
658
659
  if 'bucket' in pipeline:
659
660
  for bkt in pipeline['bucket']:
660
- if bkt[0] in ['$distinctTuple','enumTuple']:
661
+ if bkt[0] in ['$distinctTuple','$enumTuple', '$distinctTree']:
661
662
  # each field introduce one key column
662
663
  kcol += len(bkt[1]['fields'])
663
664
  else:
@@ -704,9 +705,10 @@ class _translate_table:
704
705
  output_row.append(tuple(elem))
705
706
  else:
706
707
  output_row.append(elem)
707
- else:
708
- moper_idx = self.moper[int((idx-self.kcol)/2)]
709
- output_row.append(MOPER_MAP[moper_idx](elem))
708
+ else: # metric
709
+ moper_idx = int((idx-self.kcol)/2)
710
+ moper = self.moper[moper_idx]
711
+ output_row.append(MOPER_MAP[moper](elem))
710
712
  yield output_row
711
713
 
712
714
  class _translate_rlts:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ga-api-client
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: License :: OSI Approved :: MIT License
6
6
  Classifier: Operating System :: OS Independent
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ga-api-client
3
- version = 0.5.2
3
+ version = 0.5.4
4
4
  long_description = file: README.md
5
5
  long_description_content_type = text/markdown
6
6
  classifiers =
File without changes
File without changes
File without changes