PyFunceble-dev 4.3.0a14__py3-none-any.whl → 4.3.0a16__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.
Files changed (264) hide show
  1. PyFunceble/__init__.py +1 -1
  2. PyFunceble/checker/__init__.py +1 -1
  3. PyFunceble/checker/availability/__init__.py +1 -1
  4. PyFunceble/checker/availability/base.py +36 -33
  5. PyFunceble/checker/availability/domain.py +1 -1
  6. PyFunceble/checker/availability/domain_and_ip.py +1 -1
  7. PyFunceble/checker/availability/extras/__init__.py +1 -1
  8. PyFunceble/checker/availability/extras/base.py +4 -4
  9. PyFunceble/checker/availability/extras/dns.py +1 -1
  10. PyFunceble/checker/availability/extras/etoxic.py +1 -1
  11. PyFunceble/checker/availability/extras/external.py +1 -1
  12. PyFunceble/checker/availability/extras/parked.py +1 -1
  13. PyFunceble/checker/availability/extras/rules.py +1 -1
  14. PyFunceble/checker/availability/extras/subject_switch.py +1 -1
  15. PyFunceble/checker/availability/ip.py +1 -1
  16. PyFunceble/checker/availability/params.py +1 -1
  17. PyFunceble/checker/availability/status.py +1 -1
  18. PyFunceble/checker/availability/url.py +1 -1
  19. PyFunceble/checker/base.py +1 -1
  20. PyFunceble/checker/complex_json_encoder.py +1 -1
  21. PyFunceble/checker/params_base.py +1 -1
  22. PyFunceble/checker/reputation/__init__.py +1 -1
  23. PyFunceble/checker/reputation/base.py +1 -1
  24. PyFunceble/checker/reputation/domain.py +1 -1
  25. PyFunceble/checker/reputation/domain_and_ip.py +1 -1
  26. PyFunceble/checker/reputation/ip.py +1 -1
  27. PyFunceble/checker/reputation/params.py +1 -1
  28. PyFunceble/checker/reputation/status.py +1 -1
  29. PyFunceble/checker/reputation/url.py +1 -1
  30. PyFunceble/checker/status_base.py +1 -1
  31. PyFunceble/checker/syntax/__init__.py +1 -1
  32. PyFunceble/checker/syntax/base.py +1 -1
  33. PyFunceble/checker/syntax/domain.py +1 -1
  34. PyFunceble/checker/syntax/domain_and_ip.py +1 -1
  35. PyFunceble/checker/syntax/domain_base.py +1 -1
  36. PyFunceble/checker/syntax/ip.py +1 -1
  37. PyFunceble/checker/syntax/ipv4.py +1 -1
  38. PyFunceble/checker/syntax/ipv6.py +1 -1
  39. PyFunceble/checker/syntax/params.py +1 -1
  40. PyFunceble/checker/syntax/second_lvl_domain.py +1 -1
  41. PyFunceble/checker/syntax/status.py +1 -1
  42. PyFunceble/checker/syntax/subdomain.py +1 -1
  43. PyFunceble/checker/syntax/url.py +1 -1
  44. PyFunceble/checker/utils/__init__.py +1 -1
  45. PyFunceble/checker/utils/whois.py +1 -1
  46. PyFunceble/cli/__init__.py +1 -1
  47. PyFunceble/cli/continuous_integration/__init__.py +1 -1
  48. PyFunceble/cli/continuous_integration/base.py +1 -1
  49. PyFunceble/cli/continuous_integration/exceptions.py +1 -1
  50. PyFunceble/cli/continuous_integration/github_actions.py +1 -1
  51. PyFunceble/cli/continuous_integration/gitlab_ci.py +1 -1
  52. PyFunceble/cli/continuous_integration/jenkins.py +1 -1
  53. PyFunceble/cli/continuous_integration/standalone.py +1 -1
  54. PyFunceble/cli/continuous_integration/travis_ci.py +1 -1
  55. PyFunceble/cli/continuous_integration/utils.py +1 -1
  56. PyFunceble/cli/credential_loader.py +1 -1
  57. PyFunceble/cli/entry_points/__init__.py +1 -1
  58. PyFunceble/cli/entry_points/clean.py +1 -1
  59. PyFunceble/cli/entry_points/iana.py +1 -1
  60. PyFunceble/cli/entry_points/production.py +1 -1
  61. PyFunceble/cli/entry_points/public_suffix.py +1 -1
  62. PyFunceble/cli/entry_points/pyfunceble/__init__.py +1 -1
  63. PyFunceble/cli/entry_points/pyfunceble/argsparser.py +1 -1
  64. PyFunceble/cli/entry_points/pyfunceble/cli.py +2 -2
  65. PyFunceble/cli/execution_time.py +1 -1
  66. PyFunceble/cli/facility.py +1 -1
  67. PyFunceble/cli/factory.py +1 -1
  68. PyFunceble/cli/file_preloader.py +1 -1
  69. PyFunceble/cli/filesystem/__init__.py +1 -1
  70. PyFunceble/cli/filesystem/cleanup.py +1 -1
  71. PyFunceble/cli/filesystem/counter.py +1 -1
  72. PyFunceble/cli/filesystem/dir_base.py +1 -1
  73. PyFunceble/cli/filesystem/dir_structure/__init__.py +1 -1
  74. PyFunceble/cli/filesystem/dir_structure/backup.py +1 -1
  75. PyFunceble/cli/filesystem/dir_structure/base.py +1 -1
  76. PyFunceble/cli/filesystem/dir_structure/restore.py +1 -1
  77. PyFunceble/cli/filesystem/json_base.py +1 -1
  78. PyFunceble/cli/filesystem/printer/__init__.py +1 -1
  79. PyFunceble/cli/filesystem/printer/base.py +1 -1
  80. PyFunceble/cli/filesystem/printer/file.py +1 -1
  81. PyFunceble/cli/filesystem/printer/stdout.py +1 -1
  82. PyFunceble/cli/filesystem/registrar_counter.py +1 -1
  83. PyFunceble/cli/filesystem/status_file.py +1 -1
  84. PyFunceble/cli/migrators/__init__.py +1 -1
  85. PyFunceble/cli/migrators/alembic.py +1 -1
  86. PyFunceble/cli/migrators/base.py +1 -1
  87. PyFunceble/cli/migrators/csv_file/__init__.py +1 -1
  88. PyFunceble/cli/migrators/csv_file/base.py +1 -1
  89. PyFunceble/cli/migrators/csv_file/inactive_source_delete.py +1 -1
  90. PyFunceble/cli/migrators/csv_file/whois_registrar_add.py +1 -1
  91. PyFunceble/cli/migrators/db_base.py +1 -1
  92. PyFunceble/cli/migrators/file_cleanup/__init__.py +1 -1
  93. PyFunceble/cli/migrators/file_cleanup/base.py +1 -1
  94. PyFunceble/cli/migrators/file_cleanup/hashes_file.py +1 -1
  95. PyFunceble/cli/migrators/file_cleanup/mining_file.py +1 -1
  96. PyFunceble/cli/migrators/file_cleanup/production_config_file.py +1 -1
  97. PyFunceble/cli/migrators/json2csv/__init__.py +1 -1
  98. PyFunceble/cli/migrators/json2csv/base.py +1 -1
  99. PyFunceble/cli/migrators/json2csv/inactive.py +1 -1
  100. PyFunceble/cli/migrators/json2csv/whois.py +1 -1
  101. PyFunceble/cli/migrators/mariadb/__init__.py +1 -1
  102. PyFunceble/cli/migrators/mariadb/base.py +1 -1
  103. PyFunceble/cli/migrators/mariadb/file_and_status.py +1 -1
  104. PyFunceble/cli/migrators/mariadb/whois_record_idna_subject.py +1 -1
  105. PyFunceble/cli/processes/__init__.py +1 -1
  106. PyFunceble/cli/processes/base.py +4 -442
  107. PyFunceble/cli/processes/chancy_producer.py +3 -2
  108. PyFunceble/cli/processes/chancy_tester.py +3 -2
  109. PyFunceble/cli/processes/dir_files_sorter.py +3 -2
  110. PyFunceble/cli/processes/file_sorter.py +3 -2
  111. PyFunceble/cli/processes/migrator.py +25 -14
  112. PyFunceble/cli/processes/miner.py +3 -2
  113. PyFunceble/cli/processes/producer.py +3 -2
  114. PyFunceble/cli/processes/tester.py +3 -2
  115. PyFunceble/cli/processes/workers/__init__.py +1 -1
  116. PyFunceble/cli/processes/workers/base.py +33 -324
  117. PyFunceble/cli/processes/workers/chancy_producer.py +1 -3
  118. PyFunceble/cli/processes/workers/chancy_tester.py +5 -5
  119. PyFunceble/cli/processes/workers/dir_files_sorter.py +8 -3
  120. PyFunceble/cli/processes/workers/file_sorter.py +8 -3
  121. PyFunceble/cli/processes/workers/file_sorter_base.py +1 -1
  122. PyFunceble/cli/processes/workers/migrator.py +5 -3
  123. PyFunceble/cli/processes/workers/miner.py +10 -5
  124. PyFunceble/cli/processes/workers/producer.py +15 -8
  125. PyFunceble/cli/processes/workers/tester.py +5 -5
  126. PyFunceble/cli/scripts/__init__.py +1 -1
  127. PyFunceble/cli/scripts/iana.py +1 -1
  128. PyFunceble/cli/scripts/production.py +1 -1
  129. PyFunceble/cli/scripts/public_suffix.py +1 -1
  130. PyFunceble/cli/storage.py +1 -1
  131. PyFunceble/cli/storage_facility.py +1 -1
  132. PyFunceble/cli/system/__init__.py +1 -1
  133. PyFunceble/cli/system/base.py +2 -2
  134. PyFunceble/cli/system/integrator.py +2 -1
  135. PyFunceble/cli/system/launcher.py +81 -57
  136. PyFunceble/cli/utils/__init__.py +1 -1
  137. PyFunceble/cli/utils/ascii_logo.py +1 -1
  138. PyFunceble/cli/utils/sort.py +1 -1
  139. PyFunceble/cli/utils/stdout.py +1 -1
  140. PyFunceble/cli/utils/testing.py +1 -1
  141. PyFunceble/cli/utils/version.py +1 -1
  142. PyFunceble/config/__init__.py +1 -1
  143. PyFunceble/config/compare.py +1 -1
  144. PyFunceble/config/loader.py +3 -3
  145. PyFunceble/converter/__init__.py +1 -1
  146. PyFunceble/converter/adblock_input_line2subject.py +1 -1
  147. PyFunceble/converter/base.py +1 -1
  148. PyFunceble/converter/cidr2subject.py +1 -1
  149. PyFunceble/converter/input_line2subject.py +1 -1
  150. PyFunceble/converter/internal_url.py +1 -1
  151. PyFunceble/converter/rpz_input_line2subject.py +1 -1
  152. PyFunceble/converter/rpz_policy2subject.py +1 -1
  153. PyFunceble/converter/subject2complements.py +1 -1
  154. PyFunceble/converter/url2netloc.py +1 -1
  155. PyFunceble/converter/wildcard2subject.py +1 -1
  156. PyFunceble/data/alembic/__init__.py +1 -1
  157. PyFunceble/data/alembic/mysql/__init__.py +1 -1
  158. PyFunceble/data/alembic/mysql/env.py +1 -1
  159. PyFunceble/data/alembic/mysql/versions/__init__.py +1 -1
  160. PyFunceble/data/alembic/postgresql/__init__.py +1 -1
  161. PyFunceble/data/alembic/postgresql/env.py +1 -1
  162. PyFunceble/data/alembic/postgresql/versions/__init__.py +1 -1
  163. PyFunceble/database/__init__.py +1 -1
  164. PyFunceble/database/credential/__init__.py +1 -1
  165. PyFunceble/database/credential/base.py +1 -1
  166. PyFunceble/database/credential/mariadb.py +1 -1
  167. PyFunceble/database/credential/mysql.py +1 -1
  168. PyFunceble/database/credential/postgresql.py +1 -1
  169. PyFunceble/database/schemas/__init__.py +1 -1
  170. PyFunceble/database/schemas/autocontinue.py +1 -1
  171. PyFunceble/database/schemas/inactive.py +1 -1
  172. PyFunceble/database/schemas/status.py +1 -1
  173. PyFunceble/database/schemas/whois_record.py +1 -1
  174. PyFunceble/database/session.py +1 -1
  175. PyFunceble/database/sqlalchemy/__init__.py +1 -1
  176. PyFunceble/database/sqlalchemy/all_schemas.py +1 -1
  177. PyFunceble/database/sqlalchemy/base_schema.py +1 -1
  178. PyFunceble/dataset/__init__.py +1 -1
  179. PyFunceble/dataset/autocontinue/__init__.py +1 -1
  180. PyFunceble/dataset/autocontinue/base.py +1 -1
  181. PyFunceble/dataset/autocontinue/csv.py +1 -1
  182. PyFunceble/dataset/autocontinue/sql.py +1 -1
  183. PyFunceble/dataset/base.py +2 -2
  184. PyFunceble/dataset/csv_base.py +1 -1
  185. PyFunceble/dataset/db_base.py +1 -1
  186. PyFunceble/dataset/iana.py +1 -1
  187. PyFunceble/dataset/inactive/__init__.py +1 -1
  188. PyFunceble/dataset/inactive/base.py +1 -1
  189. PyFunceble/dataset/inactive/csv.py +1 -1
  190. PyFunceble/dataset/inactive/sql.py +1 -1
  191. PyFunceble/dataset/ipv4_reputation.py +1 -1
  192. PyFunceble/dataset/public_suffix.py +1 -1
  193. PyFunceble/dataset/sql_base.py +4 -3
  194. PyFunceble/dataset/user_agent.py +1 -1
  195. PyFunceble/dataset/whois/__init__.py +1 -1
  196. PyFunceble/dataset/whois/base.py +1 -1
  197. PyFunceble/dataset/whois/csv.py +1 -1
  198. PyFunceble/dataset/whois/sql.py +1 -1
  199. PyFunceble/downloader/__init__.py +1 -1
  200. PyFunceble/downloader/base.py +1 -1
  201. PyFunceble/downloader/exceptions.py +1 -1
  202. PyFunceble/downloader/iana.py +1 -1
  203. PyFunceble/downloader/ipv4_reputation.py +1 -1
  204. PyFunceble/downloader/public_suffix.py +1 -1
  205. PyFunceble/downloader/user_agents.py +1 -1
  206. PyFunceble/exceptions.py +1 -1
  207. PyFunceble/facility.py +1 -1
  208. PyFunceble/factory.py +1 -1
  209. PyFunceble/helpers/__init__.py +1 -1
  210. PyFunceble/helpers/command.py +1 -1
  211. PyFunceble/helpers/dict.py +1 -1
  212. PyFunceble/helpers/directory.py +1 -1
  213. PyFunceble/helpers/download.py +1 -1
  214. PyFunceble/helpers/environment_variable.py +1 -1
  215. PyFunceble/helpers/exceptions.py +1 -1
  216. PyFunceble/helpers/file.py +6 -2
  217. PyFunceble/helpers/hash.py +1 -1
  218. PyFunceble/helpers/list.py +1 -1
  219. PyFunceble/helpers/merge.py +1 -1
  220. PyFunceble/helpers/regex.py +1 -1
  221. PyFunceble/logger.py +34 -11
  222. PyFunceble/query/__init__.py +1 -1
  223. PyFunceble/query/dns/__init__.py +1 -1
  224. PyFunceble/query/dns/nameserver.py +1 -1
  225. PyFunceble/query/dns/query_tool.py +1 -1
  226. PyFunceble/query/dns/resolver.py +1 -1
  227. PyFunceble/query/http_status_code.py +1 -1
  228. PyFunceble/query/netinfo/__init__.py +1 -1
  229. PyFunceble/query/netinfo/address.py +1 -1
  230. PyFunceble/query/netinfo/base.py +1 -1
  231. PyFunceble/query/netinfo/hostbyaddr.py +1 -1
  232. PyFunceble/query/platform.py +1 -1
  233. PyFunceble/query/record/__init__.py +1 -1
  234. PyFunceble/query/record/base.py +1 -1
  235. PyFunceble/query/record/dns.py +1 -1
  236. PyFunceble/query/record/whois.py +1 -1
  237. PyFunceble/query/requests/__init__.py +1 -1
  238. PyFunceble/query/requests/adapter/__init__.py +1 -1
  239. PyFunceble/query/requests/adapter/base.py +1 -1
  240. PyFunceble/query/requests/adapter/http.py +1 -1
  241. PyFunceble/query/requests/adapter/https.py +1 -1
  242. PyFunceble/query/requests/requester.py +1 -1
  243. PyFunceble/query/whois/__init__.py +1 -1
  244. PyFunceble/query/whois/converter/__init__.py +1 -1
  245. PyFunceble/query/whois/converter/base.py +1 -1
  246. PyFunceble/query/whois/converter/digit2digits.py +1 -1
  247. PyFunceble/query/whois/converter/expiration_date.py +1 -1
  248. PyFunceble/query/whois/converter/month2unified.py +1 -1
  249. PyFunceble/query/whois/converter/registrar.py +1 -1
  250. PyFunceble/query/whois/query_tool.py +1 -1
  251. PyFunceble/sessions.py +1 -1
  252. PyFunceble/storage.py +2 -2
  253. PyFunceble/storage_facility.py +1 -1
  254. PyFunceble/utils/__init__.py +1 -1
  255. PyFunceble/utils/platform.py +1 -1
  256. PyFunceble/utils/profile.py +1 -1
  257. PyFunceble/utils/version.py +1 -1
  258. {PyFunceble_dev-4.3.0a14.dist-info → pyfunceble_dev-4.3.0a16.dist-info}/LICENSE +1 -1
  259. {PyFunceble_dev-4.3.0a14.dist-info → pyfunceble_dev-4.3.0a16.dist-info}/METADATA +129 -108
  260. pyfunceble_dev-4.3.0a16.dist-info/RECORD +284 -0
  261. {PyFunceble_dev-4.3.0a14.dist-info → pyfunceble_dev-4.3.0a16.dist-info}/WHEEL +1 -1
  262. PyFunceble_dev-4.3.0a14.dist-info/RECORD +0 -284
  263. {PyFunceble_dev-4.3.0a14.dist-info → pyfunceble_dev-4.3.0a16.dist-info}/entry_points.txt +0 -0
  264. {PyFunceble_dev-4.3.0a14.dist-info → pyfunceble_dev-4.3.0a16.dist-info}/top_level.txt +0 -0
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -50,24 +50,21 @@ License:
50
50
  limitations under the License.
51
51
  """
52
52
 
53
+ # pylint: disable=import-error,no-name-in-module,no-member
54
+
53
55
  import multiprocessing
54
- import multiprocessing.connection
55
- import queue
56
- import time
57
- import traceback
58
- from datetime import datetime, timedelta, timezone
59
- from typing import Any, List, Optional, Tuple
56
+ from typing import Optional
60
57
 
61
58
  import PyFunceble.cli.facility
62
59
  import PyFunceble.cli.factory
60
+ import PyFunceble.ext.process_manager
63
61
  import PyFunceble.facility
64
62
  import PyFunceble.sessions
65
63
  import PyFunceble.storage
66
- from PyFunceble.cli.continuous_integration.base import ContinuousIntegrationBase
67
64
  from PyFunceble.query.requests.requester import Requester
68
65
 
69
66
 
70
- class WorkerBase(multiprocessing.Process):
67
+ class WorkerBase(PyFunceble.ext.process_manager.WorkerCore):
71
68
  """
72
69
  Provides the base of all our workers.
73
70
 
@@ -77,61 +74,15 @@ class WorkerBase(multiprocessing.Process):
77
74
  The output queue to write.
78
75
  """
79
76
 
80
- STD_NAME: str = "pyfunceble_base_worker"
81
-
82
- MINING_WAIT_TIME: int = 60
83
- BREAKOFF: float = 2.0
84
-
85
- input_queue: Optional[queue.Queue] = None
86
- output_queue: Optional[queue.Queue] = None
87
-
88
- continuous_integration: ContinuousIntegrationBase = None
89
-
90
- global_exit_event: Optional[multiprocessing.Event] = None
91
- exit_it: Optional[multiprocessing.Event] = None
92
-
93
- send_stop_message: Optional[bool] = None
94
- accept_waiting_delay: Optional[bool] = None
95
-
96
- concurrent_worker_names: Optional[List[str]] = None
97
77
  db_session: Optional[PyFunceble.cli.factory.db_session] = None
98
-
99
- _parent_connection: Optional[multiprocessing.connection.Connection] = None
100
- _child_connection: Optional[multiprocessing.connection.Connection] = None
101
- _exception: Optional[multiprocessing.Pipe] = None
102
-
103
- _params: Optional[dict] = {}
104
78
  requester: Optional[Requester] = None
105
79
 
106
- def __init__(
107
- self,
108
- input_queue: Optional[queue.Queue],
109
- output_queue: Optional[queue.Queue] = None,
110
- global_exit_event: Optional[multiprocessing.Event] = None,
111
- *,
112
- name: Optional[str] = None,
113
- daemon: Optional[bool] = None,
114
- continuous_integration: Optional[ContinuousIntegrationBase] = None,
115
- configuration: Optional[dict] = None,
116
- ) -> None:
117
- self.configuration = self._params["configuration"] = configuration
118
- self.input_queue = self._params["input_queue"] = input_queue
119
- self.output_queue = self._params["output_queue"] = output_queue
120
-
121
- self.continuous_integration = self._params["continuous_integration"] = (
122
- continuous_integration
123
- )
124
-
125
- self.global_exit_event = self._params["global_exit_event"] = global_exit_event
126
- self.exit_it = multiprocessing.Event()
127
-
128
- self._parent_connection, self._child_connection = multiprocessing.Pipe()
129
- self._exception = None
130
-
131
- self.send_stop_message = True
132
- self.accept_waiting_delay = True
133
- self.concurrent_worker_names = []
80
+ def __del__(self) -> None:
81
+ if self.db_session is not None:
82
+ self.db_session.close()
134
83
 
84
+ def __post_init__(self) -> None:
85
+ self.requester = Requester(config=PyFunceble.storage.CONFIGURATION)
135
86
  try:
136
87
  self.db_session = (
137
88
  PyFunceble.cli.factory.DBSession.get_db_session().get_new_session()()
@@ -139,281 +90,39 @@ class WorkerBase(multiprocessing.Process):
139
90
  except TypeError:
140
91
  self.db_session = None
141
92
 
142
- super().__init__(name=name, daemon=daemon)
143
-
144
- self.__post_init__()
145
-
146
- def __del__(self) -> None:
147
- if self.db_session is not None:
148
- self.db_session.close()
149
-
150
- def __post_init__(self) -> None:
151
- """
152
- A method which will be executed after the :code:`__init__` method.
153
- """
154
-
155
- self.requester = Requester(config=PyFunceble.storage.CONFIGURATION)
156
-
157
- @property
158
- def exception(self):
159
- """
160
- Provides the exception of the current worker.
161
- """
162
-
163
- if self._parent_connection.poll():
164
- self._exception = self._parent_connection.recv()
165
-
166
- return self._exception
167
-
168
- def add_to_input_queue(
169
- self,
170
- data: Any,
171
- *,
172
- worker_name: Optional[str] = None,
173
- destination_worker: Optional[str] = None,
174
- ) -> "WorkerBase":
93
+ def perform_external_poweron_checks(self) -> bool:
175
94
  """
176
- Adds the given data to the current queue.
177
-
178
- :param data:
179
- The data to add into the queue.
180
- :param destination_worker:
181
- The name of the worker which is supposed to read the message.
182
- """
183
-
184
- if worker_name:
185
- to_send = (worker_name, destination_worker, data)
186
- else:
187
- to_send = (self.name, destination_worker, data)
188
-
189
- self.input_queue.put(to_send)
190
-
191
- PyFunceble.facility.Logger.debug("Added to the (input) queue: %r", data)
192
-
193
- def add_to_output_queue(
194
- self,
195
- data: Any,
196
- *,
197
- worker_name: Optional[str] = None,
198
- destination_worker: Optional[str] = None,
199
- ) -> "WorkerBase":
200
- """
201
- Adds the given data to the output queue queue.
202
-
203
- :param data:
204
- The data to add into the queue.
95
+ Perform the external poweron checks.
205
96
  """
206
97
 
207
- if worker_name:
208
- to_send = (worker_name, destination_worker, data)
209
- else:
210
- to_send = (self.name, destination_worker, data)
211
-
212
- if self.output_queue is not None:
213
- for output_queue in self.output_queue:
214
- output_queue.put(to_send)
215
-
216
- PyFunceble.facility.Logger.debug("Added to the (output) queue: %r", data)
217
-
218
- return self
219
-
220
- def target(self, consumed: Any) -> Optional[Tuple[Any, ...]]:
221
- """
222
- This the target that is run to process something.
223
- This method should return a result which will pu send to the output
224
- queue.
225
- """
226
-
227
- raise NotImplementedError()
228
-
229
- def share_waiting_message(
230
- self,
231
- *,
232
- overall: bool = False,
233
- ignore_current_worker: bool = False,
234
- apply_breakoff: bool = False,
235
- ) -> "WorkerBase":
236
- """
237
- Shares a waiting message to both input and output queues.
238
- The idea is to keep our worker awake when necessary. This functionality
239
- is really important when running the mining worker because sometime
240
- the flow is so long, that we may need some time.
241
-
242
- :param overall:
243
- Shares the message multiple time to specific destination in our
244
- current stack.
245
- :param ignore_current_worker:
246
- Doesn't share the message with ourself.
247
- :param apply_breakoff:
248
- Activates the breakoff (sleep) before starting to share the message.
249
- """
250
-
251
- if overall:
252
- for worker_name in self.concurrent_worker_names:
253
- if apply_breakoff:
254
- time.sleep(self.BREAKOFF)
255
-
256
- if not ignore_current_worker:
257
- # Give the whole stack a bit more of time.
258
- self.add_to_input_queue("wait", destination_worker=worker_name)
259
-
260
- self.add_to_output_queue("wait")
261
- else:
262
- if apply_breakoff:
263
- time.sleep(self.BREAKOFF)
264
-
265
- if not ignore_current_worker:
266
- self.add_to_input_queue("wait", destination_worker=self.name)
267
-
268
- self.add_to_output_queue("wait")
269
-
270
- def run(self) -> None: # pylint: disable=too-many-statements
271
- def break_now() -> bool:
272
- """
273
- Checks if it is time to make a break.
274
- """
275
-
276
- if not wait_for_stop or not self.accept_waiting_delay:
277
- return True
278
-
279
- return datetime.now(timezone.utc) > break_time
280
-
281
- if self.configuration is not None:
98
+ if hasattr(self, "configuration") and self.configuration is not None:
282
99
  PyFunceble.facility.ConfigLoader.set_custom_config(self.configuration)
283
100
 
284
- if multiprocessing.get_start_method() != "fork":
101
+ if (
102
+ multiprocessing.get_start_method() != "fork"
103
+ or not PyFunceble.storage.CONFIGURATION
104
+ ):
285
105
  PyFunceble.facility.ConfigLoader.start()
286
106
  PyFunceble.cli.facility.CredentialLoader.start()
287
107
  PyFunceble.cli.factory.DBSession.init_db_sessions()
288
108
 
289
- wait_for_stop = (
290
- bool(PyFunceble.storage.CONFIGURATION.cli_testing.mining) is True
291
- )
292
- break_time = datetime.now(timezone.utc) + timedelta(
293
- seconds=self.MINING_WAIT_TIME
294
- )
295
-
296
- try: # pylint: disable=too-many-nested-blocks
297
- while True:
298
- if self.global_exit_event.is_set():
299
- PyFunceble.facility.Logger.info(
300
- "Got global exit event. Stopping worker."
301
- )
302
-
303
- break
304
-
305
- if self.exit_it.is_set():
306
- PyFunceble.facility.Logger.info("Got exit event. Stopping worker.")
307
- break
308
-
309
- if (
310
- self.continuous_integration
311
- and self.continuous_integration.is_time_exceeded()
312
- ):
313
- PyFunceble.facility.Logger.info(
314
- "CI time exceeded. Stopping worker."
315
- )
316
-
317
- if break_now():
318
- self.exit_it.set()
319
- continue
320
-
321
- continue
322
-
323
- try:
324
- worker_name, destination_worker, consumed = self.input_queue.get()
325
- except (EOFError, KeyboardInterrupt):
326
- PyFunceble.facility.Logger.info(
327
- "Got EOFError/KeyboardInterrupt. Stopping worker."
328
- )
329
- self.global_exit_event.set()
330
- break
331
-
332
- if destination_worker and destination_worker != self.name:
333
- self.add_to_input_queue(
334
- consumed,
335
- worker_name=worker_name,
336
- destination_worker=destination_worker,
337
- )
338
- continue
339
-
340
- PyFunceble.facility.Logger.info(
341
- "Got (from %r): %r",
342
- worker_name,
343
- consumed,
344
- )
345
-
346
- if consumed == "stop":
347
- if break_now():
348
- PyFunceble.facility.Logger.info(
349
- "Got stop message from %r. Applying.",
350
- worker_name,
351
- )
352
-
353
- self.exit_it.set()
354
- continue
355
-
356
- self.share_waiting_message(apply_breakoff=wait_for_stop)
357
- continue
358
-
359
- if consumed == "wait":
360
- if not wait_for_stop:
361
- continue
362
-
363
- if break_now():
364
- PyFunceble.facility.Logger.debug(
365
- "Waited sufficiently. Stopping current worker."
366
- )
367
-
368
- # The real (break) action shouldn't be handled here.
369
- self.exit_it.set()
370
- continue
371
-
372
- PyFunceble.facility.Logger.debug(
373
- "We need to wait a bit more. Continue waiting."
374
- )
375
-
376
- self.share_waiting_message(apply_breakoff=wait_for_stop)
377
- continue
378
-
379
- try:
380
- result = self.target(consumed)
381
- except (EOFError, KeyboardInterrupt):
382
- PyFunceble.facility.Logger.info(
383
- "Got EOFError/KeyboardInterrupt. Stopping worker."
384
- )
385
- self.global_exit_event.set()
386
- break
387
-
388
- if result is not None:
389
- self.add_to_output_queue(result)
390
-
391
- PyFunceble.facility.Logger.info(
392
- "Produced: %r",
393
- result,
394
- )
395
-
396
- break_time = datetime.now(timezone.utc) + timedelta(
397
- seconds=self.MINING_WAIT_TIME
398
- )
399
-
400
- except Exception as exception: # pylint: disable=broad-except
401
- PyFunceble.facility.Logger.critical(
402
- "Error while running target", exc_info=True
403
- )
404
- trace = traceback.format_exc()
405
- self._child_connection.send((exception, trace))
109
+ return super().perform_external_poweron_checks()
406
110
 
407
- self.exit_it.set()
408
- raise exception
409
-
410
- def terminate(self) -> None:
111
+ def perform_external_preflight_checks(self) -> bool:
411
112
  """
412
- Terminate our worker.
113
+ Perform the external preflight checks.
413
114
  """
414
115
 
415
- self.exit_it.set()
116
+ if (
117
+ hasattr(self, "continuous_integration")
118
+ and self.continuous_integration
119
+ and self.continuous_integration.is_time_exceeded()
120
+ ):
121
+ PyFunceble.facility.Logger.info("CI time exceeded. Stopping worker.")
122
+
123
+ if not self.delay_shutdown:
124
+ self.exit_it.set()
125
+
126
+ return False
416
127
 
417
- if self.input_queue:
418
- # Necessary to avoid blocking.
419
- self.add_to_input_queue("stop", destination_worker=self.name)
128
+ return super().perform_external_preflight_checks()
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -69,8 +69,6 @@ class ChancyProducerWorker(ProducerWorker):
69
69
  USE AT YOUR OWN RISK. GOOD LUCK!
70
70
  """
71
71
 
72
- STD_NAME: str = "pyfunceble_chancy_producer_worker"
73
-
74
72
  def target(self, consumed: Any) -> Optional[Tuple[Any, ...]]:
75
73
  if not isinstance(consumed, tuple):
76
74
  PyFunceble.facility.Logger.info(
@@ -37,7 +37,7 @@ License:
37
37
  ::
38
38
 
39
39
 
40
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
40
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
41
41
 
42
42
  Licensed under the Apache License, Version 2.0 (the "License");
43
43
  you may not use this file except in compliance with the License.
@@ -70,10 +70,10 @@ class ChancyTesterWorker(TesterWorker):
70
70
  USE AT YOUR OWN RISK. GOOD LUCK!
71
71
  """
72
72
 
73
- STD_NAME: str = "pyfunceble_chancy_tester_worker"
74
-
75
73
  def __post_init__(self) -> None:
76
- self.producer_worker = ProducerWorker(**self._params)
74
+ self.producer_worker = ProducerWorker(**self._all_args)
75
+ self.producer_worker.name = f"{self.name}.producer"
76
+ self.producer_worker.perform_external_poweron_checks()
77
77
 
78
78
  return super().__post_init__()
79
79
 
@@ -81,7 +81,7 @@ class ChancyTesterWorker(TesterWorker):
81
81
  """
82
82
  The actually wall destructor.
83
83
 
84
- :param consummed:
84
+ :param consumed:
85
85
  The data that needs to be tested.
86
86
  """
87
87
 
@@ -37,7 +37,7 @@ License:
37
37
  ::
38
38
 
39
39
 
40
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
40
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
41
41
 
42
42
  Licensed under the Apache License, Version 2.0 (the "License");
43
43
  you may not use this file except in compliance with the License.
@@ -85,8 +85,6 @@ class DireFileSorterWorker(FileSorterWorkerBase):
85
85
  None
86
86
  """
87
87
 
88
- STD_NAME: str = "pyfunceble_dir_files_sorter_worker"
89
-
90
88
  @staticmethod
91
89
  def get_files_to_sort(directory: str) -> List[str]:
92
90
  """
@@ -130,6 +128,13 @@ class DireFileSorterWorker(FileSorterWorkerBase):
130
128
  return result
131
129
 
132
130
  def target(self, consumed: Any) -> Optional[Tuple[Any, ...]]:
131
+ """
132
+ The producer of the worker.
133
+
134
+ :param consumed:
135
+ The consumed data to work with.
136
+ """
137
+
133
138
  if (
134
139
  not isinstance(consumed, dict)
135
140
  and "directory" not in consumed
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -81,9 +81,14 @@ class FileSorterWorker(FileSorterWorkerBase):
81
81
  None
82
82
  """
83
83
 
84
- STD_NAME: str = "pyfunceble_file_sorter_worker"
85
-
86
84
  def target(self, consumed: Any) -> Optional[Tuple[Any, ...]]:
85
+ """
86
+ The producer of the worker.
87
+
88
+ :param consumed:
89
+ The consumed data to work with.
90
+ """
91
+
87
92
  if (
88
93
  not isinstance(consumed, dict)
89
94
  and "file" not in consumed
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -64,9 +64,11 @@ class MigratorWorker(WorkerBase):
64
64
  to handle the mining of dataset to test.
65
65
  """
66
66
 
67
- STD_NAME: str = "pyfunceble_migrator_worker"
68
-
69
67
  def run(self) -> None:
68
+ """
69
+ This is the brain of the worker.
70
+ """
71
+
70
72
  try:
71
73
  try:
72
74
  self.target(self.continuous_integration, db_session=self.db_session)
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -71,8 +71,6 @@ class MinerWorker(WorkerBase):
71
71
  the mining of dataset to test.
72
72
  """
73
73
 
74
- STD_NAME: str = "pyfunceble_miner_worker"
75
-
76
74
  INACTIVE_STATUSES: Tuple[str, ...] = (
77
75
  PyFunceble.storage.STATUS.down,
78
76
  PyFunceble.storage.STATUS.invalid,
@@ -123,6 +121,13 @@ class MinerWorker(WorkerBase):
123
121
  return result
124
122
 
125
123
  def target(self, consumed: Tuple[dict, CheckerStatusBase]) -> None:
124
+ """
125
+ The producer of the worker.
126
+
127
+ :param consumed:
128
+ The consumed data to work with.
129
+ """
130
+
126
131
  if not isinstance(consumed, tuple) or not isinstance(
127
132
  consumed[1], CheckerStatusBase
128
133
  ):
@@ -155,7 +160,7 @@ class MinerWorker(WorkerBase):
155
160
 
156
161
  print_single_line("M")
157
162
 
158
- self.add_to_output_queue("pyfunceble")
163
+ self.push_to_output_queues("pyfunceble")
159
164
  self.share_waiting_message()
160
165
  mined = self.mine_from(subject)
161
166
 
@@ -184,7 +189,7 @@ class MinerWorker(WorkerBase):
184
189
  )
185
190
  continue
186
191
 
187
- self.add_to_output_queue(to_send)
192
+ self.push_to_output_queues(to_send)
188
193
 
189
194
  # Returning None because we manually add into the queue.
190
195
  return None
@@ -35,7 +35,7 @@ License:
35
35
  ::
36
36
 
37
37
 
38
- Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
38
+ Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy
39
39
 
40
40
  Licensed under the Apache License, Version 2.0 (the "License");
41
41
  you may not use this file except in compliance with the License.
@@ -85,8 +85,6 @@ class ProducerWorker(WorkerBase):
85
85
  the production of output to stdout or files.
86
86
  """
87
87
 
88
- STD_NAME: str = "pyfunceble_producer_worker"
89
-
90
88
  stdout_printer: Optional[StdoutPrinter] = None
91
89
  file_printer: Optional[FilePrinter] = None
92
90
  whois_dataset: Optional[WhoisDatasetBase] = None
@@ -104,7 +102,9 @@ class ProducerWorker(WorkerBase):
104
102
  PyFunceble.storage.STATUS.invalid,
105
103
  )
106
104
 
107
- def __post_init__(self) -> None:
105
+ def perform_external_poweron_checks(self) -> None:
106
+ result = super().perform_external_poweron_checks()
107
+
108
108
  skip_columns = []
109
109
  extra_formatters = {}
110
110
 
@@ -137,7 +137,7 @@ class ProducerWorker(WorkerBase):
137
137
 
138
138
  self.header_already_printed = False
139
139
 
140
- return super().__post_init__()
140
+ return result
141
141
 
142
142
  @staticmethod
143
143
  def should_we_ignore(test_result: CheckerStatusBase) -> bool:
@@ -177,7 +177,7 @@ class ProducerWorker(WorkerBase):
177
177
  """
178
178
  Checks if we should block the file printer.
179
179
 
180
- The reason behindn this is that we don't want to generate an output
180
+ The reason behind this is that we don't want to generate an output
181
181
  when a subject was already into the inactive database.
182
182
  """
183
183
 
@@ -303,7 +303,7 @@ class ProducerWorker(WorkerBase):
303
303
  Runs the analytic behind the file printer.
304
304
 
305
305
  .. warning::
306
- Thie method assume that the givne dataset is ignored from the normal
306
+ Thie method assume that the given dataset is ignored from the normal
307
307
  file printer.
308
308
  """
309
309
 
@@ -388,6 +388,13 @@ class ProducerWorker(WorkerBase):
388
388
  ).count(test_result.registrar)
389
389
 
390
390
  def target(self, consumed: Any) -> Optional[Tuple[Any, ...]]:
391
+ """
392
+ The producer of the worker.
393
+
394
+ :param consumed:
395
+ The consumed data to work with.
396
+ """
397
+
391
398
  if not isinstance(consumed, tuple):
392
399
  PyFunceble.facility.Logger.info(
393
400
  "Skipping latest dataset because consumed data was not a tuple."
@@ -399,7 +406,7 @@ class ProducerWorker(WorkerBase):
399
406
 
400
407
  if not isinstance(test_dataset, dict):
401
408
  PyFunceble.facility.Logger.info(
402
- "Skipping because test dataset is not a dictionnary."
409
+ "Skipping because test dataset is not a dictionary."
403
410
  )
404
411
  return None
405
412