orionis 0.88.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.
- orionis/contracts/{console/tasks/i_schedule.py → services/commands/i_schedule_service.py} +1 -1
- orionis/framework.py +1 -1
- orionis/luminate/app.py +6 -0
- orionis/luminate/console/commands/help.py +2 -2
- orionis/luminate/console/commands/schedule_work.py +12 -7
- orionis/luminate/providers/commands/scheduler_provider.py +19 -0
- orionis/luminate/{console/tasks/scheduler.py → services/commands/scheduler_service.py} +7 -11
- {orionis-0.88.0.dist-info → orionis-0.93.0.dist-info}/METADATA +1 -1
- {orionis-0.88.0.dist-info → orionis-0.93.0.dist-info}/RECORD +13 -14
- orionis/contracts/console/tasks/__init__.py +0 -0
- orionis/luminate/console/tasks/__init__.py +0 -0
- {orionis-0.88.0.dist-info → orionis-0.93.0.dist-info}/LICENCE +0 -0
- {orionis-0.88.0.dist-info → orionis-0.93.0.dist-info}/WHEEL +0 -0
- {orionis-0.88.0.dist-info → orionis-0.93.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.88.0.dist-info → orionis-0.93.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
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,4 +1,4 @@
|
|
1
|
-
from orionis.luminate.app_context import
|
1
|
+
from orionis.luminate.app_context import app_context
|
2
2
|
from orionis.luminate.console.base.command import BaseCommand
|
3
3
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
4
4
|
|
@@ -35,7 +35,7 @@ class HelpCommand(BaseCommand):
|
|
35
35
|
self.textSuccessBold(" (CLI Interpreter) Available Commands: ")
|
36
36
|
|
37
37
|
# Fetch the commands from the container IoC
|
38
|
-
with
|
38
|
+
with app_context() as app:
|
39
39
|
|
40
40
|
# Get the list of commands from the container
|
41
41
|
commands : dict = app._commands
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import importlib
|
2
|
-
from orionis.luminate.app_context import AppContext
|
3
2
|
from orionis.luminate.console.base.command import BaseCommand
|
4
3
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisRuntimeError
|
5
|
-
from orionis.luminate.console.tasks.scheduler import Schedule
|
6
4
|
from orionis.contracts.console.i_task_manager import ITaskManager
|
5
|
+
from orionis.luminate.services.commands.scheduler_service import ScheduleService
|
7
6
|
|
8
7
|
class ScheduleWorkCommand(BaseCommand):
|
9
8
|
"""
|
@@ -19,6 +18,15 @@ class ScheduleWorkCommand(BaseCommand):
|
|
19
18
|
# A brief description of the command.
|
20
19
|
description = "Starts the scheduled tasks."
|
21
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
|
+
|
22
30
|
def handle(self) -> None:
|
23
31
|
"""
|
24
32
|
Execute the scheduled tasks.
|
@@ -34,17 +42,14 @@ class ScheduleWorkCommand(BaseCommand):
|
|
34
42
|
"""
|
35
43
|
try:
|
36
44
|
|
37
|
-
# Initialize a new Schedule instance.
|
38
|
-
schedule = Schedule()
|
39
|
-
|
40
45
|
# Create an instance of the TaskManager to manage the scheduling.
|
41
46
|
tasks_manager = importlib.import_module("app.console.tasks_manager")
|
42
47
|
TaskManager = getattr(tasks_manager, "TaskManager")
|
43
48
|
kernel: ITaskManager = TaskManager()
|
44
|
-
kernel.schedule(schedule)
|
49
|
+
kernel.schedule(self.schedule)
|
45
50
|
|
46
51
|
# Start running the scheduled tasks using the schedule runner.
|
47
|
-
schedule.start()
|
52
|
+
self.schedule.start()
|
48
53
|
|
49
54
|
except Exception as e:
|
50
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.
|
11
|
-
from orionis.luminate.app_context import AppContext
|
10
|
+
from orionis.contracts.services.commands.i_schedule_service import IScheduleService
|
12
11
|
from orionis.luminate.console.exceptions.cli_exception import CLIOrionisScheduleException
|
12
|
+
from orionis.luminate.facades.commands.commands_facade import Command
|
13
13
|
|
14
|
-
class
|
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 =
|
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) -> '
|
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
|
|
@@ -67,8 +67,7 @@ class Schedule(ISchedule):
|
|
67
67
|
"""
|
68
68
|
def func():
|
69
69
|
try:
|
70
|
-
|
71
|
-
app.container.makeCommand(signature, vars, *args, **kwargs)
|
70
|
+
Command.call(signature, vars, *args, **kwargs)
|
72
71
|
finally:
|
73
72
|
if not self.scheduler.get_jobs():
|
74
73
|
self.wait = False
|
@@ -605,12 +604,9 @@ class Schedule(ISchedule):
|
|
605
604
|
Starts the scheduler and stops automatically when there are no more jobs.
|
606
605
|
"""
|
607
606
|
try:
|
608
|
-
# Start the scheduler
|
609
607
|
while self.wait:
|
610
608
|
time.sleep(1)
|
611
609
|
except (KeyboardInterrupt, SystemExit):
|
612
|
-
# Stop the scheduler if it is running
|
613
610
|
if self.scheduler.running:
|
614
611
|
self.scheduler.shutdown()
|
615
|
-
# Exit with status code 1 to indicate an error
|
616
612
|
sys.exit(1)
|
@@ -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=
|
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=
|
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
|
@@ -87,8 +86,8 @@ orionis/luminate/console/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
87
86
|
orionis/luminate/console/base/command.py,sha256=YGHd5xVYILcNhQumi74IRnzvagvjufEO2Bx1CwHRToY,12544
|
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
|
-
orionis/luminate/console/commands/help.py,sha256=
|
91
|
-
orionis/luminate/console/commands/schedule_work.py,sha256=
|
89
|
+
orionis/luminate/console/commands/help.py,sha256=8_LOTuiZvA8HToKP5qBoN7rWlEo3T0Qik7-f3fyrTgo,2288
|
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=zt4p2VGUYGGrG2-E-MxyheKjBqGDJB2c0irULDsBgIw,22678
|
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.
|
164
|
-
orionis-0.
|
165
|
-
orionis-0.
|
166
|
-
orionis-0.
|
167
|
-
orionis-0.
|
168
|
-
orionis-0.
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|