bizon 0.0.4.dev3__tar.gz → 0.0.4.dev4__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 (89) hide show
  1. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/PKG-INFO +1 -1
  2. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/cli/main.py +14 -9
  3. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/cli/utils.py +11 -5
  4. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/destination.py +24 -18
  5. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/backend/adapters/sqlalchemy/backend.py +1 -1
  6. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/backend/models.py +0 -1
  7. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/pipeline/producer.py +2 -1
  8. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/runner/config.py +11 -2
  9. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/runner/runner.py +10 -1
  10. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/periscope/src/source.py +8 -6
  11. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/pyproject.toml +1 -1
  12. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/LICENSE +0 -0
  13. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/README.md +0 -0
  14. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/__main__.py +0 -0
  15. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/cli/__init__.py +0 -0
  16. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/common/errors/backoff.py +0 -0
  17. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/common/errors/errors.py +0 -0
  18. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/common/models.py +0 -0
  19. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/bigquery/config/bigquery.example.yml +0 -0
  20. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/bigquery/src/config.py +0 -0
  21. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/bigquery/src/destination.py +0 -0
  22. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/bigquery/tests/test_bigquery_client.py +0 -0
  23. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/buffer.py +0 -0
  24. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/config.py +0 -0
  25. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/file/src/config.py +0 -0
  26. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/file/src/destination.py +0 -0
  27. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/logger/src/config.py +0 -0
  28. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/logger/src/destination.py +0 -0
  29. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/destinations/models.py +0 -0
  30. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/backend/adapters/sqlalchemy/config.py +0 -0
  31. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/backend/backend.py +0 -0
  32. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/backend/config.py +0 -0
  33. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/config.py +0 -0
  34. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/engine.py +0 -0
  35. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/pipeline/consumer.py +0 -0
  36. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/pipeline/models.py +0 -0
  37. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/kafka/config.py +0 -0
  38. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/kafka/consumer.py +0 -0
  39. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/kafka/queue.py +0 -0
  40. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/python_queue/config.py +0 -0
  41. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/python_queue/consumer.py +0 -0
  42. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/python_queue/queue.py +0 -0
  43. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/rabbitmq/config.py +0 -0
  44. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/rabbitmq/consumer.py +0 -0
  45. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/adapters/rabbitmq/queue.py +0 -0
  46. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/config.py +0 -0
  47. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/queue/queue.py +0 -0
  48. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/runner/adapters/process.py +0 -0
  49. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/runner/adapters/thread.py +0 -0
  50. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/engine/runner/models.py +0 -0
  51. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/authenticators/abstract_oauth.py +0 -0
  52. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/authenticators/abstract_token.py +0 -0
  53. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/authenticators/basic.py +0 -0
  54. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/authenticators/cookies.py +0 -0
  55. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/authenticators/oauth.py +0 -0
  56. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/authenticators/token.py +0 -0
  57. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/builder.py +0 -0
  58. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/auth/config.py +0 -0
  59. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/config.py +0 -0
  60. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/cursor.py +0 -0
  61. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/discover.py +0 -0
  62. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/models.py +0 -0
  63. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/session.py +0 -0
  64. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/source/source.py +0 -0
  65. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/config/api_key.example.yml +0 -0
  66. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/config/api_key_kafka.example.yml +0 -0
  67. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/src/fake_api.py +0 -0
  68. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/src/source.py +0 -0
  69. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/tests/dummy_pipeline.py +0 -0
  70. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/tests/dummy_pipeline_bigquery_backend.py +0 -0
  71. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/tests/dummy_pipeline_kafka.py +0 -0
  72. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/tests/dummy_pipeline_rabbitmq.py +0 -0
  73. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/tests/dummy_pipeline_write_data_bigquery.py +0 -0
  74. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/dummy/tests/dummy_pipeline_write_data_bigquery_through_kafka.py +0 -0
  75. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/gsheets/config/default_auth.example.yml +0 -0
  76. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/gsheets/config/service_account.example.yml +0 -0
  77. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/gsheets/src/source.py +0 -0
  78. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/gsheets/tests/gsheets_pipeline.py +0 -0
  79. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/hubspot/config/api_key.example.yml +0 -0
  80. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/hubspot/config/oauth.example.yml +0 -0
  81. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/hubspot/src/hubspot_base.py +0 -0
  82. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/hubspot/src/hubspot_objects.py +0 -0
  83. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/hubspot/src/models/hs_object.py +0 -0
  84. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/hubspot/tests/hubspot_pipeline.py +0 -0
  85. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/periscope/config/periscope_charts.example.yml +0 -0
  86. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/periscope/config/periscope_dashboards.example.yml +0 -0
  87. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/periscope/tests/periscope_pipeline_charts.py +0 -0
  88. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/sources/periscope/tests/periscope_pipeline_dashboard.py +0 -0
  89. {bizon-0.0.4.dev3 → bizon-0.0.4.dev4}/bizon/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bizon
3
- Version: 0.0.4.dev3
3
+ Version: 0.0.4.dev4
4
4
  Summary: Extract and load your data reliably from API Clients with native fault-tolerant and checkpointing mechanism.
5
5
  Author: Antoine Balliet
6
6
  Author-email: antoine.balliet@gmail.com
@@ -1,12 +1,13 @@
1
1
  import click
2
2
 
3
3
  from bizon.engine.engine import RunnerFactory
4
+ from bizon.engine.runner.config import LoggerLevel
4
5
  from bizon.source.discover import discover_all_sources
5
6
 
6
7
  from .utils import (
7
8
  parse_from_yaml,
8
9
  set_custom_source_path_in_config,
9
- set_debug_mode,
10
+ set_log_level,
10
11
  set_runner_in_config,
11
12
  )
12
13
 
@@ -88,25 +89,29 @@ def destination():
88
89
  help="Runner type to use. Thread or Process.",
89
90
  )
90
91
  @click.option(
91
- "--debug",
92
+ "--log-level",
92
93
  required=False,
93
- is_flag=True,
94
+ type=click.Choice([level.name for level in LoggerLevel]),
94
95
  show_default=True,
95
- default=False,
96
- help="Enable debug mode.",
96
+ help="Log level to use.",
97
97
  )
98
- def run(filename: str, custom_source: str, runner: str, debug, help="Run a bizon pipeline from a YAML file."):
98
+ def run(
99
+ filename: str,
100
+ custom_source: str,
101
+ runner: str,
102
+ log_level: LoggerLevel,
103
+ help="Run a bizon pipeline from a YAML file.",
104
+ ):
99
105
  """Run a bizon pipeline from a YAML file."""
100
- ctx = click.get_current_context()
101
106
 
102
107
  # Parse config from YAML file as a dictionary
103
108
  config = parse_from_yaml(filename)
104
109
 
105
110
  # Set debug mode
106
- set_debug_mode(debug)
111
+ set_log_level(config=config, level=log_level)
107
112
 
108
113
  # Override source_file_path param in config
109
- set_custom_source_path_in_config(config=config, custom_source=ctx.get_parameter_source("custom-source"))
114
+ set_custom_source_path_in_config(config=config, custom_source=custom_source)
110
115
 
111
116
  # Override runner param in config
112
117
  set_runner_in_config(config=config, runner=runner)
@@ -1,5 +1,3 @@
1
- import os
2
-
3
1
  import yaml
4
2
 
5
3
 
@@ -9,10 +7,17 @@ def parse_from_yaml(path_to_yaml) -> dict:
9
7
  return config
10
8
 
11
9
 
12
- def set_debug_mode(debug: bool):
10
+ # TODO: Refacto
11
+ def set_log_level(config: dict, level: str):
13
12
  # Set Log Level to DEBUG
14
- if debug:
15
- os.environ["LOGURU_LEVEL"] = "DEBUG"
13
+ if level:
14
+ if "engine" not in config:
15
+ config["engine"] = {}
16
+
17
+ if "runner" not in config["engine"]:
18
+ config["engine"]["runner"] = {"log_level": level}
19
+
20
+ config["engine"]["runner"]["log_level"] = level
16
21
 
17
22
 
18
23
  def set_custom_source_path_in_config(config: dict, custom_source: str):
@@ -20,6 +25,7 @@ def set_custom_source_path_in_config(config: dict, custom_source: str):
20
25
  config["source"]["source_file_path"] = custom_source
21
26
 
22
27
 
28
+ # TODO: Refacto
23
29
  def set_runner_in_config(config: dict, runner: str):
24
30
  if runner:
25
31
  if "engine" not in config:
@@ -83,29 +83,24 @@ class AbstractDestination(ABC):
83
83
  self.delete_table()
84
84
 
85
85
  def buffer_flush_handler(self, session=None) -> DestinationIteration:
86
- nb_records_to_write = len(self.buffer.records)
86
+ # TODO: Add retry strategy
87
+
87
88
  # Initialize destination iteration
88
89
  destination_iteration = DestinationIteration(
89
90
  success=False,
90
91
  records_written=0,
91
92
  pagination=self.buffer.pagination,
92
93
  )
94
+
93
95
  success, error_msg = self.write_records(destination_records=self.buffer.records)
96
+
94
97
  if success:
95
- destination_iteration.records_written = nb_records_to_write
96
- self.backend.update_stream_job_status(
97
- job_id=self.sync_metadata.job_id,
98
- job_status=JobStatus.SUCCEEDED,
99
- session=session,
100
- )
98
+ # We wrote records to destination so we keep it
99
+ destination_iteration.records_written = len(self.buffer.records)
101
100
 
102
101
  else:
103
- self.backend.update_stream_job_status(
104
- job_id=self.sync_metadata.job_id,
105
- job_status=JobStatus.FAILED,
106
- error_message=error_msg,
107
- session=session,
108
- )
102
+ # We failed to write records to destination so we keep the error message
103
+ destination_iteration.error_message = error_msg
109
104
 
110
105
  destination_iteration.success = success
111
106
  destination_iteration.from_source_iteration = self.buffer.from_iteration
@@ -115,6 +110,8 @@ class AbstractDestination(ABC):
115
110
  # Update destination cursor
116
111
  self.create_cursors(destination_iteration=destination_iteration)
117
112
 
113
+ return destination_iteration
114
+
118
115
  def write_or_buffer_records(
119
116
  self,
120
117
  destination_records: List[DestinationRecord],
@@ -129,7 +126,16 @@ class AbstractDestination(ABC):
129
126
  if last_iteration:
130
127
  logger.debug("Writing last iteration records to destination")
131
128
  assert len(destination_records) == 0, "Last iteration should not have any records"
132
- self.buffer_flush_handler(session=session)
129
+ destination_iteration = self.buffer_flush_handler(session=session)
130
+
131
+ if destination_iteration.success:
132
+ # Update job status to success
133
+ self.backend.update_stream_job_status(
134
+ job_id=self.sync_metadata.job_id,
135
+ job_status=JobStatus.SUCCEEDED,
136
+ session=session,
137
+ )
138
+
133
139
  self.buffer.flush()
134
140
  return DestinationBufferStatus.RECORDS_WRITTEN
135
141
 
@@ -140,7 +146,7 @@ class AbstractDestination(ABC):
140
146
 
141
147
  # Write records to destination if buffer size is 0
142
148
  if self.buffer.buffer_size == 0:
143
- logger.debug("Writing last iteration records to destination")
149
+ logger.info("Writing last iteration records to destination")
144
150
  self.buffer.add_source_iteration_records_to_buffer(
145
151
  iteration=iteration, records=destination_records, pagination=pagination
146
152
  )
@@ -148,15 +154,15 @@ class AbstractDestination(ABC):
148
154
  self.buffer.flush()
149
155
  return DestinationBufferStatus.RECORDS_WRITTEN
150
156
 
151
- logger.info(f"Buffer free space {self.buffer.buffer_free_space_pct}%")
152
- logger.info(f"Buffer current size {self.buffer.current_size} bytes")
157
+ logger.debug(f"Buffer free space {self.buffer.buffer_free_space_pct}%")
158
+ logger.debug(f"Buffer current size {self.buffer.current_size} bytes")
153
159
  logger.info(
154
160
  f"Buffer ripeness {self.buffer.ripeness / 60} min. Max ripeness {self.buffer.buffer_flush_timeout / 60} min." # noqa
155
161
  )
156
162
 
157
163
  # Write buffer to destination if buffer is ripe and create a new buffer for the new iteration
158
164
  if self.buffer.is_ripe:
159
- logger.debug(
165
+ logger.info(
160
166
  f"Buffer is ripe (buffering for longer than buffer_flush_timeout: {self.buffer.buffer_flush_timeout} seconds), writing buffer to destination" # noqa
161
167
  )
162
168
  self.buffer_flush_handler(session=session)
@@ -252,7 +252,7 @@ class SQLAlchemyBackend(AbstractBackend):
252
252
  if job:
253
253
  return job
254
254
 
255
- logger.debug(f"No running job found for source={source_name} stream={stream_name}")
255
+ logger.info(f"No running job found for source={source_name} stream={stream_name}")
256
256
  return None
257
257
 
258
258
  #### SOURCE CURSOR ####
@@ -18,7 +18,6 @@ def generate_uuid():
18
18
  class JobStatus(str, Enum):
19
19
  STARTED = "started"
20
20
  RUNNING = "running"
21
- SUCCESS = "success"
22
21
  FAILED = "failed"
23
22
  CANCELED = "cancelled"
24
23
  SUCCEEDED = "succeeded"
@@ -1,11 +1,12 @@
1
1
  import ast
2
+ import os
2
3
  from datetime import datetime
3
4
 
4
5
  from loguru import logger
5
6
  from pytz import UTC
6
7
 
7
8
  from bizon.engine.backend.backend import AbstractBackend
8
- from bizon.engine.backend.models import CursorStatus, DestinationCursor
9
+ from bizon.engine.backend.models import CursorStatus
9
10
  from bizon.engine.queue.queue import AbstractQueue
10
11
  from bizon.source.cursor import Cursor
11
12
  from bizon.source.source import AbstractSource
@@ -9,6 +9,15 @@ class RunnerTypes(str, Enum):
9
9
  PROCESS = "process"
10
10
 
11
11
 
12
+ class LoggerLevel(str, Enum):
13
+ TRACE = "TRACE"
14
+ DEBUG = "DEBUG"
15
+ INFO = "INFO"
16
+ WARNING = "WARNING"
17
+ ERROR = "ERROR"
18
+ CRITICAL = "CRITICAL"
19
+
20
+
12
21
  class RunnerFuturesConfig(BaseModel):
13
22
  max_workers: Optional[int] = Field(
14
23
  description="Number of workers to use for the runner",
@@ -36,7 +45,7 @@ class RunnerConfig(BaseModel):
36
45
  default=RunnerFuturesConfig(),
37
46
  )
38
47
 
39
- log_level: str = Field(
48
+ log_level: LoggerLevel = Field(
40
49
  description="Logging level",
41
- default="INFO",
50
+ default=LoggerLevel.INFO,
42
51
  )
@@ -1,3 +1,5 @@
1
+ import os
2
+ import sys
1
3
  from abc import ABC, abstractmethod
2
4
 
3
5
  from loguru import logger
@@ -23,6 +25,11 @@ class AbstractRunner(ABC):
23
25
  self.config: dict = config
24
26
  self.bizon_config = BizonConfig.model_validate(obj=config)
25
27
 
28
+ # Set log level
29
+ logger.info(f"Setting log level to {self.bizon_config.engine.runner.log_level.name}")
30
+ logger.remove()
31
+ logger.add(sys.stderr, level=self.bizon_config.engine.runner.log_level)
32
+
26
33
  @property
27
34
  def is_running(self) -> bool:
28
35
  """Return True if the pipeline is running"""
@@ -103,7 +110,7 @@ class AbstractRunner(ABC):
103
110
  logger.info(f"Job {job.id} canceled. Creating a new one...")
104
111
  # Otherwise we return the existing job
105
112
  else:
106
- logger.debug(f"Found an existing job: {job.id}")
113
+ logger.info(f"Found an existing job: {job.id}")
107
114
  return job
108
115
 
109
116
  # If no job is running, we create a new one:
@@ -119,6 +126,8 @@ class AbstractRunner(ABC):
119
126
  job_status=JobStatus.STARTED,
120
127
  )
121
128
 
129
+ logger.info(f"Created a new job: {job.id}")
130
+
122
131
  return job
123
132
 
124
133
  @staticmethod
@@ -166,7 +166,8 @@ class PeriscopeSource(AbstractSource):
166
166
  return dashboard_charts
167
167
 
168
168
  def get_charts(self, pagination: dict = None) -> SourceIteration:
169
- MAX_CONCURRENT_REQUESTS = 10
169
+
170
+ BATCH_SIZE = 10
170
171
 
171
172
  if not pagination:
172
173
  dashboard_ids = self.get_dashboard_ids()
@@ -177,14 +178,15 @@ class PeriscopeSource(AbstractSource):
177
178
 
178
179
  pagination = {"dashboard_ids": dashboard_ids}
179
180
 
180
- with ThreadPoolExecutor(max_workers=MAX_CONCURRENT_REQUESTS) as executor:
181
- result = list(executor.map(self._get_charts, pagination["dashboard_ids"][:10]))
181
+ with ThreadPoolExecutor(max_workers=BATCH_SIZE) as executor:
182
+ result = list(executor.map(self._get_charts, pagination["dashboard_ids"][:BATCH_SIZE]))
182
183
 
183
184
  # Remove the first 10 dashboard ids if there are more
184
- if len(pagination["dashboard_ids"]) > 10:
185
- pagination["dashboard_ids"] = pagination["dashboard_ids"][10:]
185
+ if len(pagination["dashboard_ids"]) > BATCH_SIZE:
186
+ pagination["dashboard_ids"] = pagination["dashboard_ids"][BATCH_SIZE:]
186
187
  else:
187
- pagination["dashboard_ids"] = []
188
+ # We end the pagination
189
+ pagination = {}
188
190
 
189
191
  records = list(itertools.chain.from_iterable(result))
190
192
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "bizon"
3
- version = "0.0.4.dev3"
3
+ version = "0.0.4.dev4"
4
4
  description = "Extract and load your data reliably from API Clients with native fault-tolerant and checkpointing mechanism."
5
5
  authors = ["Antoine Balliet <antoine.balliet@gmail.com>", "Anas El Mhamdi <anas.elmhamdi@gmail.com>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes