orionis 0.90.0__py3-none-any.whl → 0.93.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.
@@ -3,7 +3,7 @@ from typing import Any
3
3
  from datetime import datetime
4
4
  from abc import ABC, abstractmethod
5
5
 
6
- class ISchedule(ABC):
6
+ class IScheduleService(ABC):
7
7
  """
8
8
  A class that manages the scheduling of tasks using the APScheduler.
9
9
 
orionis/framework.py CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.90.0"
8
+ VERSION = "0.93.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
orionis/luminate/app.py CHANGED
@@ -5,6 +5,7 @@ from orionis.luminate.bootstrap.command_bootstrapper import CommandsBootstrapper
5
5
  from orionis.luminate.bootstrap.environment_bootstrapper import EnvironmentBootstrapper
6
6
  from orionis.luminate.patterns.singleton import SingletonMeta
7
7
  from orionis.luminate.providers.commands.reactor_commands_service_provider import ReactorCommandsServiceProvider
8
+ from orionis.luminate.providers.commands.scheduler_provider import ScheduleServiceProvider
8
9
  from orionis.luminate.providers.environment.environment__service_provider import EnvironmentServiceProvider
9
10
  from orionis.luminate.providers.config.config_service_provider import ConfigServiceProvider
10
11
  from orionis.luminate.providers.log.log_service_provider import LogServiceProvider
@@ -265,6 +266,11 @@ class Application(metaclass=SingletonMeta):
265
266
  _log_provider.register()
266
267
  _log_provider.boot()
267
268
 
269
+ # Load the scheduler provider, which is responsible for managing scheduled tasks.
270
+ _schedule_provider = ScheduleServiceProvider(app=self.container)
271
+ _schedule_provider.register()
272
+ _schedule_provider.boot()
273
+
268
274
  # Load the commands provider, which is responsible for executing and managing CLI commands.
269
275
  # Developers can interact with it through the facade "orionis.luminate.facades.commands.commands_facade.Commands".
270
276
  _commands_provider = ReactorCommandsServiceProvider(app=self.container)
@@ -1,8 +1,8 @@
1
1
  import importlib
2
2
  from orionis.luminate.console.base.command import BaseCommand
3
3
  from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
4
- from orionis.luminate.console.tasks.scheduler import Schedule
5
4
  from orionis.contracts.console.i_task_manager import ITaskManager
5
+ from orionis.luminate.services.commands.scheduler_service import ScheduleService
6
6
 
7
7
  class ScheduleWorkCommand(BaseCommand):
8
8
  """
@@ -18,6 +18,15 @@ class ScheduleWorkCommand(BaseCommand):
18
18
  # A brief description of the command.
19
19
  description = "Starts the scheduled tasks."
20
20
 
21
+ def __init__(self, schedule:ScheduleService) -> None:
22
+ """
23
+ Initialize a new instance of the ScheduleWorkCommand class.
24
+
25
+ Args:
26
+ schedule (ScheduleService): The schedule instance to use for scheduling tasks.
27
+ """
28
+ self.schedule = schedule
29
+
21
30
  def handle(self) -> None:
22
31
  """
23
32
  Execute the scheduled tasks.
@@ -33,17 +42,14 @@ class ScheduleWorkCommand(BaseCommand):
33
42
  """
34
43
  try:
35
44
 
36
- # Initialize a new Schedule instance.
37
- schedule = Schedule()
38
-
39
45
  # Create an instance of the TaskManager to manage the scheduling.
40
46
  tasks_manager = importlib.import_module("app.console.tasks_manager")
41
47
  TaskManager = getattr(tasks_manager, "TaskManager")
42
48
  kernel: ITaskManager = TaskManager()
43
- kernel.schedule(schedule)
49
+ kernel.schedule(self.schedule)
44
50
 
45
51
  # Start running the scheduled tasks using the schedule runner.
46
- schedule.start()
52
+ self.schedule.start()
47
53
 
48
54
  except Exception as e:
49
55
 
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.commands.scheduler_service import ScheduleService
3
+
4
+ class ScheduleServiceProvider(ServiceProvider):
5
+
6
+ def register(self) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.bind(ScheduleService)
11
+
12
+ def boot(self,) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -7,11 +7,11 @@ from typing import Any
7
7
  from apscheduler.schedulers.background import BackgroundScheduler
8
8
  from apscheduler.triggers.cron import CronTrigger
9
9
  from apscheduler.triggers.interval import IntervalTrigger
10
- from orionis.contracts.console.tasks.i_schedule import ISchedule
10
+ from orionis.contracts.services.commands.i_schedule_service import IScheduleService
11
11
  from orionis.luminate.console.exceptions.cli_exception import CLIOrionisScheduleException
12
12
  from orionis.luminate.facades.commands.commands_facade import Command
13
13
 
14
- class Schedule(ISchedule):
14
+ class ScheduleService(IScheduleService):
15
15
  """
16
16
  A class that manages the scheduling of tasks using the APScheduler.
17
17
 
@@ -28,7 +28,7 @@ class Schedule(ISchedule):
28
28
  Defines a command to execute.
29
29
  """
30
30
 
31
- def __init__(self, logger_level=logging.CRITICAL):
31
+ def __init__(self, apscheduler_background : BackgroundScheduler, logger_level=logging.CRITICAL):
32
32
  """
33
33
  Initializes the Schedule object.
34
34
 
@@ -40,12 +40,12 @@ class Schedule(ISchedule):
40
40
  The logging level for the APScheduler logger. Default is `logging.CRITICAL` to suppress most logs.
41
41
  """
42
42
  logging.getLogger("apscheduler").setLevel(logger_level)
43
- self.scheduler = BackgroundScheduler()
43
+ self.scheduler = apscheduler_background
44
44
  self.scheduler.start()
45
45
  self.callback = None
46
46
  self.wait = True
47
47
 
48
- def command(self, signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> 'Schedule':
48
+ def command(self, signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> 'ScheduleService':
49
49
  """
50
50
  Defines a Orionis command to be executed.
51
51
 
@@ -604,12 +604,9 @@ class Schedule(ISchedule):
604
604
  Starts the scheduler and stops automatically when there are no more jobs.
605
605
  """
606
606
  try:
607
- # Start the scheduler
608
607
  while self.wait:
609
608
  time.sleep(1)
610
609
  except (KeyboardInterrupt, SystemExit):
611
- # Stop the scheduler if it is running
612
610
  if self.scheduler.running:
613
611
  self.scheduler.shutdown()
614
- # Exit with status code 1 to indicate an error
615
612
  sys.exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.90.0
3
+ Version: 0.93.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -1,6 +1,6 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/cli_manager.py,sha256=0bM-hABXJSoPGuvEgnqeaj9qcLP8VjTQ3z9Mb0TSEUI,1381
3
- orionis/framework.py,sha256=Z1Sydsk8EyOluZovVk03mk5pBuEWeOCq7OB4ueAhXaY,1386
3
+ orionis/framework.py,sha256=ppUTRFsIyFkP2mrVuX7phLxBXcMFTn6G_vOs6uwD-Ho,1386
4
4
  orionis/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  orionis/contracts/bootstrap/i_command_bootstrapper.py,sha256=cfpYWSlNhOY1q_C9o0H7F381OoM0Oh0qaeqP-c85nzk,2457
6
6
  orionis/contracts/bootstrap/i_config_bootstrapper.py,sha256=d2TXT74H2fCBbzWgrt9-ZG11S_H_YPQOEcJoIOrsgb0,4462
@@ -18,8 +18,6 @@ orionis/contracts/console/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
18
18
  orionis/contracts/console/output/i_console.py,sha256=bkYTT5oIK3NP-p7XONgi1z_SO50ZvJu31Nv7cjs4t7s,8902
19
19
  orionis/contracts/console/output/i_executor.py,sha256=MGMTTPSwF8dgCjHD3A4CKtYDaCcD-KU28dorC61Q04k,1411
20
20
  orionis/contracts/console/output/i_progress_bar.py,sha256=sOkQzQsliFemqZHMyzs4fWhNJfXDTk5KH3aExReetSE,1760
21
- orionis/contracts/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- orionis/contracts/console/tasks/i_schedule.py,sha256=_dsR0gCvJ7_67lwPUAzBwQFHNvWM6jVjcg1EdPqDIIo,10117
23
21
  orionis/contracts/container/i_container.py,sha256=MSJkVNawcovxSUAG-nrEctMYLT8H0OJq15pL5UwJeqA,6932
24
22
  orionis/contracts/container/i_types.py,sha256=GCH7x3PjpXKPET3l84GcXbcM8cpne8AGrmTw-uFaT24,526
25
23
  orionis/contracts/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -44,6 +42,7 @@ orionis/contracts/providers/i_service_provider.py,sha256=zoBAsGE-KrNfCsF3u876oxo
44
42
  orionis/contracts/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
43
  orionis/contracts/services/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
44
  orionis/contracts/services/commands/i_reactor_commands_service.py,sha256=msIOfwOYASFNuS4shhwsnukPH5_XnuxNBHW9f6q-Lqo,795
45
+ orionis/contracts/services/commands/i_schedule_service.py,sha256=fNkPdy94X93r3wjlOUaVBLfSOjo8lkINwfVbC2w5WR0,10124
47
46
  orionis/contracts/services/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
47
  orionis/contracts/services/config/i_config_service.py,sha256=TdlEEsd8jvzBGozwaZtQ9KYHisY4ACL-VUOtydidHeE,989
49
48
  orionis/contracts/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -60,7 +59,7 @@ orionis/installer/installer_manager.py,sha256=Hb6T0bmSl39T30maY-nUWkrLhG77JdrKe4
60
59
  orionis/installer/installer_output.py,sha256=LeKxzuXpnHOKbKpUtx3tMGkCi2bGcPV1VNnfBxwfxUU,7161
61
60
  orionis/installer/installer_setup.py,sha256=c2HtVklSa-2_-YVonc7fwtoK-RTDqBS2Ybvbekgfqtc,6970
62
61
  orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
- orionis/luminate/app.py,sha256=8jgfMgcf01PsGBV1YaIUR8axKXkX7MtHNKJI0YEKWWc,11629
62
+ orionis/luminate/app.py,sha256=KTCwzauCLdZ_6_7oDeLmTT17sP2YK6IBdzLdVphiAzU,11962
64
63
  orionis/luminate/app_context.py,sha256=se2xpsGoy_drcuOROC7OHaIAN5Yd0kbm5V1zzsxxyQc,996
65
64
  orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
65
  orionis/luminate/bootstrap/command_bootstrapper.py,sha256=JJkWWOS2R2Zg7mC7-VMtZ0wAgxlegMkdnqudpbAjxwk,6925
@@ -88,7 +87,7 @@ orionis/luminate/console/base/command.py,sha256=YGHd5xVYILcNhQumi74IRnzvagvjufEO
88
87
  orionis/luminate/console/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
88
  orionis/luminate/console/commands/cache_clear.py,sha256=KyXVSwtLaV1O1cTEkNzX9czCwEoeQlAjiT0jUFMO8iE,2684
90
89
  orionis/luminate/console/commands/help.py,sha256=8_LOTuiZvA8HToKP5qBoN7rWlEo3T0Qik7-f3fyrTgo,2288
91
- orionis/luminate/console/commands/schedule_work.py,sha256=VHXmcW02Gewo2UjiYpc528fjYDptDu73MBt-hnVb_AE,1928
90
+ orionis/luminate/console/commands/schedule_work.py,sha256=EJ9tCZVcV1dkEG0nXV5W0eqcwqGfui1A5Xk7zVGzwC0,2168
92
91
  orionis/luminate/console/commands/tests.py,sha256=Z7e6aM5Vu8C7R8iC8sJgUYVN9aJgtVMkqjUEFxPq91o,1281
93
92
  orionis/luminate/console/commands/version.py,sha256=llVPK6ELtf8dIdPvLbybrtipWwZkzV0EXc9ShL-C-GY,1140
94
93
  orionis/luminate/console/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -98,8 +97,6 @@ orionis/luminate/console/output/console.py,sha256=khlnCmhGW3Iu2YYO8GG7YLtnLeqysy
98
97
  orionis/luminate/console/output/executor.py,sha256=0_6AGM1vE5umdpVVogQUE5eW9cu5UUQwc-ZvuccTI8E,3362
99
98
  orionis/luminate/console/output/progress_bar.py,sha256=ssi8Drryr-shl7OxweTgGOhvRvAlCVxjBGm1L1qyO84,3089
100
99
  orionis/luminate/console/output/styles.py,sha256=2e1_FJdNpKaVqmdlCx-udzTleH_6uEFE9_TjH7T1ZUk,3696
101
- orionis/luminate/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
- orionis/luminate/console/tasks/scheduler.py,sha256=5_99tg3vGbKYipTnhSoM_fPPu7AYvMXb7khZ4wRRf_Q,22636
103
100
  orionis/luminate/container/container.py,sha256=Ruyhs5OAiO6nMFhGDm7TNQD4qqFO0lh_phqUFDit_bE,16429
104
101
  orionis/luminate/container/exception.py,sha256=ap1SqYEjQEEHXJJTNmL7V1jrmRjgT5_7geZ95MYkhMA,1691
105
102
  orionis/luminate/container/types.py,sha256=BDcXN0__voRNHZ5Gr5dF0sWIYAQyNk4TxAwILBWyDAA,1735
@@ -123,6 +120,7 @@ orionis/luminate/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
123
120
  orionis/luminate/providers/service_provider.py,sha256=Ave9V10KPVCI6bt3HwJ51322P-_RnQuHXkC-ltlAOOA,1537
124
121
  orionis/luminate/providers/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
122
  orionis/luminate/providers/commands/reactor_commands_service_provider.py,sha256=3HX3wwPCH_Y9OsoTyfC4_LrNlPW_-UaffDcz3Wehuvk,701
123
+ orionis/luminate/providers/commands/scheduler_provider.py,sha256=v5CQybodiAilsU9oa5cBKYwzb3PGAX_l-h4X9KZH35w,668
126
124
  orionis/luminate/providers/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
127
125
  orionis/luminate/providers/config/config_service_provider.py,sha256=NLKB3Vcu4kqZ0WyeImMG3CsclSu_P4aWs6yXitcv474,659
128
126
  orionis/luminate/providers/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -132,6 +130,7 @@ orionis/luminate/providers/log/log_service_provider.py,sha256=tcWDEI-fubi1mWSS-I
132
130
  orionis/luminate/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
131
  orionis/luminate/services/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
132
  orionis/luminate/services/commands/reactor_commands_service.py,sha256=2kydqQak61enzzoBxQOghWSco1hv2ZFwANJf7d_p9zQ,6441
133
+ orionis/luminate/services/commands/scheduler_service.py,sha256=JB0f-yOyb7Uz6NLVM4QH2q9_wC-81Mhek-OSKpfOS0o,22577
135
134
  orionis/luminate/services/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
135
  orionis/luminate/services/config/config_service.py,sha256=sVqX3UBxZA5whjiVFgfo5fzAb8QxD0NT0OYYlgZUK0g,2223
137
136
  orionis/luminate/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -160,9 +159,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
159
  tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
161
160
  tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
162
161
  tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
163
- orionis-0.90.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
164
- orionis-0.90.0.dist-info/METADATA,sha256=Lr6WtsT4DsU7UdUfU7Z45UFvDkPQjNmQfPg_lSGNuhM,2978
165
- orionis-0.90.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
166
- orionis-0.90.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
167
- orionis-0.90.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
168
- orionis-0.90.0.dist-info/RECORD,,
162
+ orionis-0.93.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
163
+ orionis-0.93.0.dist-info/METADATA,sha256=6VIb3YX5XinPwoOe3i7GzZ-zLazG2QcUN3zxvWTdzBc,2978
164
+ orionis-0.93.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
165
+ orionis-0.93.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
166
+ orionis-0.93.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
167
+ orionis-0.93.0.dist-info/RECORD,,
File without changes
File without changes