orionis 0.511.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.
Files changed (39) hide show
  1. orionis/console/base/scheduler_event_listener.py +136 -0
  2. orionis/console/commands/scheduler_work.py +37 -25
  3. orionis/console/contracts/event.py +3032 -9
  4. orionis/console/contracts/schedule.py +34 -0
  5. orionis/console/contracts/schedule_event_listener.py +324 -0
  6. orionis/console/entities/all_jobs_removed.py +23 -0
  7. orionis/console/entities/executor_added.py +23 -0
  8. orionis/console/entities/executor_removed.py +25 -0
  9. orionis/console/entities/job_added.py +24 -0
  10. orionis/console/entities/job_error.py +35 -0
  11. orionis/console/entities/job_event_data.py +40 -0
  12. orionis/console/entities/job_executed.py +31 -0
  13. orionis/console/entities/job_max_instances.py +27 -0
  14. orionis/console/entities/job_missed.py +25 -0
  15. orionis/console/entities/job_modified.py +23 -0
  16. orionis/console/entities/job_pause.py +22 -0
  17. orionis/console/entities/job_removed.py +22 -0
  18. orionis/console/entities/job_resume.py +25 -0
  19. orionis/console/entities/job_store_added.py +24 -0
  20. orionis/console/entities/job_store_removed.py +25 -0
  21. orionis/console/entities/job_submitted.py +24 -0
  22. orionis/console/entities/scheduler_event_data.py +33 -0
  23. orionis/console/entities/scheduler_paused.py +17 -0
  24. orionis/console/entities/scheduler_resumed.py +24 -0
  25. orionis/console/entities/scheduler_shutdown.py +23 -0
  26. orionis/console/entities/scheduler_started.py +21 -0
  27. orionis/console/enums/listener.py +75 -0
  28. orionis/console/tasks/event.py +3703 -21
  29. orionis/console/tasks/schedule.py +702 -48
  30. orionis/metadata/framework.py +1 -1
  31. {orionis-0.511.0.dist-info → orionis-0.512.0.dist-info}/METADATA +1 -1
  32. {orionis-0.511.0.dist-info → orionis-0.512.0.dist-info}/RECORD +36 -15
  33. orionis/console/contracts/listener.py +0 -132
  34. orionis/console/entities/listeners.py +0 -241
  35. orionis/console/tasks/exception_report.py +0 -94
  36. {orionis-0.511.0.dist-info → orionis-0.512.0.dist-info}/WHEEL +0 -0
  37. {orionis-0.511.0.dist-info → orionis-0.512.0.dist-info}/licenses/LICENCE +0 -0
  38. {orionis-0.511.0.dist-info → orionis-0.512.0.dist-info}/top_level.txt +0 -0
  39. {orionis-0.511.0.dist-info → orionis-0.512.0.dist-info}/zip-safe +0 -0
@@ -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 JobRemoved(JobEventData):
6
+ """
7
+ Represents an event triggered when a job is removed from a job store.
8
+
9
+ This class extends `JobEventData` to provide additional context or
10
+ functionality specific to the removal of a job.
11
+
12
+ Attributes
13
+ ----------
14
+ (Inherited from JobEventData)
15
+
16
+ Returns
17
+ -------
18
+ JobRemoved
19
+ An instance of the `JobRemoved` class representing the removal event.
20
+ """
21
+ # No additional attributes or methods are defined here; this class
22
+ # serves as a specialized event type for job removal.
@@ -0,0 +1,25 @@
1
+ from dataclasses import dataclass
2
+ from orionis.console.entities.job_event_data import JobEventData
3
+
4
+ @dataclass(kw_only=True)
5
+ class JobResume(JobEventData):
6
+ """
7
+ Represents an event triggered when a job is resumed from a paused state.
8
+
9
+ This class extends `JobEventData` to provide additional context or
10
+ functionality specific to the resumption of a job.
11
+
12
+ Attributes
13
+ ----------
14
+ (Inherited from JobEventData)
15
+ All attributes from the parent class `JobEventData` are available
16
+ in this class.
17
+
18
+ Returns
19
+ -------
20
+ JobResume
21
+ An instance of the `JobResume` class representing the resumption event.
22
+ """
23
+
24
+ # This class does not define additional attributes or methods.
25
+ # It serves as a specialized event type for job resumption.
@@ -0,0 +1,24 @@
1
+ from dataclasses import dataclass
2
+ from orionis.console.entities.scheduler_event_data import SchedulerEventData
3
+
4
+ @dataclass(kw_only=True)
5
+ class JobstoreAdded(SchedulerEventData):
6
+ """
7
+ Event triggered when a job store is added to the scheduler.
8
+
9
+ This event is used to notify that a new job store has been successfully added to the scheduler.
10
+ It provides the alias of the added job store, which can be used to identify it.
11
+
12
+ Attributes
13
+ ----------
14
+ alias : str
15
+ The alias (name) of the added job store.
16
+
17
+ Returns
18
+ -------
19
+ None
20
+ This class does not return a value; it is used to encapsulate event data.
21
+ """
22
+
23
+ # The alias of the added job store
24
+ 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 JobstoreRemoved(SchedulerEventData):
6
+ """
7
+ Represents an event triggered when a job store is removed.
8
+
9
+ This event is typically used to notify the system or other components
10
+ that a specific job store has been removed, allowing for any necessary
11
+ cleanup or updates.
12
+
13
+ Attributes
14
+ ----------
15
+ alias : str
16
+ The alias (unique identifier) of the removed job store.
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 alias of the removed job store
25
+ alias: str
@@ -0,0 +1,24 @@
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 JobSubmitted(JobEventData):
7
+ """
8
+ Represents an event triggered when a job is submitted to an executor.
9
+
10
+ This class extends `JobEventData` and includes additional information
11
+ about the scheduled execution time of the job.
12
+
13
+ Attributes
14
+ ----------
15
+ run_time : datetime
16
+ The datetime when the job is scheduled to run.
17
+
18
+ Returns
19
+ -------
20
+ None
21
+ This class does not return a value; it is used to encapsulate event data.
22
+ """
23
+ # The datetime when the job is scheduled to run
24
+ run_time: datetime
@@ -0,0 +1,33 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+
4
+ @dataclass(kw_only=True)
5
+ class SchedulerEventData:
6
+ """
7
+ Represents the data associated with scheduler-related events.
8
+
9
+ This class serves as a base structure for encapsulating information about
10
+ events occurring within the scheduler system. It includes a numeric event
11
+ code to identify the type of event and an optional alias for additional
12
+ context.
13
+
14
+ Attributes
15
+ ----------
16
+ code : int
17
+ A numeric code that uniquely identifies the type of event within the
18
+ scheduler system.
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
+
23
+ Returns
24
+ -------
25
+ SchedulerEventData
26
+ An instance of the `SchedulerEventData` class containing the event code
27
+ and optional alias.
28
+ """
29
+ # Numeric code representing the type of event
30
+ code: int
31
+
32
+ # Optional alias for additional context about the event
33
+ alias: Optional[str] = None
@@ -0,0 +1,17 @@
1
+ from dataclasses import dataclass
2
+ from orionis.console.entities.scheduler_event_data import SchedulerEventData
3
+
4
+ @dataclass(kw_only=True)
5
+ class SchedulerPaused(SchedulerEventData):
6
+ """
7
+ Represents an event triggered when the scheduler is paused.
8
+
9
+ This class is a data structure that inherits from `SchedulerEventData`
10
+ and is used to encapsulate information related to the scheduler pause event.
11
+
12
+ Attributes
13
+ ----------
14
+ (Inherited from SchedulerEventData)
15
+ """
16
+ # No additional attributes or methods are defined here, as this class
17
+ # serves as a specialized event marker for when the scheduler is paused.
@@ -0,0 +1,24 @@
1
+ from dataclasses import dataclass
2
+ from orionis.console.entities.scheduler_event_data import SchedulerEventData
3
+
4
+ @dataclass(kw_only=True)
5
+ class SchedulerResumed(SchedulerEventData):
6
+ """
7
+ Represents an event triggered when the scheduler is resumed.
8
+
9
+ This class is a specialized data structure that inherits from
10
+ `SchedulerEventData` and is used to encapsulate information
11
+ about the resumption of the scheduler.
12
+
13
+ Attributes
14
+ ----------
15
+ (Inherited from SchedulerEventData)
16
+
17
+ Returns
18
+ -------
19
+ SchedulerResumed
20
+ An instance of the `SchedulerResumed` class representing
21
+ the resumed scheduler event.
22
+ """
23
+ # No additional fields or methods are defined here, as this class
24
+ # serves as a marker for the resumed scheduler event.
@@ -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 SchedulerShutdown(SchedulerEventData):
6
+ """
7
+ Represents an event triggered when the scheduler shuts down.
8
+
9
+ This class is a specialized type of `SchedulerEventData` that is used to
10
+ encapsulate information related to the shutdown of the scheduler.
11
+
12
+ Attributes
13
+ ----------
14
+ (No additional attributes are defined in this class. It inherits all attributes
15
+ from `SchedulerEventData`.)
16
+
17
+ Returns
18
+ -------
19
+ SchedulerShutdown
20
+ An instance of the `SchedulerShutdown` class representing the shutdown event.
21
+ """
22
+ # This class does not define additional attributes or methods. It serves as a
23
+ # specific type of event data for the scheduler shutdown event.
@@ -0,0 +1,21 @@
1
+ from dataclasses import dataclass
2
+ from orionis.console.entities.scheduler_event_data import SchedulerEventData
3
+
4
+ @dataclass(kw_only=True)
5
+ class SchedulerStarted(SchedulerEventData):
6
+ """
7
+ Represents an event triggered when the scheduler starts running.
8
+
9
+ This class is a data structure that inherits from `SchedulerEventData`
10
+ and is used to encapsulate information about the scheduler's start event.
11
+
12
+ Attributes
13
+ ----------
14
+ (No additional attributes are defined in this class; it inherits all attributes from `SchedulerEventData`.)
15
+
16
+ Returns
17
+ -------
18
+ SchedulerStarted
19
+ An instance of the `SchedulerStarted` class, representing the scheduler start event.
20
+ """
21
+ # This class does not define additional attributes or methods; it serves as a marker for the event.
@@ -0,0 +1,75 @@
1
+ from enum import Enum
2
+
3
+ class ListeningEvent(Enum):
4
+ """
5
+ Enum representing global listener events.
6
+
7
+ Attributes
8
+ ----------
9
+ SCHEDULER_STARTED : str
10
+ Event triggered when the scheduler starts.
11
+ SCHEDULER_SHUTDOWN : str
12
+ Event triggered when the scheduler shuts down.
13
+ SCHEDULER_PAUSED : str
14
+ Event triggered when the scheduler is paused.
15
+ SCHEDULER_RESUMED : str
16
+ Event triggered when the scheduler resumes.
17
+ SCHEDULER_ERROR : str
18
+ Event triggered when the scheduler encounters an error.
19
+ SCHEDULER_STARTED : str
20
+ Event triggered when the scheduler starts.
21
+ SCHEDULER_SHUTDOWN : str
22
+ Event triggered when the scheduler shuts down.
23
+ SCHEDULER_PAUSED : str
24
+ Event triggered when the scheduler is paused.
25
+ SCHEDULER_RESUMED : str
26
+ Event triggered when the scheduler resumes.
27
+ EXECUTOR_ADDED : str
28
+ Event triggered when an executor is added.
29
+ EXECUTOR_REMOVED : str
30
+ Event triggered when an executor is removed.
31
+ JOBSTORE_ADDED : str
32
+ Event triggered when a job store is added.
33
+ JOBSTORE_REMOVED : str
34
+ Event triggered when a job store is removed.
35
+ ALL_JOBS_REMOVED : str
36
+ Event triggered when all jobs are removed.
37
+ JOB_ADDED : str
38
+ Event triggered when a job is added.
39
+ JOB_REMOVED : str
40
+ Event triggered when a job is removed.
41
+ JOB_MODIFIED : str
42
+ Event triggered when a job is modified.
43
+ JOB_EXECUTED : str
44
+ Event triggered when a job is executed.
45
+ JOB_ERROR : str
46
+ Event triggered when a job encounters an error.
47
+ JOB_MISSED : str
48
+ Event triggered when a job is missed.
49
+ JOB_SUBMITTED : str
50
+ Event triggered when a job is submitted.
51
+ JOB_MAX_INSTANCES : str
52
+ Event triggered when a job exceeds max instances.
53
+ ALL : str
54
+ Event triggered for all events.
55
+ """
56
+
57
+ SCHEDULER_STARTED = "X-ORIONIS-EVENT-SCHEDULER-STARTED"
58
+ SCHEDULER_SHUTDOWN = "X-ORIONIS-EVENT-SCHEDULER-SHUTDOWN"
59
+ SCHEDULER_PAUSED = "X-ORIONIS-EVENT-SCHEDULER-PAUSED"
60
+ SCHEDULER_RESUMED = "X-ORIONIS-EVENT-SCHEDULER-RESUMED"
61
+ SCHEDULER_ERROR = "X-ORIONIS-SCHEDULER-ERROR"
62
+ EXECUTOR_ADDED = "X-ORIONIS-EVENT-EXECUTOR-ADDED"
63
+ EXECUTOR_REMOVED = "X-ORIONIS-EVENT-EXECUTOR-REMOVED"
64
+ JOBSTORE_ADDED = "X-ORIONIS-EVENT-JOBSTORE-ADDED"
65
+ JOBSTORE_REMOVED = "X-ORIONIS-EVENT-JOBSTORE-REMOVED"
66
+ ALL_JOBS_REMOVED = "X-ORIONIS-EVENT-ALL-JOBS-REMOVED"
67
+ JOB_ADDED = "X-ORIONIS-EVENT-JOB-ADDED"
68
+ JOB_REMOVED = "X-ORIONIS-EVENT-JOB-REMOVED"
69
+ JOB_MODIFIED = "X-ORIONIS-EVENT-JOB-MODIFIED"
70
+ JOB_EXECUTED = "X-ORIONIS-EVENT-JOB-EXECUTED"
71
+ JOB_ERROR = "X-ORIONIS-EVENT-JOB-ERROR"
72
+ JOB_MISSED = "X-ORIONIS-EVENT-JOB-MISSED"
73
+ JOB_SUBMITTED = "X-ORIONIS-EVENT-JOB-SUBMITTED"
74
+ JOB_MAX_INSTANCES = "X-ORIONIS-EVENT-JOB-MAX-INSTANCES"
75
+ ALL = "X-ORIONIS-EVENT-ALL"