orionis 0.527.0__py3-none-any.whl → 0.529.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/console/tasks/schedule.py +27 -24
- orionis/failure/catch.py +2 -1
- orionis/foundation/config/roots/paths.py +9 -0
- orionis/foundation/providers/scheduler_provider.py +2 -2
- orionis/metadata/framework.py +1 -1
- {orionis-0.527.0.dist-info → orionis-0.529.0.dist-info}/METADATA +1 -1
- {orionis-0.527.0.dist-info → orionis-0.529.0.dist-info}/RECORD +11 -11
- {orionis-0.527.0.dist-info → orionis-0.529.0.dist-info}/WHEEL +0 -0
- {orionis-0.527.0.dist-info → orionis-0.529.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.527.0.dist-info → orionis-0.529.0.dist-info}/top_level.txt +0 -0
- {orionis-0.527.0.dist-info → orionis-0.529.0.dist-info}/zip-safe +0 -0
|
@@ -3,20 +3,20 @@ from datetime import datetime
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Union
|
|
5
5
|
import pytz
|
|
6
|
-
from apscheduler.triggers.date import DateTrigger
|
|
7
6
|
from apscheduler.events import (
|
|
8
|
-
EVENT_SCHEDULER_STARTED,
|
|
9
|
-
EVENT_SCHEDULER_PAUSED,
|
|
10
|
-
EVENT_SCHEDULER_RESUMED,
|
|
11
|
-
EVENT_SCHEDULER_SHUTDOWN,
|
|
12
7
|
EVENT_JOB_ERROR,
|
|
13
|
-
EVENT_JOB_SUBMITTED,
|
|
14
8
|
EVENT_JOB_EXECUTED,
|
|
15
|
-
EVENT_JOB_MISSED,
|
|
16
9
|
EVENT_JOB_MAX_INSTANCES,
|
|
17
|
-
|
|
10
|
+
EVENT_JOB_MISSED,
|
|
11
|
+
EVENT_JOB_REMOVED,
|
|
12
|
+
EVENT_JOB_SUBMITTED,
|
|
13
|
+
EVENT_SCHEDULER_PAUSED,
|
|
14
|
+
EVENT_SCHEDULER_RESUMED,
|
|
15
|
+
EVENT_SCHEDULER_SHUTDOWN,
|
|
16
|
+
EVENT_SCHEDULER_STARTED,
|
|
18
17
|
)
|
|
19
18
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler as APSAsyncIOScheduler
|
|
19
|
+
from apscheduler.triggers.date import DateTrigger
|
|
20
20
|
from rich.console import Console
|
|
21
21
|
from rich.panel import Panel
|
|
22
22
|
from rich.text import Text
|
|
@@ -25,19 +25,21 @@ from orionis.console.contracts.reactor import IReactor
|
|
|
25
25
|
from orionis.console.contracts.schedule import ISchedule
|
|
26
26
|
from orionis.console.contracts.schedule_event_listener import IScheduleEventListener
|
|
27
27
|
from orionis.console.entities.event_job import EventJob
|
|
28
|
+
from orionis.console.entities.request import CLIRequest
|
|
28
29
|
from orionis.console.entities.scheduler_error import SchedulerError
|
|
29
30
|
from orionis.console.entities.scheduler_paused import SchedulerPaused
|
|
30
31
|
from orionis.console.entities.scheduler_resumed import SchedulerResumed
|
|
31
32
|
from orionis.console.entities.scheduler_shutdown import SchedulerShutdown
|
|
32
33
|
from orionis.console.entities.scheduler_started import SchedulerStarted
|
|
33
|
-
from orionis.console.enums.listener import ListeningEvent
|
|
34
34
|
from orionis.console.enums.event import Event as EventEntity
|
|
35
|
+
from orionis.console.enums.listener import ListeningEvent
|
|
35
36
|
from orionis.console.exceptions import CLIOrionisRuntimeError
|
|
36
37
|
from orionis.console.exceptions.cli_orionis_value_error import CLIOrionisValueError
|
|
38
|
+
from orionis.failure.contracts.catch import ICatch
|
|
37
39
|
from orionis.foundation.contracts.application import IApplication
|
|
38
40
|
from orionis.services.log.contracts.log_service import ILogger
|
|
39
41
|
|
|
40
|
-
class
|
|
42
|
+
class Schedule(ISchedule):
|
|
41
43
|
|
|
42
44
|
def __init__(
|
|
43
45
|
self,
|
|
@@ -108,6 +110,9 @@ class Scheduler(ISchedule):
|
|
|
108
110
|
# Add this line to the existing __init__ method
|
|
109
111
|
self._stopEvent: Optional[asyncio.Event] = None
|
|
110
112
|
|
|
113
|
+
# Retrieve and initialize the catch instance from the application container.
|
|
114
|
+
self.__catch: ICatch = app.make('x-orionis.failure.catch')
|
|
115
|
+
|
|
111
116
|
def __getCurrentTime(
|
|
112
117
|
self
|
|
113
118
|
) -> str:
|
|
@@ -372,7 +377,6 @@ class Scheduler(ISchedule):
|
|
|
372
377
|
# Extract additional event data if available
|
|
373
378
|
_details = event_data.get('details', None)
|
|
374
379
|
|
|
375
|
-
|
|
376
380
|
# Create and return a Job entity based on the retrieved job data
|
|
377
381
|
return EventJob(
|
|
378
382
|
id=_id,
|
|
@@ -763,21 +767,17 @@ class Scheduler(ISchedule):
|
|
|
763
767
|
This method does not return any value. It performs logging, error reporting,
|
|
764
768
|
and listener invocation for the job error event.
|
|
765
769
|
"""
|
|
766
|
-
|
|
767
770
|
# Log an error message indicating that the job raised an exception
|
|
768
771
|
self.__logger.error(f"Task {event.job_id} raised an exception: {event.exception}")
|
|
769
772
|
|
|
770
773
|
# If a listener is registered for this job ID, invoke the listener with the event details
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
774
|
+
job_event_data = self.__getTaskFromSchedulerById(event.job_id)
|
|
775
|
+
job_event_data.code = event.code if hasattr(event, 'code') else 0
|
|
776
|
+
job_event_data.exception = event.exception if hasattr(event, 'exception') else None
|
|
777
|
+
job_event_data.traceback = event.traceback if hasattr(event, 'traceback') else None
|
|
775
778
|
|
|
776
779
|
# Call the task-specific listener for job errors
|
|
777
|
-
self.__taskCallableListener(
|
|
778
|
-
event_data,
|
|
779
|
-
ListeningEvent.JOB_ON_FAILURE
|
|
780
|
-
)
|
|
780
|
+
self.__taskCallableListener(job_event_data, ListeningEvent.JOB_ON_FAILURE)
|
|
781
781
|
|
|
782
782
|
# Check if a listener is registered for the scheduler error event
|
|
783
783
|
event_data = SchedulerError(
|
|
@@ -785,10 +785,13 @@ class Scheduler(ISchedule):
|
|
|
785
785
|
exception=event.exception if hasattr(event, 'exception') else None,
|
|
786
786
|
traceback=event.traceback if hasattr(event, 'traceback') else None,
|
|
787
787
|
)
|
|
788
|
-
self.__globalCallableListener(
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
788
|
+
self.__globalCallableListener(event_data, ListeningEvent.SCHEDULER_ERROR)
|
|
789
|
+
|
|
790
|
+
# Catch any exceptions that occur during command handling
|
|
791
|
+
self.__catch.exception(self, CLIRequest(
|
|
792
|
+
command=job_event_data.id,
|
|
793
|
+
args=list(job_event_data.args) or []
|
|
794
|
+
), event.exception)
|
|
792
795
|
|
|
793
796
|
def __submittedListener(
|
|
794
797
|
self,
|
orionis/failure/catch.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
from orionis.console.kernel import KernelCLI
|
|
3
3
|
from orionis.console.output.contracts.console import IConsole
|
|
4
|
+
from orionis.console.tasks.schedule import Schedule
|
|
4
5
|
from orionis.failure.contracts.catch import ICatch
|
|
5
6
|
from orionis.failure.contracts.handler import IBaseExceptionHandler
|
|
6
7
|
from orionis.foundation.contracts.application import IApplication
|
|
@@ -84,7 +85,7 @@ class Catch(ICatch):
|
|
|
84
85
|
)
|
|
85
86
|
|
|
86
87
|
# If a kernel is provided, render the exception details to the CLI
|
|
87
|
-
if isinstance(kernel, KernelCLI):
|
|
88
|
+
if isinstance(kernel, KernelCLI) or isinstance(kernel, Schedule):
|
|
88
89
|
return self.__exception_handler.renderCLI(
|
|
89
90
|
request=request,
|
|
90
91
|
exception=e,
|
|
@@ -22,6 +22,15 @@ class Paths(BaseEntity):
|
|
|
22
22
|
}
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
+
commands: str = field(
|
|
26
|
+
default_factory = lambda: str((Path.cwd() / 'app' / 'console' / 'commands').resolve()),
|
|
27
|
+
metadata = {
|
|
28
|
+
'description': 'Directory containing subfolders for console commands and scheduler.py.',
|
|
29
|
+
'default': lambda: str((Path.cwd() / 'app' / 'console' / 'commands').resolve())
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
25
34
|
controllers: str = field(
|
|
26
35
|
default_factory = lambda: str((Path.cwd() / 'app' / 'http' / 'controllers').resolve()),
|
|
27
36
|
metadata = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from orionis.console.contracts.schedule import ISchedule
|
|
2
|
-
from orionis.console.tasks.schedule import
|
|
2
|
+
from orionis.console.tasks.schedule import Schedule
|
|
3
3
|
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
4
|
|
|
5
5
|
class ScheduleProvider(ServiceProvider):
|
|
@@ -33,7 +33,7 @@ class ScheduleProvider(ServiceProvider):
|
|
|
33
33
|
This method does not return any value.
|
|
34
34
|
"""
|
|
35
35
|
# Bind Scheduler as a singleton to the ISchedule interface with an alias
|
|
36
|
-
self.app.singleton(ISchedule,
|
|
36
|
+
self.app.singleton(ISchedule, Schedule, alias="x-orionis.console.contracts.schedule")
|
|
37
37
|
|
|
38
38
|
def boot(self) -> None:
|
|
39
39
|
"""
|
orionis/metadata/framework.py
CHANGED
|
@@ -83,7 +83,7 @@ orionis/console/request/cli_request.py,sha256=7-sgYmNUCipuHLVAwWLJiHv0cJCDmsM1Lu
|
|
|
83
83
|
orionis/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
84
|
orionis/console/tasks/event.py,sha256=l4J-HEPaj1mxB_PYQMgG9dRHUe01wUag8fKLLnR2N2M,164395
|
|
85
85
|
orionis/console/tasks/listener.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
|
-
orionis/console/tasks/schedule.py,sha256=
|
|
86
|
+
orionis/console/tasks/schedule.py,sha256=oezk-Z0L2hyB13c0KdWYnLL1mcQVzXBPmqgcbAapJ1w,82546
|
|
87
87
|
orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
88
|
orionis/container/container.py,sha256=aF_b6lTUpG4YCo9yFJEzsntTdIzgMMXFW5LyWqAJVBQ,87987
|
|
89
89
|
orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -116,7 +116,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
|
|
|
116
116
|
orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
|
|
117
117
|
orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
|
|
118
118
|
orionis/failure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
119
|
-
orionis/failure/catch.py,sha256=
|
|
119
|
+
orionis/failure/catch.py,sha256=Tk2IE6lpt2n3jHn4--3U-QLyDrBIwUnNnKi7ZRmGnOg,3715
|
|
120
120
|
orionis/failure/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
121
121
|
orionis/failure/base/handler.py,sha256=L6jB2_2f8ZKBuys8o_iXTwMM_yjQHY7iXNF1Q3X8BGY,4661
|
|
122
122
|
orionis/failure/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -203,7 +203,7 @@ orionis/foundation/config/queue/entities/queue.py,sha256=YiWPeEg5e0fd_DJM2ogska6
|
|
|
203
203
|
orionis/foundation/config/queue/enums/__init__.py,sha256=oWY8GWwr5mex7szs_bLVqAS1jbyuIAvKl7XFGSlU9A0,64
|
|
204
204
|
orionis/foundation/config/queue/enums/strategy.py,sha256=S_kw7KZtoCk5FTOkbuXepdy_fOl9Eav4uT2K0OyzBa0,602
|
|
205
205
|
orionis/foundation/config/roots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
206
|
-
orionis/foundation/config/roots/paths.py,sha256=
|
|
206
|
+
orionis/foundation/config/roots/paths.py,sha256=oplhq0aZkYdHIHH6RfV-Pn0fWc-gOwgrtpaex_rvqTk,10920
|
|
207
207
|
orionis/foundation/config/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
208
208
|
orionis/foundation/config/session/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
209
209
|
orionis/foundation/config/session/entities/session.py,sha256=G3dRlzDCsL5_2A2ZKpge2Jwcu6N-YVsum09pWk9oHDc,6085
|
|
@@ -237,11 +237,11 @@ orionis/foundation/providers/logger_provider.py,sha256=rs8UpaD_vSp3qNli0u9A4eRum
|
|
|
237
237
|
orionis/foundation/providers/performance_counter_provider.py,sha256=7y10Vaqx7GemGh2wCaww8XmdvFQXLXm9_E4GjpdNXcA,3010
|
|
238
238
|
orionis/foundation/providers/progress_bar_provider.py,sha256=X4Ke7mPr0MgVp6WDNaQ3bI3Z_LOS8qE-wid0MQErKms,3367
|
|
239
239
|
orionis/foundation/providers/reactor_provider.py,sha256=P0KQcp4AFKTrD6BStGfCTqhGUlpKgsrZTZZKSqyGJQg,3662
|
|
240
|
-
orionis/foundation/providers/scheduler_provider.py,sha256=
|
|
240
|
+
orionis/foundation/providers/scheduler_provider.py,sha256=1do4B09bU_6xbFHHVYYTGMWis3wW6-mbENg52rksmUs,2130
|
|
241
241
|
orionis/foundation/providers/testing_provider.py,sha256=SrJRpdvcblx9WvX7x9Y3zc7OQfiTf7la0HAJrm2ESlE,3725
|
|
242
242
|
orionis/foundation/providers/workers_provider.py,sha256=oa_2NIDH6UxZrtuGkkoo_zEoNIMGgJ46vg5CCgAm7wI,3926
|
|
243
243
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
244
|
-
orionis/metadata/framework.py,sha256=
|
|
244
|
+
orionis/metadata/framework.py,sha256=KSIr45mPJD8Xe_R8lz2kUYhFGKDI3gp43norbMrfEYY,4109
|
|
245
245
|
orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
|
|
246
246
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
247
247
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -419,7 +419,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
|
|
|
419
419
|
orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
|
|
420
420
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
421
421
|
orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
|
|
422
|
-
orionis-0.
|
|
422
|
+
orionis-0.529.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
|
423
423
|
tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
424
424
|
tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
425
425
|
tests/container/context/test_manager.py,sha256=wOwXpl9rHNfTTexa9GBKYMwK0_-KSQPbI-AEyGNkmAE,1356
|
|
@@ -565,8 +565,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
565
565
|
tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
|
|
566
566
|
tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
567
567
|
tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
|
|
568
|
-
orionis-0.
|
|
569
|
-
orionis-0.
|
|
570
|
-
orionis-0.
|
|
571
|
-
orionis-0.
|
|
572
|
-
orionis-0.
|
|
568
|
+
orionis-0.529.0.dist-info/METADATA,sha256=48O-op1F2RW9AdutQZ_sR5GA7IfebIxb7O00TrsfW9E,4801
|
|
569
|
+
orionis-0.529.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
570
|
+
orionis-0.529.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
|
571
|
+
orionis-0.529.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
572
|
+
orionis-0.529.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|