orionis 0.510.0__py3-none-any.whl → 0.512.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/base/scheduler_event_listener.py +136 -0
- orionis/console/commands/scheduler_work.py +37 -25
- orionis/console/contracts/event.py +3032 -9
- orionis/console/contracts/schedule.py +34 -0
- orionis/console/contracts/schedule_event_listener.py +324 -0
- orionis/console/entities/all_jobs_removed.py +23 -0
- orionis/console/entities/executor_added.py +23 -0
- orionis/console/entities/executor_removed.py +25 -0
- orionis/console/entities/job_added.py +24 -0
- orionis/console/entities/job_error.py +35 -0
- orionis/console/entities/job_event_data.py +40 -0
- orionis/console/entities/job_executed.py +31 -0
- orionis/console/entities/job_max_instances.py +27 -0
- orionis/console/entities/job_missed.py +25 -0
- orionis/console/entities/job_modified.py +23 -0
- orionis/console/entities/job_pause.py +22 -0
- orionis/console/entities/job_removed.py +22 -0
- orionis/console/entities/job_resume.py +25 -0
- orionis/console/entities/job_store_added.py +24 -0
- orionis/console/entities/job_store_removed.py +25 -0
- orionis/console/entities/job_submitted.py +24 -0
- orionis/console/entities/scheduler_event_data.py +33 -0
- orionis/console/entities/scheduler_paused.py +17 -0
- orionis/console/entities/scheduler_resumed.py +24 -0
- orionis/console/entities/scheduler_shutdown.py +23 -0
- orionis/console/entities/scheduler_started.py +21 -0
- orionis/console/enums/listener.py +75 -0
- orionis/console/tasks/event.py +3703 -21
- orionis/console/tasks/schedule.py +702 -48
- orionis/metadata/framework.py +1 -1
- {orionis-0.510.0.dist-info → orionis-0.512.0.dist-info}/METADATA +1 -1
- {orionis-0.510.0.dist-info → orionis-0.512.0.dist-info}/RECORD +36 -15
- orionis/console/contracts/listener.py +0 -132
- orionis/console/entities/listeners.py +0 -241
- orionis/console/tasks/exception_report.py +0 -94
- {orionis-0.510.0.dist-info → orionis-0.512.0.dist-info}/WHEEL +0 -0
- {orionis-0.510.0.dist-info → orionis-0.512.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.510.0.dist-info → orionis-0.512.0.dist-info}/top_level.txt +0 -0
- {orionis-0.510.0.dist-info → orionis-0.512.0.dist-info}/zip-safe +0 -0
|
@@ -4,6 +4,40 @@ from orionis.console.tasks.event import Event
|
|
|
4
4
|
|
|
5
5
|
class ISchedule(ABC):
|
|
6
6
|
|
|
7
|
+
@abstractmethod
|
|
8
|
+
def _setListener(
|
|
9
|
+
self,
|
|
10
|
+
event: str,
|
|
11
|
+
listener: callable
|
|
12
|
+
) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Register a listener callback for a specific scheduler event.
|
|
15
|
+
|
|
16
|
+
This method allows the registration of a callable listener function that will be
|
|
17
|
+
invoked when the specified scheduler event occurs. The event can be one of the
|
|
18
|
+
predefined global events or a specific job ID. The listener must be a callable
|
|
19
|
+
function that accepts a single argument, which will be the event object.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
event : str
|
|
24
|
+
The name of the event to listen for. This can be a global event name (e.g., 'scheduler_started')
|
|
25
|
+
or a specific job ID.
|
|
26
|
+
listener : callable
|
|
27
|
+
A callable function that will be invoked when the specified event occurs.
|
|
28
|
+
The function should accept one parameter, which will be the event object.
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
None
|
|
33
|
+
This method does not return any value. It registers the listener for the specified event.
|
|
34
|
+
|
|
35
|
+
Raises
|
|
36
|
+
------
|
|
37
|
+
ValueError
|
|
38
|
+
If the event name is not a non-empty string or if the listener is not callable.
|
|
39
|
+
"""
|
|
40
|
+
|
|
7
41
|
@abstractmethod
|
|
8
42
|
def command(
|
|
9
43
|
self,
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
from orionis.console.entities.job_error import JobError
|
|
4
|
+
from orionis.console.entities.job_executed import JobExecuted
|
|
5
|
+
from orionis.console.entities.job_max_instances import JobMaxInstances
|
|
6
|
+
from orionis.console.entities.job_missed import JobMissed
|
|
7
|
+
from orionis.console.entities.job_pause import JobPause
|
|
8
|
+
from orionis.console.entities.job_removed import JobRemoved
|
|
9
|
+
from orionis.console.entities.job_resume import JobResume
|
|
10
|
+
from orionis.console.entities.job_submitted import JobSubmitted
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from orionis.console.contracts.schedule import ISchedule
|
|
14
|
+
|
|
15
|
+
class IScheduleEventListener(ABC):
|
|
16
|
+
"""
|
|
17
|
+
Interface for event listeners that handle various stages of event processing.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
async def before(self, event: JobSubmitted, schedule):
|
|
22
|
+
"""
|
|
23
|
+
Hook method called before the main event handling logic.
|
|
24
|
+
|
|
25
|
+
This method is invoked prior to processing the event, allowing for any
|
|
26
|
+
pre-processing or setup tasks to be performed. It can be overridden to
|
|
27
|
+
implement custom logic that should execute before the event is handled.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
event : JobSubmitted
|
|
32
|
+
The event object that is about to be processed. This contains
|
|
33
|
+
information about the job submission.
|
|
34
|
+
schedule : ISchedule
|
|
35
|
+
The schedule object associated with the event. This provides
|
|
36
|
+
context about the scheduling system.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
None
|
|
41
|
+
This method does not return any value.
|
|
42
|
+
|
|
43
|
+
Notes
|
|
44
|
+
-----
|
|
45
|
+
Override this method to define actions or checks that should occur
|
|
46
|
+
before the event is processed.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
# This is an abstract method, so it does not contain any implementation.
|
|
50
|
+
# Subclasses must override this method to provide specific behavior.
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
@abstractmethod
|
|
54
|
+
async def after(self, event: JobExecuted, schedule):
|
|
55
|
+
"""
|
|
56
|
+
Hook method called after an event is processed.
|
|
57
|
+
|
|
58
|
+
This method is invoked once the event processing is complete, allowing
|
|
59
|
+
for any post-processing or cleanup tasks to be performed. It can be
|
|
60
|
+
overridden to implement custom logic that should execute after the
|
|
61
|
+
event is handled.
|
|
62
|
+
|
|
63
|
+
Parameters
|
|
64
|
+
----------
|
|
65
|
+
event : JobExecuted
|
|
66
|
+
The event object that was processed. This contains information
|
|
67
|
+
about the job execution, such as its status and metadata.
|
|
68
|
+
schedule : ISchedule
|
|
69
|
+
The schedule object associated with the event. This provides
|
|
70
|
+
context about the scheduling system and its state.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
None
|
|
75
|
+
This method does not return any value.
|
|
76
|
+
|
|
77
|
+
Notes
|
|
78
|
+
-----
|
|
79
|
+
Override this method to define actions or checks that should occur
|
|
80
|
+
after the event is processed, such as logging, resource cleanup, or
|
|
81
|
+
triggering subsequent tasks.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
# This is an abstract method, so it does not contain any implementation.
|
|
85
|
+
# Subclasses must override this method to provide specific behavior.
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
async def onSuccess(self, event: JobExecuted, schedule):
|
|
90
|
+
"""
|
|
91
|
+
Handle actions to be performed when an event is successfully processed.
|
|
92
|
+
|
|
93
|
+
This method is invoked after an event is processed successfully, allowing
|
|
94
|
+
for any follow-up actions, such as logging, notifications, or triggering
|
|
95
|
+
dependent tasks. Subclasses should override this method to define custom
|
|
96
|
+
behavior for handling successful event processing.
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
event : JobExecuted
|
|
101
|
+
The event object containing details about the successfully executed job,
|
|
102
|
+
such as its status, metadata, and execution results.
|
|
103
|
+
schedule : ISchedule
|
|
104
|
+
The schedule object associated with the event, providing context about
|
|
105
|
+
the scheduling system and its state.
|
|
106
|
+
|
|
107
|
+
Returns
|
|
108
|
+
-------
|
|
109
|
+
None
|
|
110
|
+
This method does not return any value.
|
|
111
|
+
|
|
112
|
+
Notes
|
|
113
|
+
-----
|
|
114
|
+
Override this method to implement specific actions or checks that should
|
|
115
|
+
occur after an event is successfully processed.
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
# This is an abstract method, so it does not contain any implementation.
|
|
119
|
+
# Subclasses must override this method to provide specific behavior.
|
|
120
|
+
pass
|
|
121
|
+
|
|
122
|
+
@abstractmethod
|
|
123
|
+
async def onFailure(self, event: JobError, schedule):
|
|
124
|
+
"""
|
|
125
|
+
Handle the event when a failure occurs during event processing.
|
|
126
|
+
|
|
127
|
+
This method is invoked whenever an error or failure occurs during the
|
|
128
|
+
processing of an event. It allows for custom error handling logic to be
|
|
129
|
+
implemented, such as logging the error, notifying relevant parties, or
|
|
130
|
+
performing cleanup tasks. Subclasses should override this method to
|
|
131
|
+
define specific actions to take in response to failures.
|
|
132
|
+
|
|
133
|
+
Parameters
|
|
134
|
+
----------
|
|
135
|
+
event : JobError
|
|
136
|
+
The event object containing detailed information about the failure,
|
|
137
|
+
including the error message, stack trace, and any relevant metadata.
|
|
138
|
+
schedule : ISchedule
|
|
139
|
+
The schedule object associated with the event, providing context
|
|
140
|
+
about the scheduling system and its state at the time of the failure.
|
|
141
|
+
|
|
142
|
+
Returns
|
|
143
|
+
-------
|
|
144
|
+
None
|
|
145
|
+
This method does not return any value. It is intended for handling
|
|
146
|
+
side effects or performing actions in response to the failure.
|
|
147
|
+
|
|
148
|
+
Notes
|
|
149
|
+
-----
|
|
150
|
+
Override this method to implement specific error handling logic that
|
|
151
|
+
aligns with the application's requirements.
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
# This is an abstract method, so it does not contain any implementation.
|
|
155
|
+
# Subclasses must override this method to provide specific behavior.
|
|
156
|
+
pass
|
|
157
|
+
|
|
158
|
+
@abstractmethod
|
|
159
|
+
async def onMissed(self, event: JobMissed, schedule):
|
|
160
|
+
"""
|
|
161
|
+
Handle the event triggered when an expected job execution is missed.
|
|
162
|
+
|
|
163
|
+
This method is invoked whenever a scheduled job is missed, allowing for
|
|
164
|
+
custom handling logic to be implemented. Subclasses should override this
|
|
165
|
+
method to define specific actions to take in response to missed events,
|
|
166
|
+
such as logging, notifications, or corrective measures.
|
|
167
|
+
|
|
168
|
+
Parameters
|
|
169
|
+
----------
|
|
170
|
+
event : JobMissed
|
|
171
|
+
The event object containing details about the missed job, including
|
|
172
|
+
its metadata and the reason it was missed.
|
|
173
|
+
schedule : ISchedule
|
|
174
|
+
The schedule object associated with the event, providing context
|
|
175
|
+
about the scheduling system and its state at the time of the missed event.
|
|
176
|
+
|
|
177
|
+
Returns
|
|
178
|
+
-------
|
|
179
|
+
None
|
|
180
|
+
This method does not return any value. It is intended for handling
|
|
181
|
+
side effects or performing actions in response to the missed event.
|
|
182
|
+
|
|
183
|
+
Notes
|
|
184
|
+
-----
|
|
185
|
+
Override this method to implement specific logic that aligns with the
|
|
186
|
+
application's requirements for handling missed job executions.
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
# Abstract method: Subclasses must provide an implementation for this.
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
@abstractmethod
|
|
193
|
+
async def onMaxInstances(self, event: JobMaxInstances, schedule):
|
|
194
|
+
"""
|
|
195
|
+
Handle the event triggered when a job exceeds the maximum allowed instances.
|
|
196
|
+
|
|
197
|
+
This method is invoked whenever a job attempts to run but is blocked
|
|
198
|
+
because it has reached its maximum number of concurrent instances.
|
|
199
|
+
Subclasses should override this method to define specific actions to
|
|
200
|
+
take in response to this event, such as logging, notifications, or
|
|
201
|
+
implementing backoff strategies.
|
|
202
|
+
|
|
203
|
+
Parameters
|
|
204
|
+
----------
|
|
205
|
+
event : JobMaxInstances
|
|
206
|
+
The event object containing details about the job that exceeded
|
|
207
|
+
its maximum instances, including its metadata and the configured limit.
|
|
208
|
+
schedule : ISchedule
|
|
209
|
+
The schedule object associated with the event, providing context
|
|
210
|
+
about the scheduling system and its state at the time of the event.
|
|
211
|
+
|
|
212
|
+
Returns
|
|
213
|
+
-------
|
|
214
|
+
None
|
|
215
|
+
This method does not return any value. It is intended for handling
|
|
216
|
+
side effects or performing actions in response to the max instances event.
|
|
217
|
+
|
|
218
|
+
Notes
|
|
219
|
+
-----
|
|
220
|
+
Override this method to implement specific logic that aligns with the
|
|
221
|
+
application's requirements for handling jobs that exceed their maximum instances.
|
|
222
|
+
"""
|
|
223
|
+
|
|
224
|
+
# Abstract method: Subclasses must provide an implementation for this.
|
|
225
|
+
pass
|
|
226
|
+
|
|
227
|
+
@abstractmethod
|
|
228
|
+
async def onPaused(self, event: JobPause, schedule):
|
|
229
|
+
"""
|
|
230
|
+
Handle the event triggered when the scheduler is paused.
|
|
231
|
+
|
|
232
|
+
This method is invoked whenever the scheduler is paused, allowing for
|
|
233
|
+
custom handling logic to be implemented. Subclasses should override this
|
|
234
|
+
method to define specific actions to take in response to the pause event,
|
|
235
|
+
such as logging, notifications, or resource management.
|
|
236
|
+
|
|
237
|
+
Parameters
|
|
238
|
+
----------
|
|
239
|
+
event : JobPause
|
|
240
|
+
The event object containing details about the pause event.
|
|
241
|
+
schedule : ISchedule
|
|
242
|
+
The schedule object associated with the event, providing context
|
|
243
|
+
about the scheduling system and its state at the time of the pause event.
|
|
244
|
+
|
|
245
|
+
Returns
|
|
246
|
+
-------
|
|
247
|
+
None
|
|
248
|
+
This method does not return any value. It is intended for handling
|
|
249
|
+
side effects or performing actions in response to the pause event.
|
|
250
|
+
|
|
251
|
+
Notes
|
|
252
|
+
-----
|
|
253
|
+
Override this method to implement specific logic that aligns with the
|
|
254
|
+
application's requirements for handling scheduler pause events.
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
# Abstract method: Subclasses must provide an implementation for this.
|
|
258
|
+
pass
|
|
259
|
+
|
|
260
|
+
@abstractmethod
|
|
261
|
+
async def onResumed(self, event: JobResume, schedule):
|
|
262
|
+
"""
|
|
263
|
+
Handle the event triggered when the scheduler is resumed.
|
|
264
|
+
|
|
265
|
+
This method is invoked whenever the scheduler is resumed, allowing for
|
|
266
|
+
custom handling logic to be implemented. Subclasses should override this
|
|
267
|
+
method to define specific actions to take in response to the resume event,
|
|
268
|
+
such as logging, notifications, or resource management.
|
|
269
|
+
|
|
270
|
+
Parameters
|
|
271
|
+
----------
|
|
272
|
+
event : JobResume
|
|
273
|
+
The event object containing details about the resume event.
|
|
274
|
+
schedule : ISchedule
|
|
275
|
+
The schedule object associated with the event, providing context
|
|
276
|
+
about the scheduling system and its state at the time of the resume event.
|
|
277
|
+
|
|
278
|
+
Returns
|
|
279
|
+
-------
|
|
280
|
+
None
|
|
281
|
+
This method does not return any value. It is intended for handling
|
|
282
|
+
side effects or performing actions in response to the resume event.
|
|
283
|
+
|
|
284
|
+
Notes
|
|
285
|
+
-----
|
|
286
|
+
Override this method to implement specific logic that aligns with the
|
|
287
|
+
application's requirements for handling scheduler resume events.
|
|
288
|
+
"""
|
|
289
|
+
|
|
290
|
+
# Abstract method: Subclasses must provide an implementation for this.
|
|
291
|
+
pass
|
|
292
|
+
|
|
293
|
+
@abstractmethod
|
|
294
|
+
async def onRemoved(self, event: JobRemoved, schedule):
|
|
295
|
+
"""
|
|
296
|
+
Handle the event triggered when a job is removed from the scheduler.
|
|
297
|
+
|
|
298
|
+
This method is invoked whenever a job is removed, allowing for custom
|
|
299
|
+
handling logic to be implemented. Subclasses should override this method
|
|
300
|
+
to define specific actions to take in response to the job removal event,
|
|
301
|
+
such as logging, notifications, or resource cleanup.
|
|
302
|
+
|
|
303
|
+
Parameters
|
|
304
|
+
----------
|
|
305
|
+
event : JobRemoved
|
|
306
|
+
The event object containing details about the removed job.
|
|
307
|
+
schedule : ISchedule
|
|
308
|
+
The schedule object associated with the event, providing context
|
|
309
|
+
about the scheduling system and its state at the time of the job removal.
|
|
310
|
+
|
|
311
|
+
Returns
|
|
312
|
+
-------
|
|
313
|
+
None
|
|
314
|
+
This method does not return any value. It is intended for handling
|
|
315
|
+
side effects or performing actions in response to the job removal event.
|
|
316
|
+
|
|
317
|
+
Notes
|
|
318
|
+
-----
|
|
319
|
+
Override this method to implement specific logic that aligns with the
|
|
320
|
+
application's requirements for handling job removal events.
|
|
321
|
+
"""
|
|
322
|
+
|
|
323
|
+
# Abstract method: Subclasses must provide an implementation for this.
|
|
324
|
+
pass
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from orionis.console.entities.scheduler_event_data import SchedulerEventData
|
|
3
|
+
|
|
4
|
+
@dataclass(kw_only=True)
|
|
5
|
+
class AllJobsRemoved(SchedulerEventData):
|
|
6
|
+
"""
|
|
7
|
+
Represents an event triggered when all jobs are removed from a specific job store.
|
|
8
|
+
|
|
9
|
+
This event is typically used to notify that a job store has been cleared of all its jobs.
|
|
10
|
+
|
|
11
|
+
Attributes
|
|
12
|
+
----------
|
|
13
|
+
jobstore : str
|
|
14
|
+
The alias or identifier of the job store from which all jobs were removed.
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
None
|
|
19
|
+
This class does not return a value; it is used to encapsulate event data.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# The alias of the job store from which jobs were removed
|
|
23
|
+
jobstore: str
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from orionis.console.entities.scheduler_event_data import SchedulerEventData
|
|
3
|
+
|
|
4
|
+
@dataclass(kw_only=True)
|
|
5
|
+
class ExecutorAdded(SchedulerEventData):
|
|
6
|
+
"""
|
|
7
|
+
Represents an event triggered when an executor is added to the system.
|
|
8
|
+
|
|
9
|
+
This event is used to notify that a new executor has been successfully added.
|
|
10
|
+
|
|
11
|
+
Attributes
|
|
12
|
+
----------
|
|
13
|
+
alias : str
|
|
14
|
+
The unique alias or identifier of the added executor.
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
ExecutorAdded
|
|
19
|
+
An instance of the ExecutorAdded event containing the alias of the added executor.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# The alias of the added executor, used to uniquely identify it
|
|
23
|
+
alias: str
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from orionis.console.entities.scheduler_event_data import SchedulerEventData
|
|
3
|
+
|
|
4
|
+
@dataclass(kw_only=True)
|
|
5
|
+
class ExecutorRemoved(SchedulerEventData):
|
|
6
|
+
"""
|
|
7
|
+
Represents an event triggered when an executor is removed.
|
|
8
|
+
|
|
9
|
+
This event is used to notify the system that a specific executor, identified
|
|
10
|
+
by its alias, has been removed from the scheduler.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
alias : str
|
|
15
|
+
The alias (unique identifier) of the removed executor.
|
|
16
|
+
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
None
|
|
20
|
+
This class does not return a value; it is used as a data structure
|
|
21
|
+
to encapsulate event information.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
# The alias of the removed executor
|
|
25
|
+
alias: str
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
3
|
+
|
|
4
|
+
@dataclass(kw_only=True)
|
|
5
|
+
class JobAdded(JobEventData):
|
|
6
|
+
"""
|
|
7
|
+
Represents an event triggered when a job is added to a job store.
|
|
8
|
+
|
|
9
|
+
This class extends the `JobEventData` base class, inheriting its attributes
|
|
10
|
+
and functionality. It is used to encapsulate data related to the addition
|
|
11
|
+
of a job in the system.
|
|
12
|
+
|
|
13
|
+
Attributes
|
|
14
|
+
----------
|
|
15
|
+
Inherits all attributes from the `JobEventData` base class.
|
|
16
|
+
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
JobAdded
|
|
20
|
+
An instance of the `JobAdded` class containing data about the added job.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
# This class currently does not define additional attributes or methods.
|
|
24
|
+
# It serves as a specialized event type for job addition events.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
4
|
+
|
|
5
|
+
@dataclass(kw_only=True)
|
|
6
|
+
class JobError(JobEventData):
|
|
7
|
+
"""
|
|
8
|
+
Represents an event triggered when a job raises an exception during execution.
|
|
9
|
+
|
|
10
|
+
This class is used to encapsulate information about an error that occurred
|
|
11
|
+
during the execution of a scheduled job, including the time the job was
|
|
12
|
+
scheduled to run, the exception raised, and the traceback details.
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
scheduled_run_time : datetime
|
|
17
|
+
The datetime when the job was scheduled to run.
|
|
18
|
+
exception : Exception
|
|
19
|
+
The exception instance raised by the job during execution.
|
|
20
|
+
traceback : str
|
|
21
|
+
The traceback string providing details about where the exception occurred.
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
JobError
|
|
26
|
+
An instance of the `JobError` class containing details about the job error event.
|
|
27
|
+
"""
|
|
28
|
+
# The time the job was scheduled to run
|
|
29
|
+
scheduled_run_time: datetime
|
|
30
|
+
|
|
31
|
+
# The exception raised during the job's execution
|
|
32
|
+
exception: Exception
|
|
33
|
+
|
|
34
|
+
# The traceback string providing details about the exception
|
|
35
|
+
traceback: str
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from orionis.console.entities.scheduler_event_data import SchedulerEventData
|
|
4
|
+
|
|
5
|
+
@dataclass(kw_only=True)
|
|
6
|
+
class JobEventData(SchedulerEventData):
|
|
7
|
+
"""
|
|
8
|
+
Represents the base class for events related to jobs in the scheduler system.
|
|
9
|
+
|
|
10
|
+
This class extends `SchedulerEventData` and provides additional attributes
|
|
11
|
+
specific to job-related events, such as the job's identifier and the job store
|
|
12
|
+
where it resides.
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
code : int
|
|
17
|
+
A numeric code that uniquely identifies the type of event within the
|
|
18
|
+
scheduler system. (Inherited from `SchedulerEventData`)
|
|
19
|
+
alias : str, optional
|
|
20
|
+
An optional string providing additional context or identifying specific
|
|
21
|
+
components (e.g., executors or job stores) related to the event.
|
|
22
|
+
(Inherited from `SchedulerEventData`)
|
|
23
|
+
job_id : str
|
|
24
|
+
The unique identifier of the job associated with the event.
|
|
25
|
+
jobstore : str, optional
|
|
26
|
+
The name of the job store where the job is located. If not specified,
|
|
27
|
+
it defaults to `None`.
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
-------
|
|
31
|
+
JobEventData
|
|
32
|
+
An instance of the `JobEventData` class containing information about
|
|
33
|
+
the job-related event.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
# The unique identifier of the job
|
|
37
|
+
job_id: str
|
|
38
|
+
|
|
39
|
+
# The name of the job store where the job resides (optional)
|
|
40
|
+
jobstore: Optional[str] = None
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from typing import Any
|
|
4
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
5
|
+
|
|
6
|
+
@dataclass(kw_only=True)
|
|
7
|
+
class JobExecuted(JobEventData):
|
|
8
|
+
"""
|
|
9
|
+
Represents an event triggered when a job completes successfully.
|
|
10
|
+
|
|
11
|
+
This class is used to encapsulate information about a successfully executed job,
|
|
12
|
+
including the time it was scheduled to run and the return value of the job function.
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
scheduled_run_time : datetime
|
|
17
|
+
The datetime when the job was scheduled to execute.
|
|
18
|
+
retval : Any
|
|
19
|
+
The return value produced by the job function upon successful execution.
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
JobExecuted
|
|
24
|
+
An instance of the `JobExecuted` class containing details about the executed job.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
# The datetime when the job was scheduled to run
|
|
28
|
+
scheduled_run_time: datetime
|
|
29
|
+
|
|
30
|
+
# The return value of the job function
|
|
31
|
+
retval: Any
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
4
|
+
|
|
5
|
+
@dataclass(kw_only=True)
|
|
6
|
+
class JobMaxInstances(JobEventData):
|
|
7
|
+
"""
|
|
8
|
+
Represents an event triggered when a job exceeds its maximum allowed instances.
|
|
9
|
+
|
|
10
|
+
This class is a specialized event data structure that inherits from `JobEventData`.
|
|
11
|
+
It is used to capture and store information about the event when a job exceeds
|
|
12
|
+
the maximum number of instances it is allowed to run.
|
|
13
|
+
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
run_time : datetime
|
|
17
|
+
The datetime when the job was scheduled to run. This indicates the time
|
|
18
|
+
the job was supposed to execute before exceeding the instance limit.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
JobMaxInstances
|
|
23
|
+
An instance of the `JobMaxInstances` class containing the event details.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# The time the job was scheduled to run
|
|
27
|
+
run_time: datetime
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
4
|
+
|
|
5
|
+
@dataclass(kw_only=True)
|
|
6
|
+
class JobMissed(JobEventData):
|
|
7
|
+
"""
|
|
8
|
+
Represents an event triggered when a scheduled job run is missed due to scheduler constraints.
|
|
9
|
+
|
|
10
|
+
This class extends `JobEventData` and provides additional information about the missed job event,
|
|
11
|
+
specifically the time the job was originally scheduled to run.
|
|
12
|
+
|
|
13
|
+
Attributes
|
|
14
|
+
----------
|
|
15
|
+
scheduled_run_time : datetime
|
|
16
|
+
The datetime when the job was originally scheduled to execute.
|
|
17
|
+
|
|
18
|
+
Returns
|
|
19
|
+
-------
|
|
20
|
+
None
|
|
21
|
+
This class does not return a value; it is used to encapsulate event data.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
# The datetime when the job was supposed to run but was missed
|
|
25
|
+
scheduled_run_time: datetime
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
3
|
+
|
|
4
|
+
@dataclass(kw_only=True)
|
|
5
|
+
class JobModified(JobEventData):
|
|
6
|
+
"""
|
|
7
|
+
Represents an event triggered when a job is modified in a job store.
|
|
8
|
+
|
|
9
|
+
This class is a data structure that extends `JobEventData` to provide
|
|
10
|
+
additional context or functionality specific to job modification events.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
(Inherited from JobEventData)
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
None
|
|
19
|
+
This class does not return a value; it is used as a data container.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# This class inherits from JobEventData and does not add additional fields or methods.
|
|
23
|
+
# It serves as a specific type of event for job modifications.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from orionis.console.entities.job_event_data import JobEventData
|
|
3
|
+
|
|
4
|
+
@dataclass(kw_only=True)
|
|
5
|
+
class JobPause(JobEventData):
|
|
6
|
+
"""
|
|
7
|
+
Represents an event triggered when a job is paused in the job store.
|
|
8
|
+
|
|
9
|
+
This class extends `JobEventData` to provide additional context or
|
|
10
|
+
functionality specific to the pausing of a job.
|
|
11
|
+
|
|
12
|
+
Attributes
|
|
13
|
+
----------
|
|
14
|
+
(Inherited from JobEventData)
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
JobPause
|
|
19
|
+
An instance of the `JobPause` class representing the pause event.
|
|
20
|
+
"""
|
|
21
|
+
# This class does not define additional attributes or methods.
|
|
22
|
+
# It serves as a specialized event type for job pausing.
|