orionis 0.511.0__py3-none-any.whl → 0.513.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 (47) hide show
  1. orionis/console/base/command.py +1 -1
  2. orionis/console/base/scheduler.py +1 -1
  3. orionis/console/base/scheduler_event_listener.py +136 -0
  4. orionis/console/commands/scheduler_work.py +37 -25
  5. orionis/console/contracts/event.py +3032 -9
  6. orionis/console/contracts/schedule.py +34 -0
  7. orionis/console/contracts/schedule_event_listener.py +320 -0
  8. orionis/console/contracts/scheduler.py +140 -0
  9. orionis/console/core/reactor.py +1 -1
  10. orionis/console/entities/all_jobs_removed.py +23 -0
  11. orionis/console/entities/executor_added.py +23 -0
  12. orionis/console/entities/executor_removed.py +25 -0
  13. orionis/console/entities/job_added.py +24 -0
  14. orionis/console/entities/job_error.py +35 -0
  15. orionis/console/entities/job_event_data.py +40 -0
  16. orionis/console/entities/job_executed.py +31 -0
  17. orionis/console/entities/job_max_instances.py +27 -0
  18. orionis/console/entities/job_missed.py +25 -0
  19. orionis/console/entities/job_modified.py +23 -0
  20. orionis/console/entities/job_pause.py +22 -0
  21. orionis/console/entities/job_removed.py +22 -0
  22. orionis/console/entities/job_resume.py +25 -0
  23. orionis/console/entities/job_store_added.py +24 -0
  24. orionis/console/entities/job_store_removed.py +25 -0
  25. orionis/console/entities/job_submitted.py +24 -0
  26. orionis/console/entities/scheduler_event_data.py +33 -0
  27. orionis/console/entities/scheduler_paused.py +17 -0
  28. orionis/console/entities/scheduler_resumed.py +24 -0
  29. orionis/console/entities/scheduler_shutdown.py +23 -0
  30. orionis/console/entities/scheduler_started.py +21 -0
  31. orionis/console/enums/listener.py +75 -0
  32. orionis/console/tasks/event.py +3703 -21
  33. orionis/console/tasks/schedule.py +701 -52
  34. orionis/foundation/application.py +1 -1
  35. orionis/metadata/framework.py +1 -1
  36. {orionis-0.511.0.dist-info → orionis-0.513.0.dist-info}/METADATA +1 -1
  37. {orionis-0.511.0.dist-info → orionis-0.513.0.dist-info}/RECORD +42 -22
  38. orionis/console/base/contracts/__init__.py +0 -0
  39. orionis/console/base/contracts/scheduler.py +0 -38
  40. orionis/console/contracts/listener.py +0 -132
  41. orionis/console/entities/listeners.py +0 -241
  42. orionis/console/tasks/exception_report.py +0 -94
  43. /orionis/console/{base/contracts → contracts}/command.py +0 -0
  44. {orionis-0.511.0.dist-info → orionis-0.513.0.dist-info}/WHEEL +0 -0
  45. {orionis-0.511.0.dist-info → orionis-0.513.0.dist-info}/licenses/LICENCE +0 -0
  46. {orionis-0.511.0.dist-info → orionis-0.513.0.dist-info}/top_level.txt +0 -0
  47. {orionis-0.511.0.dist-info → orionis-0.513.0.dist-info}/zip-safe +0 -0
@@ -5,7 +5,7 @@ from apscheduler.triggers.cron import CronTrigger
5
5
  from apscheduler.triggers.date import DateTrigger
6
6
  from apscheduler.triggers.interval import IntervalTrigger
7
7
  from orionis.console.contracts.event import IEvent
8
- from orionis.console.contracts.listener import IEventListener
8
+ from orionis.console.contracts.schedule_event_listener import IScheduleEventListener
9
9
  from orionis.console.enums.event import Event as EventEntity
10
10
  from orionis.console.exceptions import CLIOrionisValueError
11
11
 
@@ -62,6 +62,12 @@ class Event(IEvent):
62
62
  # Initialize the details for the event as None; can be used to store additional information
63
63
  self.__details: Optional[str] = None
64
64
 
65
+ # Initialize the listener attribute as None; can be set to an IScheduleEventListener instance
66
+ self.__listener: Optional[IScheduleEventListener] = None
67
+
68
+ # Initialize the maximum instances attribute as None
69
+ self.__max_instances: Optional[int] = None
70
+
65
71
  def toEntity(
66
72
  self
67
73
  ) -> EventEntity:
@@ -241,8 +247,8 @@ class Event(IEvent):
241
247
  """
242
248
 
243
249
  # Validate that max_seconds is a positive integer
244
- if not isinstance(max_seconds, int) or max_seconds <= 0:
245
- raise CLIOrionisValueError("max_seconds must be a positive integer.")
250
+ if not isinstance(max_seconds, int) or max_seconds <= 0 or max_seconds > 120:
251
+ raise CLIOrionisValueError("Max seconds must be a positive integer between 1 and 120.")
246
252
 
247
253
  # Generate a random delay between 1 and max_seconds (inclusive)
248
254
  self.__random_delay = random.randint(1, max_seconds)
@@ -250,10 +256,90 @@ class Event(IEvent):
250
256
  # Return self to support method chaining
251
257
  return self
252
258
 
253
- def listener(
259
+ def maxInstances(
260
+ self,
261
+ max_instances: int
262
+ ) -> 'Event':
263
+ """
264
+ Set the maximum number of concurrent instances for the event.
265
+
266
+ This method specifies the maximum number of instances of the event
267
+ that can run concurrently. It is useful for preventing resource
268
+ contention or overloading the system with too many simultaneous
269
+ executions of the same event.
270
+
271
+ Parameters
272
+ ----------
273
+ max_instances : int
274
+ The maximum number of concurrent instances allowed for the event.
275
+ Must be a positive integer.
276
+
277
+ Returns
278
+ -------
279
+ Event
280
+ The current instance of the Event, allowing method chaining.
281
+
282
+ Raises
283
+ ------
284
+ CLIOrionisValueError
285
+ If `max_instances` is not a positive integer.
286
+
287
+ Notes
288
+ -----
289
+ This setting is particularly useful in scenarios where the event
290
+ involves resource-intensive operations, ensuring that the system
291
+ remains stable and responsive.
292
+ """
293
+
294
+ # Validate that max_instances is a positive integer
295
+ if not isinstance(max_instances, int) or max_instances <= 0:
296
+ raise CLIOrionisValueError("Max instances must be a positive integer.")
297
+
298
+ # Set the internal max instances attribute
299
+ self.__max_instances = max_instances
300
+
301
+ # Return self to support method chaining
302
+ return self
303
+
304
+ def subscribeListener(
254
305
  self,
255
- listener: 'IEventListener'
306
+ listener: IScheduleEventListener
256
307
  ) -> 'Event':
308
+ """
309
+ Subscribe a listener to the event.
310
+
311
+ This method allows you to attach a listener that implements the `IScheduleEventListener`
312
+ interface to the event. The listener will be notified when the event is triggered.
313
+
314
+ Parameters
315
+ ----------
316
+ listener : IScheduleEventListener
317
+ An instance of a class that implements the `IScheduleEventListener` interface.
318
+
319
+ Returns
320
+ -------
321
+ Event
322
+ The current instance of the `Event` class, allowing method chaining.
323
+
324
+ Raises
325
+ ------
326
+ CLIOrionisValueError
327
+ If the provided `listener` does not implement the `IScheduleEventListener` interface.
328
+
329
+ Notes
330
+ -----
331
+ The listener is stored internally and will be used to handle event-specific logic
332
+ when the event is executed.
333
+ """
334
+
335
+ # Validate that the provided listener implements the IScheduleEventListener interface
336
+ if not isinstance(listener, IScheduleEventListener):
337
+ raise CLIOrionisValueError("Listener must implement IScheduleEventListener interface.")
338
+
339
+ # Assign the listener to the event's internal listener attribute
340
+ self.__listener = listener
341
+
342
+ # Return the current instance to support method chaining
257
343
  return self
258
344
 
259
345
  def onceAt(
@@ -261,40 +347,48 @@ class Event(IEvent):
261
347
  date: datetime
262
348
  ) -> bool:
263
349
  """
264
- Schedule the event to run once at a specific date and time.
350
+ Schedule the event to execute once at a specific date and time.
265
351
 
266
- This method allows you to schedule the event to execute once at a specified
267
- date and time. The date must be a datetime instance.
352
+ This method configures the event to run a single time at the provided
353
+ `date` and time. The `date` parameter must be a valid `datetime` instance.
354
+ Internally, this sets both the start and end dates to the specified value,
355
+ and uses a `DateTrigger` to ensure the event is triggered only once.
268
356
 
269
357
  Parameters
270
358
  ----------
271
359
  date : datetime
272
- The specific date and time when the event should run.
360
+ The exact date and time at which the event should be executed. Must be a
361
+ valid `datetime` object.
273
362
 
274
363
  Returns
275
364
  -------
276
365
  bool
277
- Returns True if the scheduling was successful.
366
+ Returns True if the scheduling was successfully configured for a single execution.
367
+
368
+ Raises
369
+ ------
370
+ CLIOrionisValueError
371
+ If `date` is not a valid `datetime` instance.
278
372
  """
279
373
 
280
- # Validate that date is a datetime instance
374
+ # Validate that the provided date is a datetime instance
281
375
  if not isinstance(date, datetime):
282
376
  raise CLIOrionisValueError("The date must be a datetime instance.")
283
377
 
284
- # Set the start and end dates to the specified date
378
+ # Set both start and end dates to the specified date for a one-time execution
285
379
  self.__start_date = date
286
380
  self.__end_date = date
287
381
 
288
- # Set the trigger to a DateTrigger for the specified date
382
+ # Use a DateTrigger to schedule the event to run once at the specified date and time
289
383
  self.__trigger = DateTrigger(run_date=date)
290
384
 
291
- # Optionally, set the details for the event
385
+ # Optionally, store a human-readable description of the scheduled execution
292
386
  self.__details = f"Once At: {date.strftime('%Y-%m-%d %H:%M:%S')}"
293
387
 
294
- # Return self to support method chaining
388
+ # Indicate that the scheduling was successful
295
389
  return True
296
390
 
297
- def everySeconds(
391
+ def everySecond(
298
392
  self,
299
393
  seconds: int
300
394
  ) -> bool:
@@ -302,9 +396,9 @@ class Event(IEvent):
302
396
  Schedule the event to run at fixed intervals measured in seconds.
303
397
 
304
398
  This method configures the event to execute repeatedly at a specified interval
305
- (in seconds). Optionally, the event can be restricted to a time window using
306
- previously set start and end dates. A random delay (jitter) can also be applied
307
- if configured.
399
+ (in seconds). The event can optionally be restricted to a time window using
400
+ previously set `start_date` and `end_date`. If a random delay (jitter) has been
401
+ configured, it can be applied to the trigger.
308
402
 
309
403
  Parameters
310
404
  ----------
@@ -320,20 +414,3608 @@ class Event(IEvent):
320
414
  ------
321
415
  CLIOrionisValueError
322
416
  If `seconds` is not a positive integer.
323
- """
324
417
 
418
+ Notes
419
+ -----
420
+ The event will be triggered every `seconds` seconds, starting from the configured
421
+ `start_date` (if set) and ending at `end_date` (if set).
422
+ """
325
423
  # Validate that the seconds parameter is a positive integer.
326
424
  if not isinstance(seconds, int) or seconds <= 0:
327
425
  raise CLIOrionisValueError("The interval must be a positive integer.")
328
426
 
329
427
  # Configure the trigger to execute the event at the specified interval,
330
- # using any previously set start_date, end_date, and random_delay (jitter).
428
+ # using any previously set start_date and end_date.
331
429
  self.__trigger = IntervalTrigger(
332
430
  seconds=seconds,
333
431
  start_date=self.__start_date,
432
+ end_date=self.__end_date
433
+ )
434
+
435
+ # Store a human-readable description of the schedule.
436
+ self.__details = f"Every {seconds} seconds"
437
+
438
+ # Indicate that the scheduling was successful.
439
+ return True
440
+
441
+ def everyFiveSeconds(
442
+ self
443
+ ) -> bool:
444
+ """
445
+ Schedule the event to run every five seconds.
446
+
447
+ This method configures the event to execute at a fixed interval of five seconds using an
448
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
449
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
450
+ it will be applied to the trigger to help distribute load or avoid collisions.
451
+
452
+ Returns
453
+ -------
454
+ bool
455
+ Returns True after successfully configuring the interval trigger for execution every
456
+ five seconds.
457
+
458
+ Notes
459
+ -----
460
+ The event will be triggered at 0, 5, 10, 15, ..., 55 seconds of each minute, within the optional
461
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
462
+ it will be applied to the trigger.
463
+ """
464
+
465
+ # Delegate scheduling to the everySecond method with an interval of 5 seconds.
466
+ return self.everySecond(5)
467
+
468
+ def everyTenSeconds(
469
+ self
470
+ ) -> bool:
471
+ """
472
+ Schedule the event to run every ten seconds.
473
+
474
+ This method configures the event to execute at a fixed interval of ten seconds using an
475
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
476
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
477
+ it will be applied to the trigger to help distribute load or avoid collisions.
478
+
479
+ Returns
480
+ -------
481
+ bool
482
+ Returns True after successfully configuring the interval trigger for execution every
483
+ ten seconds.
484
+
485
+ Notes
486
+ -----
487
+ The event will be triggered at 0, 10, 20, 30, 40, and 50 seconds of each minute, within the optional
488
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
489
+ it will be applied to the trigger.
490
+ """
491
+
492
+ # Delegate scheduling to the everySecond method with an interval of 10 seconds.
493
+ return self.everySecond(10)
494
+
495
+ def everyFifteenSeconds(
496
+ self
497
+ ) -> bool:
498
+ """
499
+ Schedule the event to run every fifteen seconds.
500
+
501
+ This method configures the event to execute at a fixed interval of fifteen seconds using an
502
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
503
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
504
+ it will be applied to the trigger to help distribute load or avoid collisions.
505
+
506
+ Returns
507
+ -------
508
+ bool
509
+ Returns True after successfully configuring the interval trigger for execution every
510
+ fifteen seconds.
511
+
512
+ Notes
513
+ -----
514
+ The event will be triggered at 0, 15, 30, and 45 seconds of each minute, within the optional
515
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
516
+ it will be applied to the trigger.
517
+ """
518
+
519
+ # Delegate scheduling to the everySecond method with an interval of 15 seconds.
520
+ return self.everySecond(15)
521
+
522
+ def everyTwentySeconds(
523
+ self
524
+ ) -> bool:
525
+ """
526
+ Schedule the event to run every twenty seconds.
527
+
528
+ This method configures the event to execute at a fixed interval of twenty seconds using an
529
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
530
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
531
+ it will be applied to the trigger to help distribute load or avoid collisions.
532
+
533
+ Returns
534
+ -------
535
+ bool
536
+ Returns True after successfully configuring the interval trigger for execution every
537
+ twenty seconds. The event will be triggered at 0, 20, and 40 seconds of each minute,
538
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
539
+ random delay (jitter) is set, it will be applied to the trigger.
540
+ """
541
+
542
+ # Delegate scheduling to the everySecond method with an interval of 20 seconds.
543
+ return self.everySecond(20)
544
+
545
+ def everyTwentyFiveSeconds(
546
+ self
547
+ ) -> bool:
548
+ """
549
+ Schedule the event to run every twenty-five seconds.
550
+
551
+ This method configures the event to execute at a fixed interval of twenty-five seconds using an
552
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
553
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
554
+ it will be applied to the trigger to help distribute load or avoid collisions.
555
+
556
+ Returns
557
+ -------
558
+ bool
559
+ Returns True after successfully configuring the interval trigger for execution every
560
+ twenty-five seconds. The event will be triggered at 0, 25, and 50 seconds of each minute,
561
+ within the optional scheduling window defined by `start_date` and `end_date`. If a random
562
+ delay (jitter) is set, it will be applied to the trigger.
563
+
564
+ Notes
565
+ -----
566
+ The event will be triggered at 0, 25, and 50 seconds of each minute.
567
+ """
568
+
569
+ # Delegate scheduling to the everySecond method with an interval of 25 seconds.
570
+ return self.everySecond(25)
571
+
572
+ def everyThirtySeconds(
573
+ self
574
+ ) -> bool:
575
+ """
576
+ Schedule the event to run every thirty seconds.
577
+
578
+ This method configures the event to execute at a fixed interval of thirty seconds using an
579
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
580
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
581
+ it will be applied to the trigger to help distribute load or avoid collisions.
582
+
583
+ Returns
584
+ -------
585
+ bool
586
+ Returns True after successfully configuring the interval trigger for execution every
587
+ thirty seconds.
588
+
589
+ Notes
590
+ -----
591
+ The event will be triggered at 0 and 30 seconds of each minute, within the optional
592
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
593
+ is set, it will be applied to the trigger.
594
+ """
595
+
596
+ # Delegate scheduling to the everySecond method with an interval of 30 seconds.
597
+ return self.everySecond(30)
598
+
599
+ def everyThirtyFiveSeconds(
600
+ self
601
+ ) -> bool:
602
+ """
603
+ Schedule the event to run every thirty-five seconds.
604
+
605
+ This method configures the event to execute at a fixed interval of thirty-five seconds using an
606
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
607
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
608
+ it will be applied to the trigger to help distribute load or avoid collisions.
609
+
610
+ Returns
611
+ -------
612
+ bool
613
+ Returns True after successfully configuring the interval trigger for execution every
614
+ thirty-five seconds. The event will be triggered at 0 and 35 seconds of each minute,
615
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
616
+ random delay (jitter) is set, it will be applied to the trigger.
617
+ """
618
+
619
+ # Delegate scheduling to the everySecond method with an interval of 35 seconds.
620
+ return self.everySecond(35)
621
+
622
+ def everyFortySeconds(
623
+ self
624
+ ) -> bool:
625
+ """
626
+ Schedule the event to run every forty seconds.
627
+
628
+ This method configures the event to execute at a fixed interval of forty seconds using an
629
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
630
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
631
+ it will be applied to the trigger to help distribute load or avoid collisions.
632
+
633
+ Returns
634
+ -------
635
+ bool
636
+ Returns True after successfully configuring the interval trigger for execution every
637
+ forty seconds. The event will be triggered at 0 and 40 seconds of each minute, within the
638
+ optional scheduling window defined by `start_date` and `end_date`. If a random delay
639
+ (jitter) is set, it will be applied to the trigger.
640
+
641
+ Notes
642
+ -----
643
+ The event will be triggered at 0 and 40 seconds of each minute.
644
+ """
645
+
646
+ # Delegate scheduling to the everySecond method with an interval of 40 seconds.
647
+ return self.everySecond(40)
648
+
649
+ def everyFortyFiveSeconds(
650
+ self
651
+ ) -> bool:
652
+ """
653
+ Schedule the event to run every forty-five seconds.
654
+
655
+ This method configures the event to execute at a fixed interval of forty-five seconds using an
656
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
657
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
658
+ it will be applied to the trigger to help distribute load or avoid collisions.
659
+
660
+ Returns
661
+ -------
662
+ bool
663
+ Returns True after successfully configuring the interval trigger for execution every
664
+ forty-five seconds. The event will be triggered at 0 and 45 seconds of each minute,
665
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
666
+ random delay (jitter) is set, it will be applied to the trigger.
667
+
668
+ Notes
669
+ -----
670
+ The event will be triggered at 0 and 45 seconds of each minute.
671
+ """
672
+
673
+ # Delegate scheduling to the everySecond method with an interval of 45 seconds.
674
+ return self.everySecond(45)
675
+
676
+ def everyFiftySeconds(
677
+ self
678
+ ) -> bool:
679
+ """
680
+ Schedule the event to run every fifty seconds.
681
+
682
+ This method configures the event to execute at a fixed interval of fifty seconds using an
683
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
684
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
685
+ it will be applied to the trigger to help distribute load or avoid collisions.
686
+
687
+ Returns
688
+ -------
689
+ bool
690
+ Returns True after successfully configuring the interval trigger for execution every
691
+ fifty seconds. The event will be triggered at 0 and 50 seconds of each minute, within the
692
+ optional scheduling window defined by `start_date` and `end_date`. If a random delay
693
+ (jitter) is set, it will be applied to the trigger.
694
+
695
+ Notes
696
+ -----
697
+ The event will be triggered at 0 and 50 seconds of each minute.
698
+ """
699
+
700
+ # Delegate scheduling to the everySecond method with an interval of 50 seconds.
701
+ return self.everySecond(50)
702
+
703
+ def everyFiftyFiveSeconds(
704
+ self
705
+ ) -> bool:
706
+ """
707
+ Schedule the event to run every fifty-five seconds.
708
+
709
+ This method configures the event to execute at a fixed interval of fifty-five seconds using an
710
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
711
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
712
+ it will be applied to the trigger to help distribute load or avoid collisions.
713
+
714
+ Returns
715
+ -------
716
+ bool
717
+ Returns True after successfully configuring the interval trigger for execution every
718
+ fifty-five seconds. The event will be triggered at 0 and 55 seconds of each minute,
719
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
720
+ random delay (jitter) is set, it will be applied to the trigger.
721
+ """
722
+
723
+ # Delegate scheduling to the everySecond method with an interval of 55 seconds.
724
+ return self.everySecond(55)
725
+
726
+ def everyMinute(
727
+ self,
728
+ minutes: int
729
+ ) -> bool:
730
+ """
731
+ Schedule the event to run at fixed intervals measured in minutes.
732
+
733
+ This method configures the event to execute repeatedly at a specified interval
734
+ (in minutes). The interval must be a positive integer. Optionally, the event can be
735
+ restricted to a time window using previously set `start_date` and `end_date`. If a
736
+ random delay (jitter) has been configured, it will be applied to the trigger.
737
+
738
+ Parameters
739
+ ----------
740
+ minutes : int
741
+ The interval, in minutes, at which the event should be executed. Must be a positive integer.
742
+
743
+ Returns
744
+ -------
745
+ bool
746
+ Returns True if the interval scheduling was successfully configured. If the input
747
+ is invalid, a `CLIOrionisValueError` is raised and the trigger is not set.
748
+
749
+ Raises
750
+ ------
751
+ CLIOrionisValueError
752
+ If `minutes` is not a positive integer.
753
+
754
+ Notes
755
+ -----
756
+ The event will be triggered every `minutes` minutes, starting from the configured
757
+ `start_date` (if set) and ending at `end_date` (if set). If a random delay (jitter)
758
+ is set, it will be applied to the trigger.
759
+ """
760
+
761
+ # Validate that the minutes parameter is a positive integer.
762
+ if not isinstance(minutes, int) or minutes <= 0:
763
+ raise CLIOrionisValueError("The interval must be a positive integer.")
764
+
765
+ # Configure the trigger to execute the event at the specified interval,
766
+ # using any previously set start_date, end_date, and random_delay (jitter).
767
+ self.__trigger = IntervalTrigger(
768
+ minutes=minutes,
769
+ start_date=self.__start_date,
334
770
  end_date=self.__end_date,
335
771
  jitter=self.__random_delay
336
772
  )
337
773
 
774
+ # Store a human-readable description of the schedule.
775
+ self.__details = f"Every {minutes} minutes"
776
+
777
+ # Indicate that the scheduling was successful.
778
+ return True
779
+
780
+ def everyMinuteAt(
781
+ self,
782
+ seconds: int
783
+ ) -> bool:
784
+ """
785
+ Schedule the event to run every minute at a specific second, without applying jitter.
786
+
787
+ This method configures the event to execute at the specified second (0-59) of every minute.
788
+ Any previously configured random delay (jitter) will be ignored for this schedule.
789
+
790
+ Parameters
791
+ ----------
792
+ seconds : int
793
+ The specific second (0-59) of each minute at which the event should be executed.
794
+
795
+ Returns
796
+ -------
797
+ bool
798
+ Returns True if the scheduling was successfully configured.
799
+
800
+ Raises
801
+ ------
802
+ CLIOrionisValueError
803
+ If `seconds` is not an integer between 0 and 59 (inclusive).
804
+
805
+ Notes
806
+ -----
807
+ The event will be triggered at the specified second of every minute, with no jitter applied.
808
+ """
809
+
810
+ # Validate that the 'seconds' parameter is an integer between 0 and 59.
811
+ if not isinstance(seconds, int) or not (0 <= seconds <= 59):
812
+ raise CLIOrionisValueError("Seconds must be an integer between 0 and 59.")
813
+
814
+ # Configure the trigger to execute the event every minute at the specified second,
815
+ # explicitly disabling jitter regardless of previous configuration.
816
+ self.__trigger = CronTrigger(
817
+ minute="*",
818
+ second=seconds,
819
+ start_date=self.__start_date,
820
+ end_date=self.__end_date
821
+ )
822
+
823
+ # Store a human-readable description of the schedule.
824
+ self.__details = f"Every minute at {seconds} seconds"
825
+
338
826
  # Indicate that the scheduling was successful.
827
+ return True
828
+
829
+ def everyMinutesAt(
830
+ self,
831
+ minutes: int,
832
+ seconds: int
833
+ ) -> bool:
834
+ """
835
+ Schedule the event to run at a specific second of every given interval in minutes.
836
+
837
+ This method configures the event to execute at the specified second (0-59) of every
838
+ `minutes` interval. The scheduling window can be further restricted by previously set
839
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
840
+ it will be applied to the trigger to help distribute load or avoid collisions.
841
+
842
+ Parameters
843
+ ----------
844
+ minutes : int
845
+ The interval, in minutes, at which the event should be executed. Must be a positive integer.
846
+ seconds : int
847
+ The specific second (0-59) of each interval at which the event should be executed.
848
+
849
+ Returns
850
+ -------
851
+ bool
852
+ Returns True if the scheduling was successfully configured. If the input is invalid,
853
+ a `CLIOrionisValueError` is raised and the trigger is not set.
854
+
855
+ Raises
856
+ ------
857
+ CLIOrionisValueError
858
+ If `minutes` is not a positive integer or `seconds` is not an integer between 0 and 59.
859
+
860
+ Notes
861
+ -----
862
+ The event will be triggered at the specified second of every `minutes` interval, within the optional
863
+ scheduling window defined by `start_date` and `end_date`.
864
+ """
865
+
866
+ # Validate that 'minutes' is a positive integer.
867
+ if not isinstance(minutes, int) or minutes <= 0:
868
+ raise CLIOrionisValueError("Minutes must be a positive integer.")
869
+
870
+ # Validate that 'seconds' is an integer between 0 and 59.
871
+ if not isinstance(seconds, int) or not (0 <= seconds <= 59):
872
+ raise CLIOrionisValueError("Seconds must be an integer between 0 and 59.")
873
+
874
+ # Configure the trigger to execute the event every 'minutes' minutes at the specified 'seconds'
875
+ self.__trigger = CronTrigger(
876
+ minute=f"*/{minutes}",
877
+ second=seconds,
878
+ start_date=self.__start_date,
879
+ end_date=self.__end_date
880
+ )
881
+
882
+ # Store a human-readable description of the schedule.
883
+ self.__details = f"Every {minutes} minutes at {seconds} seconds"
884
+
885
+ # Indicate that the scheduling was successful.
886
+ return True
887
+
888
+ def everyFiveMinutes(
889
+ self
890
+ ) -> bool:
891
+ """
892
+ Schedule the event to run every five minutes.
893
+
894
+ This method configures the event to execute at a fixed interval of five minutes using an
895
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
896
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
897
+ it will be applied to the trigger to help distribute load or avoid collisions.
898
+
899
+ Returns
900
+ -------
901
+ bool
902
+ Returns True after successfully configuring the interval trigger for execution every
903
+ five minutes. The method always returns True after setting up the interval trigger.
904
+
905
+ Notes
906
+ -----
907
+ The event will be triggered at 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, and 55 minutes
908
+ of each hour, within the optional scheduling window defined by `start_date` and `end_date`.
909
+ If a random delay (jitter) is set, it will be applied to the trigger.
910
+ """
911
+
912
+ # Delegate scheduling to the everyMinute method with an interval of 5 minutes.
913
+ return self.everyMinute(5)
914
+
915
+ def everyFiveMinutesAt(
916
+ self,
917
+ seconds: int
918
+ ) -> bool:
919
+ """
920
+ Schedule the event to run every five minutes at a specific second.
921
+
922
+ This method configures the event to execute at the specified second (0-59) of every five-minute interval.
923
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
924
+ If a random delay (jitter) has been configured, it will be applied to the trigger to help distribute load
925
+ or avoid collisions.
926
+
927
+ Parameters
928
+ ----------
929
+ seconds : int
930
+ The specific second (0-59) of each five-minute interval at which the event should be executed.
931
+
932
+ Returns
933
+ -------
934
+ bool
935
+ Returns True if the scheduling was successfully configured. If the input is invalid,
936
+ a `CLIOrionisValueError` is raised and the trigger is not set.
937
+
938
+ Raises
939
+ ------
940
+ CLIOrionisValueError
941
+ If `seconds` is not an integer between 0 and 59 (inclusive).
942
+
943
+ Notes
944
+ -----
945
+ The event will be triggered at the specified second of every five-minute interval, within the optional
946
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
947
+ it will be applied to the trigger.
948
+ """
949
+
950
+ # Delegate scheduling to the everyMinutesAt method with an interval of 5 minutes and the specified second.
951
+ return self.everyMinutesAt(5, seconds)
952
+
953
+ def everyTenMinutes(
954
+ self
955
+ ) -> bool:
956
+ """
957
+ Schedule the event to run every ten minutes.
958
+
959
+ This method configures the event to execute at a fixed interval of ten minutes using an
960
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
961
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
962
+ it will be applied to the trigger to help distribute load or avoid collisions.
963
+
964
+ Returns
965
+ -------
966
+ bool
967
+ Returns True after successfully configuring the interval trigger for execution every
968
+ ten minutes. The event will be triggered at 0, 10, 20, 30, 40, and 50 minutes of each hour,
969
+ within the optional scheduling window defined by `start_date` and `end_date`. If a random
970
+ delay (jitter) is set, it will be applied to the trigger.
971
+
972
+ Notes
973
+ -----
974
+ The event will be triggered at every ten-minute interval within each hour.
975
+ """
976
+
977
+ # Delegate scheduling to the everyMinute method with an interval of 10 minutes.
978
+ return self.everyMinute(10)
979
+
980
+ def everyTenMinutesAt(
981
+ self,
982
+ seconds: int
983
+ ) -> bool:
984
+ """
985
+ Schedule the event to run every ten minutes at a specific second.
986
+
987
+ This method configures the event to execute at the specified second (0-59) of every ten-minute interval.
988
+ Any previously configured random delay (jitter) will be ignored for this schedule. The scheduling window
989
+ can be further restricted by previously set `start_date` and `end_date` attributes.
990
+
991
+ Parameters
992
+ ----------
993
+ seconds : int
994
+ The specific second (0-59) of each ten-minute interval at which the event should be executed.
995
+
996
+ Returns
997
+ -------
998
+ bool
999
+ Returns True if the scheduling was successfully configured. If the input is invalid,
1000
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1001
+
1002
+ Raises
1003
+ ------
1004
+ CLIOrionisValueError
1005
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1006
+
1007
+ Notes
1008
+ -----
1009
+ The event will be triggered at the specified second of every ten-minute interval, with no jitter applied.
1010
+ The schedule respects any configured `start_date` and `end_date`.
1011
+ """
1012
+
1013
+ # Delegate scheduling to the everyMinutesAt method with an interval of 10 minutes and the specified second.
1014
+ return self.everyMinutesAt(10, seconds)
1015
+
1016
+ def everyFifteenMinutes(
1017
+ self
1018
+ ) -> bool:
1019
+ """
1020
+ Schedule the event to run every fifteen minutes.
1021
+
1022
+ This method configures the event to execute at a fixed interval of fifteen minutes using an
1023
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1024
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1025
+ it will be applied to the trigger to help distribute load or avoid collisions.
1026
+
1027
+ Returns
1028
+ -------
1029
+ bool
1030
+ Returns True after successfully configuring the interval trigger for execution every
1031
+ fifteen minutes. The event will be triggered at 0, 15, 30, and 45 minutes of each hour,
1032
+ within the optional scheduling window defined by `start_date` and `end_date`. If a random
1033
+ delay (jitter) is set, it will be applied to the trigger.
1034
+
1035
+ Notes
1036
+ -----
1037
+ The event will be triggered at every fifteen-minute interval within each hour.
1038
+ """
1039
+
1040
+ # Delegate scheduling to the everyMinute method with an interval of 15 minutes.
1041
+ return self.everyMinute(15)
1042
+
1043
+ def everyFifteenMinutesAt(
1044
+ self,
1045
+ seconds: int
1046
+ ) -> bool:
1047
+ """
1048
+ Schedule the event to run every fifteen minutes at a specific second.
1049
+
1050
+ This method configures the event to execute at the specified second (0-59) of every fifteen-minute interval.
1051
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
1052
+ If a random delay (jitter) has been configured, it will be applied to the trigger to help distribute load
1053
+ or avoid collisions.
1054
+
1055
+ Parameters
1056
+ ----------
1057
+ seconds : int
1058
+ The specific second (0-59) of each fifteen-minute interval at which the event should be executed.
1059
+
1060
+ Returns
1061
+ -------
1062
+ bool
1063
+ Returns True if the scheduling was successfully configured. If the input is invalid,
1064
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1065
+
1066
+ Raises
1067
+ ------
1068
+ CLIOrionisValueError
1069
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1070
+
1071
+ Notes
1072
+ -----
1073
+ The event will be triggered at the specified second of every fifteen-minute interval, within the optional
1074
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
1075
+ it will be applied to the trigger.
1076
+ """
1077
+
1078
+ # Delegate scheduling to the everyMinutesAt method with an interval of 15 minutes and the specified second.
1079
+ return self.everyMinutesAt(15, seconds)
1080
+
1081
+ def everyTwentyMinutes(
1082
+ self
1083
+ ) -> bool:
1084
+ """
1085
+ Schedule the event to run every twenty minutes.
1086
+
1087
+ This method configures the event to execute at a fixed interval of twenty minutes using an
1088
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1089
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1090
+ it will be applied to the trigger to help distribute load or avoid collisions.
1091
+
1092
+ Returns
1093
+ -------
1094
+ bool
1095
+ Returns True after successfully configuring the interval trigger for execution every
1096
+ twenty minutes. The event will be triggered at 0, 20, and 40 minutes of each hour,
1097
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
1098
+ random delay (jitter) is set, it will be applied to the trigger.
1099
+
1100
+ Notes
1101
+ -----
1102
+ The event will be triggered at 0, 20, and 40 minutes of each hour.
1103
+ """
1104
+
1105
+ # Delegate scheduling to the everyMinute method with an interval of 20 minutes.
1106
+ return self.everyMinute(20)
1107
+
1108
+ def everyTwentyMinutesAt(
1109
+ self,
1110
+ seconds: int
1111
+ ) -> bool:
1112
+ """
1113
+ Schedule the event to run every twenty minutes at a specific second.
1114
+
1115
+ This method configures the event to execute at the specified second (0-59) of every twenty-minute interval.
1116
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
1117
+ If a random delay (jitter) has been configured, it will be applied to the trigger to help distribute load
1118
+ or avoid collisions.
1119
+
1120
+ Parameters
1121
+ ----------
1122
+ seconds : int
1123
+ The specific second (0-59) of each twenty-minute interval at which the event should be executed.
1124
+
1125
+ Returns
1126
+ -------
1127
+ bool
1128
+ Returns True if the scheduling was successfully configured. If the input is invalid,
1129
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1130
+
1131
+ Raises
1132
+ ------
1133
+ CLIOrionisValueError
1134
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1135
+
1136
+ Notes
1137
+ -----
1138
+ The event will be triggered at the specified second of every twenty-minute interval, within the optional
1139
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
1140
+ it will be applied to the trigger.
1141
+ """
1142
+
1143
+ # Delegate scheduling to the everyMinutesAt method with an interval of 20 minutes and the specified second.
1144
+ return self.everyMinutesAt(20, seconds)
1145
+
1146
+ def everyTwentyFiveMinutes(
1147
+ self
1148
+ ) -> bool:
1149
+ """
1150
+ Schedule the event to run every twenty-five minutes.
1151
+
1152
+ This method configures the event to execute at a fixed interval of twenty-five minutes using an
1153
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1154
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1155
+ it will be applied to the trigger to help distribute load or avoid collisions.
1156
+
1157
+ Returns
1158
+ -------
1159
+ bool
1160
+ Returns True after successfully configuring the interval trigger for execution every
1161
+ twenty-five minutes. The event will be triggered at 0, 25, and 50 minutes of each hour,
1162
+ within the optional scheduling window defined by `start_date` and `end_date`. If a random
1163
+ delay (jitter) is set, it will be applied to the trigger.
1164
+ """
1165
+
1166
+ # Delegate scheduling to the everyMinute method with an interval of 25 minutes.
1167
+ return self.everyMinute(25)
1168
+
1169
+ def everyTwentyFiveMinutesAt(
1170
+ self,
1171
+ seconds: int
1172
+ ) -> bool:
1173
+ """
1174
+ Schedule the event to run every twenty-five minutes at a specific second.
1175
+
1176
+ This method sets up the event to execute at the specified second (0-59) of every twenty-five-minute interval.
1177
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
1178
+ If a random delay (jitter) has been configured, it will be applied to the trigger.
1179
+
1180
+ Parameters
1181
+ ----------
1182
+ seconds : int
1183
+ The specific second (0-59) of each twenty-five-minute interval at which the event should be executed.
1184
+
1185
+ Returns
1186
+ -------
1187
+ bool
1188
+ Returns True if the scheduling was successfully configured. If the input is invalid,
1189
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1190
+
1191
+ Raises
1192
+ ------
1193
+ CLIOrionisValueError
1194
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1195
+
1196
+ Notes
1197
+ -----
1198
+ The event will be triggered at the specified second of every twenty-five-minute interval,
1199
+ within the optional scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
1200
+ is set, it will be applied to the trigger.
1201
+ """
1202
+
1203
+ # Delegate scheduling to the everyMinutesAt method with an interval of 25 minutes and the specified second.
1204
+ return self.everyMinutesAt(25, seconds)
1205
+
1206
+ def everyThirtyMinutes(
1207
+ self
1208
+ ) -> bool:
1209
+ """
1210
+ Schedule the event to run every thirty minutes.
1211
+
1212
+ This method configures the event to execute at a fixed interval of thirty minutes using an
1213
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1214
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1215
+ it will be applied to the trigger to help distribute load or avoid collisions.
1216
+
1217
+ Returns
1218
+ -------
1219
+ bool
1220
+ Returns True after successfully configuring the interval trigger for execution every
1221
+ thirty minutes. The event will be triggered at 0 and 30 minutes of each hour, within the
1222
+ optional scheduling window defined by `start_date` and `end_date`. If a random delay
1223
+ (jitter) is set, it will be applied to the trigger.
1224
+
1225
+ Notes
1226
+ -----
1227
+ The event will be triggered at 0 and 30 minutes of each hour.
1228
+ """
1229
+
1230
+ # Delegate scheduling to the everyMinute method with an interval of 30 minutes.
1231
+ # This ensures consistent handling of start_date, end_date, and random_delay (jitter).
1232
+ return self.everyMinute(30)
1233
+
1234
+ def everyThirtyMinutesAt(
1235
+ self,
1236
+ seconds: int
1237
+ ) -> bool:
1238
+ """
1239
+ Schedule the event to run every thirty minutes at a specific second.
1240
+
1241
+ This method configures the event to execute at the specified second (0-59) of every thirty-minute interval.
1242
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
1243
+ If a random delay (jitter) has been configured, it will be applied to the trigger to help distribute load
1244
+ or avoid collisions.
1245
+
1246
+ Parameters
1247
+ ----------
1248
+ seconds : int
1249
+ The specific second (0-59) of each thirty-minute interval at which the event should be executed.
1250
+
1251
+ Returns
1252
+ -------
1253
+ bool
1254
+ Returns True if the scheduling was successfully configured. If the input is invalid,
1255
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1256
+
1257
+ Raises
1258
+ ------
1259
+ CLIOrionisValueError
1260
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1261
+
1262
+ Notes
1263
+ -----
1264
+ The event will be triggered at the specified second of every thirty-minute interval, within the optional
1265
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
1266
+ it will be applied to the trigger.
1267
+ """
1268
+
1269
+ # Delegate scheduling to the everyMinutesAt method with an interval of 30 minutes and the specified second.
1270
+ return self.everyMinutesAt(30, seconds)
1271
+
1272
+ def everyThirtyFiveMinutes(
1273
+ self
1274
+ ) -> bool:
1275
+ """
1276
+ Schedule the event to run every thirty-five minutes.
1277
+
1278
+ This method configures the event to execute at a fixed interval of thirty-five minutes using an
1279
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1280
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1281
+ it will be applied to the trigger to help distribute load or avoid collisions.
1282
+
1283
+ Returns
1284
+ -------
1285
+ bool
1286
+ Returns True after successfully configuring the interval trigger for execution every
1287
+ thirty-five minutes. The event will be triggered at 0 and 35 minutes of each hour,
1288
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
1289
+ random delay (jitter) is set, it will be applied to the trigger.
1290
+
1291
+ Notes
1292
+ -----
1293
+ The event will be triggered at 0 and 35 minutes of each hour.
1294
+ """
1295
+
1296
+ # Delegate scheduling to the everyMinute method with an interval of 35 minutes.
1297
+ # This ensures consistent handling of start_date, end_date, and random_delay (jitter).
1298
+ return self.everyMinute(35)
1299
+
1300
+ def everyThirtyFiveMinutesAt(
1301
+ self,
1302
+ seconds: int
1303
+ ) -> bool:
1304
+ """
1305
+ Schedule the event to run every 35 minutes at a specific second.
1306
+
1307
+ This method configures the event to execute at the specified second (0-59) of every 35-minute interval.
1308
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
1309
+ If a random delay (jitter) has been configured, it will be applied to the trigger to help distribute load
1310
+ or avoid collisions.
1311
+
1312
+ Parameters
1313
+ ----------
1314
+ seconds : int
1315
+ The specific second (0-59) of each 35-minute interval at which the event should be executed.
1316
+
1317
+ Returns
1318
+ -------
1319
+ bool
1320
+ True if the scheduling was successfully configured. If the input is invalid, a `CLIOrionisValueError`
1321
+ is raised and the trigger is not set.
1322
+
1323
+ Raises
1324
+ ------
1325
+ CLIOrionisValueError
1326
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1327
+
1328
+ Notes
1329
+ -----
1330
+ The event will be triggered at the specified second of every 35-minute interval, within the optional
1331
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
1332
+ it will be applied to the trigger.
1333
+ """
1334
+
1335
+ # Delegate scheduling to the everyMinutesAt method with an interval of 35 minutes
1336
+ # and the specified second.
1337
+ return self.everyMinutesAt(35, seconds)
1338
+
1339
+ def everyFortyMinutes(
1340
+ self
1341
+ ) -> bool:
1342
+ """
1343
+ Schedule the event to run every forty minutes.
1344
+
1345
+ This method configures the event to execute at a fixed interval of forty minutes using an
1346
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1347
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1348
+ it will be applied to the trigger to help distribute load or avoid collisions.
1349
+
1350
+ Returns
1351
+ -------
1352
+ bool
1353
+ Returns True after successfully configuring the interval trigger for execution every
1354
+ forty minutes. The event will be triggered at 0, 40 minutes of each hour, within the
1355
+ optional scheduling window defined by `start_date` and `end_date`. If a random delay
1356
+ (jitter) is set, it will be applied to the trigger.
1357
+
1358
+ Notes
1359
+ -----
1360
+ The event will be triggered at 0 and 40 minutes of each hour.
1361
+ """
1362
+
1363
+ # Delegate scheduling to the everyMinute method with an interval of 40 minutes.
1364
+ # This ensures consistent handling of start_date, end_date, and random_delay (jitter).
1365
+ return self.everyMinute(40)
1366
+
1367
+ def everyFortyMinutesAt(
1368
+ self,
1369
+ seconds: int
1370
+ ) -> bool:
1371
+ """
1372
+ Schedule the event to run every forty minutes at a specific second.
1373
+
1374
+ This method configures the event to execute at the specified second (0-59) of every forty-minute interval.
1375
+ The scheduling window can be further restricted by previously set `start_date` and `end_date` attributes.
1376
+ If a random delay (jitter) has been configured, it will be applied to the trigger to help distribute load
1377
+ or avoid collisions.
1378
+
1379
+ Parameters
1380
+ ----------
1381
+ seconds : int
1382
+ The specific second (0-59) of each forty-minute interval at which the event should be executed.
1383
+
1384
+ Returns
1385
+ -------
1386
+ bool
1387
+ Returns True if the scheduling was successfully configured. If the input is invalid,
1388
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1389
+
1390
+ Raises
1391
+ ------
1392
+ CLIOrionisValueError
1393
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1394
+
1395
+ Notes
1396
+ -----
1397
+ The event will be triggered at the specified second of every forty-minute interval, within the optional
1398
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter) is set,
1399
+ it will be applied to the trigger.
1400
+ """
1401
+
1402
+ # Delegate scheduling to the everyMinutesAt method with an interval of 40 minutes
1403
+ # and the specified second.
1404
+ return self.everyMinutesAt(40, seconds)
1405
+
1406
+ def everyFortyFiveMinutes(
1407
+ self
1408
+ ) -> bool:
1409
+ """
1410
+ Schedule the event to run every forty-five minutes.
1411
+
1412
+ This method configures the event to execute at a fixed interval of forty-five minutes using an
1413
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1414
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1415
+ it will be applied to the trigger to help distribute load or avoid collisions.
1416
+
1417
+ Returns
1418
+ -------
1419
+ bool
1420
+ True if the scheduling was successfully configured. The event will be triggered at
1421
+ 0 and 45 minutes of each hour, within the optional scheduling window defined by
1422
+ `start_date` and `end_date`. If a random delay (jitter) is set, it will be applied
1423
+ to the trigger.
1424
+
1425
+ Notes
1426
+ -----
1427
+ The event will be triggered at 0 and 45 minutes of each hour.
1428
+ """
1429
+
1430
+ # Delegate scheduling to the everyMinute method with an interval of 45 minutes.
1431
+ # This ensures consistent handling of start_date, end_date, and random_delay (jitter).
1432
+ return self.everyMinute(45)
1433
+
1434
+ def everyFortyFiveMinutesAt(
1435
+ self,
1436
+ seconds: int
1437
+ ) -> bool:
1438
+ """
1439
+ Schedule the event to run every forty-five minutes at a specific second.
1440
+
1441
+ This method configures the event to execute at the specified second (0-59)
1442
+ of every forty-five-minute interval. The scheduling window can be further
1443
+ restricted by previously set `start_date` and `end_date` attributes. If a
1444
+ random delay (jitter) has been configured, it will be applied to the trigger.
1445
+
1446
+ Parameters
1447
+ ----------
1448
+ seconds : int
1449
+ The specific second (0-59) of each forty-five-minute interval at which
1450
+ the event should be executed.
1451
+
1452
+ Returns
1453
+ -------
1454
+ bool
1455
+ Returns True if the scheduling was successfully configured. If the input
1456
+ is invalid, a `CLIOrionisValueError` is raised and the trigger is not set.
1457
+
1458
+ Raises
1459
+ ------
1460
+ CLIOrionisValueError
1461
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1462
+
1463
+ Notes
1464
+ -----
1465
+ The event will be triggered at the specified second of every forty-five-minute
1466
+ interval, within the optional scheduling window defined by `start_date` and
1467
+ `end_date`. If a random delay (jitter) is set, it will be applied to the trigger.
1468
+ """
1469
+
1470
+ # Delegate scheduling to the everyMinutesAt method with an interval of 45 minutes
1471
+ # and the specified second. This ensures consistent handling of start_date, end_date,
1472
+ # and random_delay (jitter).
1473
+ return self.everyMinutesAt(45, seconds)
1474
+
1475
+ def everyFiftyMinutes(
1476
+ self
1477
+ ) -> bool:
1478
+ """
1479
+ Schedule the event to run every fifty minutes.
1480
+
1481
+ This method configures the event to execute at a fixed interval of fifty minutes using an
1482
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
1483
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1484
+ it will be applied to the trigger to help distribute load or avoid collisions.
1485
+
1486
+ Returns
1487
+ -------
1488
+ bool
1489
+ Returns True after successfully configuring the interval trigger for execution every
1490
+ fifty minutes. The event will be triggered at 0, 50 minutes of each hour, within the
1491
+ optional scheduling window defined by `start_date` and `end_date`. If a random delay
1492
+ (jitter) is set, it will be applied to the trigger.
1493
+
1494
+ Notes
1495
+ -----
1496
+ The event will be triggered at 0 and 50 minutes of each hour.
1497
+ """
1498
+
1499
+ # Delegate scheduling to the everyMinute method with an interval of 50 minutes.
1500
+ # This ensures consistent handling of start_date, end_date, and random_delay (jitter).
1501
+ return self.everyMinute(50)
1502
+
1503
+ def everyFiftyMinutesAt(
1504
+ self,
1505
+ seconds: int
1506
+ ) -> bool:
1507
+ """
1508
+ Schedule the event to run every fifty minutes at a specific second.
1509
+
1510
+ This method configures the event to execute at the specified second (0-59)
1511
+ of every fifty-minute interval. The scheduling window can be further restricted
1512
+ by previously set `start_date` and `end_date` attributes. If a random delay
1513
+ (jitter) has been configured, it will be applied to the trigger.
1514
+
1515
+ Parameters
1516
+ ----------
1517
+ seconds : int
1518
+ The specific second (0-59) of each fifty-minute interval at which the
1519
+ event should be executed.
1520
+
1521
+ Returns
1522
+ -------
1523
+ bool
1524
+ True if the scheduling was successfully configured. If the input is invalid,
1525
+ a `CLIOrionisValueError` is raised and the trigger is not set.
1526
+
1527
+ Raises
1528
+ ------
1529
+ CLIOrionisValueError
1530
+ If `seconds` is not an integer between 0 and 59 (inclusive).
1531
+
1532
+ Notes
1533
+ -----
1534
+ The event will be triggered at the specified second of every fifty-minute
1535
+ interval, within the optional scheduling window defined by `start_date`
1536
+ and `end_date`. If a random delay (jitter) is set, it will be applied to
1537
+ the trigger.
1538
+ """
1539
+ # Delegate scheduling to the everyMinutesAt method with an interval of 50 minutes
1540
+ # and the specified second. This ensures consistent handling of start_date, end_date,
1541
+ # and random_delay (jitter).
1542
+ return self.everyMinutesAt(50, seconds)
1543
+
1544
+ def everyFiftyFiveMinutes(
1545
+ self
1546
+ ) -> bool:
1547
+ """
1548
+ Schedule the event to run every fifty-five minutes.
1549
+
1550
+ This method configures the event to execute at a fixed interval of fifty-five minutes
1551
+ using an `IntervalTrigger`. The scheduling window can be further restricted by previously
1552
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1553
+ it will be applied to the trigger to help distribute load or avoid collisions.
1554
+
1555
+ Returns
1556
+ -------
1557
+ bool
1558
+ Returns True after successfully configuring the interval trigger for execution every
1559
+ fifty-five minutes. The event will be triggered at 0 and 55 minutes of each hour,
1560
+ within the optional scheduling window defined by `start_date` and `end_date`. If a
1561
+ random delay (jitter) is set, it will be applied to the trigger.
1562
+
1563
+ Notes
1564
+ -----
1565
+ The event will be triggered at 0 and 55 minutes of each hour.
1566
+ """
1567
+
1568
+ # Delegate scheduling to the everyMinute method with an interval of 55 minutes.
1569
+ # This ensures consistent handling of start_date, end_date, and random_delay (jitter).
1570
+ return self.everyMinute(55)
1571
+
1572
+ def everyFiftyFiveMinutesAt(
1573
+ self,
1574
+ seconds: int
1575
+ ) -> bool:
1576
+ """
1577
+ Determines if the current time matches a schedule that triggers
1578
+ every 55 minutes at a specific second.
1579
+
1580
+ Parameters
1581
+ ----------
1582
+ seconds : int
1583
+ The specific second of the 55th minute at which the event should trigger.
1584
+
1585
+ Returns
1586
+ -------
1587
+ bool
1588
+ True if the current time matches the schedule (55 minutes past the hour
1589
+ at the specified second), False otherwise.
1590
+
1591
+ Notes
1592
+ -----
1593
+ This method is a wrapper around `everyMinutesAt` with the minute parameter
1594
+ fixed at 55.
1595
+ """
1596
+ return self.everyMinutesAt(55, seconds)
1597
+
1598
+ def hourly(
1599
+ self
1600
+ ) -> bool:
1601
+ """
1602
+ Schedule the event to run every hour.
1603
+
1604
+ This method configures the event to execute once every hour, starting from the
1605
+ optionally set `start_date` and ending at the optionally set `end_date`. If a random
1606
+ delay (jitter) has been configured, it will be applied to the trigger to help distribute
1607
+ load or avoid collisions. The method ensures that the event is triggered at regular
1608
+ hourly intervals.
1609
+
1610
+ Returns
1611
+ -------
1612
+ bool
1613
+ True if the hourly scheduling was successfully configured. The method always
1614
+ returns True after setting up the interval trigger.
1615
+
1616
+ Notes
1617
+ -----
1618
+ The event will be triggered at the start of every hour, within the optional scheduling
1619
+ window defined by `start_date` and `end_date`. If a random delay (jitter) is set, it
1620
+ will be applied to the trigger.
1621
+ """
1622
+
1623
+ # Configure the trigger to execute the event every hour.
1624
+ # The IntervalTrigger ensures the event is triggered at hourly intervals.
1625
+ self.__trigger = IntervalTrigger(
1626
+ hours=1,
1627
+ start_date=self.__start_date, # Restrict the schedule start if set
1628
+ end_date=self.__end_date, # Restrict the schedule end if set
1629
+ jitter=self.__random_delay # Apply random delay if configured
1630
+ )
1631
+
1632
+ # Store a human-readable description of the schedule for reference or logging.
1633
+ self.__details = "Every hour"
1634
+
1635
+ # Indicate that the scheduling was successfully configured.
1636
+ return True
1637
+
1638
+ def hourlyAt(
1639
+ self,
1640
+ minute: int,
1641
+ second: int = 0
1642
+ ) -> bool:
1643
+ """
1644
+ Schedule the event to run every hour at a specific minute and second.
1645
+
1646
+ This method configures the event to execute once every hour at the specified
1647
+ minute and second. The schedule can be further restricted by previously set
1648
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been
1649
+ configured, it will be applied to the trigger to help distribute load or avoid
1650
+ collisions.
1651
+
1652
+ Parameters
1653
+ ----------
1654
+ minute : int
1655
+ The minute of the hour when the event should run. Must be in the range [0, 59].
1656
+ second : int, optional
1657
+ The second of the minute when the event should run. Must be in the range [0, 59].
1658
+ Default is 0.
1659
+
1660
+ Returns
1661
+ -------
1662
+ bool
1663
+ True if the hourly scheduling was successfully configured. If the input
1664
+ is invalid, a `CLIOrionisValueError` is raised and the trigger is not set.
1665
+
1666
+ Raises
1667
+ ------
1668
+ CLIOrionisValueError
1669
+ If `minute` or `second` are not integers within the valid ranges [0, 59].
1670
+
1671
+ Notes
1672
+ -----
1673
+ The event will be triggered every hour at the specified minute and second,
1674
+ within the optional scheduling window defined by `start_date` and `end_date`.
1675
+ """
1676
+ # Validate that minute and second are integers.
1677
+ if not isinstance(minute, int) or not isinstance(second, int):
1678
+ raise CLIOrionisValueError("Minute and second must be integers.")
1679
+
1680
+ # Validate that minute is within the range [0, 59].
1681
+ if not (0 <= minute < 60):
1682
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
1683
+
1684
+ # Validate that second is within the range [0, 59].
1685
+ if not (0 <= second < 60):
1686
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
1687
+
1688
+ # Set up the trigger to execute the event every hour at the specified minute and second.
1689
+ # The IntervalTrigger ensures the event is triggered at hourly intervals.
1690
+ self.__trigger = IntervalTrigger(
1691
+ hours=1,
1692
+ minute=minute,
1693
+ second=second,
1694
+ start_date=self.__start_date, # Restrict the schedule start if set.
1695
+ end_date=self.__end_date # Restrict the schedule end if set.
1696
+ )
1697
+
1698
+ # Store a human-readable description of the schedule for reference or logging.
1699
+ self.__details = f"Every hour at {minute:02d}:{second:02d}"
1700
+
1701
+ # Indicate that the scheduling was successfully configured.
1702
+ return True
1703
+
1704
+ def everyOddHours(
1705
+ self
1706
+ ) -> bool:
1707
+ """
1708
+ Schedule the event to run at every odd hour of the day (e.g., 1 AM, 3 AM, 5 AM, ..., 11 PM).
1709
+
1710
+ This method configures the event to execute at every odd-numbered hour using a `CronTrigger`.
1711
+ The schedule can be further restricted by previously set `start_date` and `end_date`.
1712
+ If a random delay (jitter) has been configured, it will be applied to the trigger.
1713
+
1714
+ Returns
1715
+ -------
1716
+ bool
1717
+ True if the scheduling was successfully configured. The event will be triggered
1718
+ at hours 1, 3, 5, ..., 23 of each day.
1719
+
1720
+ Notes
1721
+ -----
1722
+ The event will be triggered at odd hours of the day, starting from 1 AM and ending at 11 PM.
1723
+ """
1724
+ # Configure the trigger to execute the event at every odd hour (1, 3, 5, ..., 23)
1725
+ # using a CronTrigger. The `hour='1-23/2'` specifies odd hours in the range.
1726
+ self.__trigger = CronTrigger(
1727
+ hour='1-23/2', # Schedule the event for odd hours.
1728
+ start_date=self.__start_date, # Restrict the schedule start if set.
1729
+ end_date=self.__end_date, # Restrict the schedule end if set.
1730
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
1731
+ )
1732
+
1733
+ # Store a human-readable description of the schedule for reference or logging.
1734
+ self.__details = "Every odd hour (1, 3, 5, ..., 23)"
1735
+
1736
+ # Indicate that the scheduling was successfully configured.
1737
+ return True
1738
+
1739
+ def everyEvenHours(
1740
+ self
1741
+ ) -> bool:
1742
+ """
1743
+ Schedule the event to run at every even hour of the day (e.g., 12 AM, 2 AM, 4 AM, ..., 10 PM).
1744
+
1745
+ This method configures the event to execute at every even-numbered hour using a `CronTrigger`.
1746
+ The schedule can be further restricted by previously set `start_date` and `end_date`.
1747
+ If a random delay (jitter) has been configured, it will be applied to the trigger.
1748
+
1749
+ Returns
1750
+ -------
1751
+ bool
1752
+ True if the scheduling was successfully configured. The event will be triggered
1753
+ at hours 0, 2, 4, ..., 22 of each day.
1754
+
1755
+ Notes
1756
+ -----
1757
+ The event will be triggered at even hours of the day, starting from 12 AM and ending at 10 PM.
1758
+ """
1759
+ # Configure the trigger to execute the event at every even hour (0, 2, 4, ..., 22)
1760
+ # using a CronTrigger. The `hour='0-22/2'` specifies even hours in the range.
1761
+ self.__trigger = CronTrigger(
1762
+ hour='0-22/2', # Schedule the event for even hours.
1763
+ start_date=self.__start_date, # Restrict the schedule start if set.
1764
+ end_date=self.__end_date, # Restrict the schedule end if set.
1765
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
1766
+ )
1767
+
1768
+ # Store a human-readable description of the schedule for reference or logging.
1769
+ self.__details = "Every even hour (0, 2, 4, ..., 22)"
1770
+
1771
+ # Indicate that the scheduling was successfully configured.
1772
+ return True
1773
+
1774
+ def everyHours(
1775
+ self,
1776
+ hours: int
1777
+ ) -> bool:
1778
+ """
1779
+ Schedule the event to run at fixed intervals measured in hours.
1780
+
1781
+ This method configures the event to execute repeatedly at a specified interval
1782
+ (in hours). The interval must be a positive integer. Optionally, the event can be
1783
+ restricted to a time window using previously set `start_date` and `end_date`. If a
1784
+ random delay (jitter) has been configured, it will be applied to the trigger.
1785
+
1786
+ Parameters
1787
+ ----------
1788
+ hours : int
1789
+ The interval, in hours, at which the event should be executed. Must be a positive integer.
1790
+
1791
+ Returns
1792
+ -------
1793
+ bool
1794
+ True if the interval scheduling was successfully configured. If the input is invalid,
1795
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
1796
+
1797
+ Raises
1798
+ ------
1799
+ CLIOrionisValueError
1800
+ If `hours` is not a positive integer.
1801
+
1802
+ Notes
1803
+ -----
1804
+ The event will be triggered every `hours` hours, starting from the configured
1805
+ `start_date` (if set) and ending at `end_date` (if set). If a random delay (jitter)
1806
+ is set, it will be applied to the trigger.
1807
+ """
1808
+
1809
+ # Validate that the `hours` parameter is a positive integer.
1810
+ if not isinstance(hours, int) or hours <= 0:
1811
+ raise CLIOrionisValueError("The interval must be a positive integer.")
1812
+
1813
+ # Configure the trigger to execute the event at the specified interval.
1814
+ # The `start_date` and `end_date` define the optional scheduling window.
1815
+ # The `jitter` adds a random delay if configured.
1816
+ self.__trigger = IntervalTrigger(
1817
+ hours=hours,
1818
+ start_date=self.__start_date,
1819
+ end_date=self.__end_date,
1820
+ jitter=self.__random_delay
1821
+ )
1822
+
1823
+ # Store a human-readable description of the schedule for reference or logging.
1824
+ self.__details = f"Every {hours} hours"
1825
+
1826
+ # Indicate that the scheduling was successfully configured.
1827
+ return True
1828
+
1829
+ def everyHoursAt(
1830
+ self,
1831
+ hours: int,
1832
+ minute: int,
1833
+ second: int = 0
1834
+ ) -> bool:
1835
+ """
1836
+ Schedule the event to run every hour at a specific minute and second.
1837
+
1838
+ This method configures the event to execute once every hour at the specified
1839
+ minute and second. The schedule can be further restricted by previously set
1840
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
1841
+ for this schedule.
1842
+
1843
+ Parameters
1844
+ ----------
1845
+ minute : int
1846
+ The minute of the hour when the event should run. Must be in the range [0, 59].
1847
+ second : int, optional
1848
+ The second of the minute when the event should run. Must be in the range [0, 59].
1849
+ Default is 0.
1850
+
1851
+ Returns
1852
+ -------
1853
+ bool
1854
+ True if the scheduling was successfully configured. If the input is invalid,
1855
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
1856
+
1857
+ Raises
1858
+ ------
1859
+ CLIOrionisValueError
1860
+ If `minute` or `second` are not integers within the valid ranges [0, 59].
1861
+
1862
+ Notes
1863
+ -----
1864
+ The event will be triggered every hour at the specified minute and second,
1865
+ within the optional scheduling window defined by `start_date` and `end_date`.
1866
+ """
1867
+
1868
+ # Validate that the `hours` parameter is a positive integer.
1869
+ if not isinstance(hours, int) or hours <= 0:
1870
+ raise CLIOrionisValueError("The interval must be a positive integer.")
1871
+
1872
+ # Validate that minute and second are integers.
1873
+ if not isinstance(minute, int) or not isinstance(second, int):
1874
+ raise CLIOrionisValueError("Minute and second must be integers.")
1875
+
1876
+ # Validate that minute is within the range [0, 59].
1877
+ if not (0 <= minute < 60):
1878
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
1879
+
1880
+ # Validate that second is within the range [0, 59].
1881
+ if not (0 <= second < 60):
1882
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
1883
+
1884
+ # Configure the trigger to execute the event every hour at the specified minute and second.
1885
+ # The IntervalTrigger ensures the event is triggered at hourly intervals.
1886
+ self.__trigger = IntervalTrigger(
1887
+ hours=hours,
1888
+ minute=minute,
1889
+ second=second,
1890
+ start_date=self.__start_date, # Restrict the schedule start if set.
1891
+ end_date=self.__end_date # Restrict the schedule end if set.
1892
+ )
1893
+
1894
+ # Store a human-readable description of the schedule for reference or logging.
1895
+ self.__details = f"Every hour at {minute:02d}:{second:02d}"
1896
+
1897
+ # Indicate that the scheduling was successfully configured.
1898
+ return True
1899
+
1900
+ def everyTwoHours(
1901
+ self
1902
+ ) -> bool:
1903
+ """
1904
+ Schedule the event to run every two hours.
1905
+
1906
+ This method configures the event to execute at a fixed interval of two hours using the
1907
+ `everyHours` method. The scheduling window can be further restricted by previously set
1908
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1909
+ it will be applied to the trigger.
1910
+
1911
+ Returns
1912
+ -------
1913
+ bool
1914
+ True if the scheduling was successfully configured. The method always returns True
1915
+ after delegating the scheduling to `everyHours`.
1916
+ """
1917
+
1918
+ # Delegate the scheduling to the `everyHours` method with an interval of 2 hours.
1919
+ return self.everyHours(2)
1920
+
1921
+ def everyTwoHoursAt(
1922
+ self,
1923
+ minute: int,
1924
+ second: int = 0
1925
+ ) -> bool:
1926
+ """
1927
+ Schedule the event to run every two hours at a specific minute and second.
1928
+
1929
+ This method configures the event to execute every two hours at the specified
1930
+ minute and second. The schedule can be further restricted by previously set
1931
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been
1932
+ configured, it will be applied to the trigger.
1933
+
1934
+ Parameters
1935
+ ----------
1936
+ minute : int
1937
+ The minute of the hour when the event should run. Must be in the range [0, 59].
1938
+ second : int, optional
1939
+ The second of the minute when the event should run. Must be in the range [0, 59].
1940
+ Default is 0.
1941
+
1942
+ Returns
1943
+ -------
1944
+ bool
1945
+ Returns True if the scheduling was successfully configured. If the input
1946
+ is invalid, a `CLIOrionisValueError` is raised, and the trigger is not set.
1947
+
1948
+ Raises
1949
+ ------
1950
+ CLIOrionisValueError
1951
+ If `minute` or `second` are not integers within the valid ranges.
1952
+
1953
+ Notes
1954
+ -----
1955
+ The event will be triggered every two hours at the specified minute and second,
1956
+ within the optional scheduling window defined by `start_date` and `end_date`.
1957
+ """
1958
+
1959
+ # Delegate scheduling to the everyHoursAt method with an interval of 2 hours
1960
+ # and the specified minute and second.
1961
+ return self.everyHoursAt(2, minute, second)
1962
+
1963
+ def everyThreeHours(
1964
+ self
1965
+ ) -> bool:
1966
+ """
1967
+ Schedule the event to run every three hours.
1968
+
1969
+ This method configures the event to execute at a fixed interval of three hours using the
1970
+ `everyHours` method. The scheduling window can be further restricted by previously set
1971
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
1972
+ it will be applied to the trigger.
1973
+
1974
+ Returns
1975
+ -------
1976
+ bool
1977
+ True if the scheduling was successfully configured. The method always returns True
1978
+ after delegating the scheduling to `everyHours`.
1979
+ """
1980
+
1981
+ # Delegate the scheduling to the `everyHours` method with an interval of 3 hours.
1982
+ return self.everyHours(3)
1983
+
1984
+ def everyThreeHoursAt(
1985
+ self,
1986
+ minute: int,
1987
+ second: int = 0
1988
+ ) -> bool:
1989
+ """
1990
+ Schedule the event to run every three hours at a specific minute and second.
1991
+
1992
+ This method configures the event to execute every three hours at the specified
1993
+ minute and second. The schedule can be further restricted by previously set
1994
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
1995
+ for this schedule.
1996
+
1997
+ Parameters
1998
+ ----------
1999
+ minute : int
2000
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2001
+ second : int, optional
2002
+ The second of the minute when the event should run. Must be in the range [0, 59].
2003
+ Default is 0.
2004
+
2005
+ Returns
2006
+ -------
2007
+ bool
2008
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2009
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2010
+
2011
+ Raises
2012
+ ------
2013
+ CLIOrionisValueError
2014
+ If `minute` or `second` are not integers within the valid ranges.
2015
+
2016
+ Notes
2017
+ -----
2018
+ The event will be triggered every three hours at the specified minute and second,
2019
+ within the optional scheduling window defined by `start_date` and `end_date`.
2020
+ """
2021
+
2022
+ # Delegate scheduling to the everyHoursAt method with an interval of 3 hours
2023
+ # and the specified minute and second.
2024
+ return self.everyHoursAt(3, minute, second)
2025
+
2026
+ def everyFourHours(
2027
+ self
2028
+ ) -> bool:
2029
+ """
2030
+ Schedule the event to run every four hours.
2031
+
2032
+ This method configures the event to execute at a fixed interval of four hours using the
2033
+ `everyHours` method. The scheduling window can be further restricted by previously set
2034
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2035
+ it will be applied to the trigger.
2036
+
2037
+ Returns
2038
+ -------
2039
+ bool
2040
+ True if the scheduling was successfully configured. The method always returns True
2041
+ after delegating the scheduling to `everyHours`.
2042
+
2043
+ Notes
2044
+ -----
2045
+ The event will be triggered at 0:00, 4:00, 8:00, ..., 20:00 of each day.
2046
+ """
2047
+
2048
+ # Delegate the scheduling to the `everyHours` method with an interval of 4 hours.
2049
+ return self.everyHours(4)
2050
+
2051
+ def everyFourHoursAt(
2052
+ self,
2053
+ minute: int,
2054
+ second: int = 0
2055
+ ) -> bool:
2056
+ """
2057
+ Schedule the event to run every four hours at a specific minute and second.
2058
+
2059
+ This method configures the event to execute every four hours at the specified
2060
+ minute and second. The schedule can be further restricted by previously set
2061
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2062
+ for this schedule.
2063
+
2064
+ Parameters
2065
+ ----------
2066
+ minute : int
2067
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2068
+ second : int, optional
2069
+ The second of the minute when the event should run. Must be in the range [0, 59].
2070
+ Default is 0.
2071
+
2072
+ Returns
2073
+ -------
2074
+ bool
2075
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2076
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2077
+
2078
+ Raises
2079
+ ------
2080
+ CLIOrionisValueError
2081
+ If `minute` or `second` are not integers within the valid ranges.
2082
+
2083
+ Notes
2084
+ -----
2085
+ The event will be triggered every four hours at the specified minute and second,
2086
+ within the optional scheduling window defined by `start_date` and `end_date`.
2087
+ """
2088
+
2089
+ # Delegate scheduling to the everyHoursAt method with an interval of 4 hours
2090
+ # and the specified minute and second.
2091
+ return self.everyHoursAt(4, minute, second)
2092
+
2093
+ def everyFiveHours(
2094
+ self
2095
+ ) -> bool:
2096
+ """
2097
+ Schedule the event to run every five hours.
2098
+
2099
+ This method configures the event to execute at a fixed interval of five hours using the
2100
+ `everyHours` method. The scheduling window can be further restricted by previously set
2101
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2102
+ it will be applied to the trigger.
2103
+
2104
+ Returns
2105
+ -------
2106
+ bool
2107
+ True if the scheduling was successfully configured. The method always returns True
2108
+ after delegating the scheduling to `everyHours`.
2109
+
2110
+ Notes
2111
+ -----
2112
+ The event will be triggered at 0:00, 5:00, 10:00, 15:00, and 20:00 of each day.
2113
+ """
2114
+
2115
+ # Delegate the scheduling to the `everyHours` method with an interval of 5 hours.
2116
+ return self.everyHours(5)
2117
+
2118
+ def everyFiveHoursAt(
2119
+ self,
2120
+ minute: int,
2121
+ second: int = 0
2122
+ ) -> bool:
2123
+ """
2124
+ Schedule the event to run every five hours at a specific minute and second.
2125
+
2126
+ This method configures the event to execute every five hours at the specified
2127
+ minute and second. The schedule can be further restricted by previously set
2128
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2129
+ for this schedule.
2130
+
2131
+ Parameters
2132
+ ----------
2133
+ minute : int
2134
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2135
+ second : int, optional
2136
+ The second of the minute when the event should run. Must be in the range [0, 59].
2137
+ Default is 0.
2138
+
2139
+ Returns
2140
+ -------
2141
+ bool
2142
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2143
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2144
+
2145
+ Notes
2146
+ -----
2147
+ The event will be triggered every five hours at the specified minute and second,
2148
+ within the optional scheduling window defined by `start_date` and `end_date`.
2149
+ """
2150
+
2151
+ # Delegate scheduling to the everyHoursAt method with an interval of 5 hours
2152
+ # and the specified minute and second.
2153
+ return self.everyHoursAt(5, minute, second)
2154
+
2155
+ def everySixHours(
2156
+ self
2157
+ ) -> bool:
2158
+ """
2159
+ Schedule the event to run every six hours.
2160
+
2161
+ This method configures the event to execute at a fixed interval of six hours using the
2162
+ `everyHours` method. The scheduling window can be further restricted by previously set
2163
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2164
+ it will be applied to the trigger.
2165
+
2166
+ Returns
2167
+ -------
2168
+ bool
2169
+ True if the scheduling was successfully configured. The method always returns True
2170
+ after delegating the scheduling to `everyHours`.
2171
+
2172
+ Notes
2173
+ -----
2174
+ The event will be triggered at 0:00, 6:00, 12:00, and 18:00 of each day.
2175
+ """
2176
+
2177
+ # Delegate the scheduling to the `everyHours` method with an interval of 6 hours.
2178
+ return self.everyHours(6)
2179
+
2180
+ def everySixHoursAt(
2181
+ self,
2182
+ minute: int,
2183
+ second: int = 0
2184
+ ) -> bool:
2185
+ """
2186
+ Schedule the event to run every six hours at a specific minute and second.
2187
+
2188
+ This method configures the event to execute every six hours at the specified
2189
+ minute and second. The schedule can be further restricted by previously set
2190
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2191
+ for this schedule.
2192
+
2193
+ Parameters
2194
+ ----------
2195
+ minute : int
2196
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2197
+ second : int, optional
2198
+ The second of the minute when the event should run. Must be in the range [0, 59].
2199
+ Default is 0.
2200
+
2201
+ Returns
2202
+ -------
2203
+ bool
2204
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2205
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2206
+
2207
+ Raises
2208
+ ------
2209
+ CLIOrionisValueError
2210
+ If `minute` or `second` are not integers within the valid ranges.
2211
+
2212
+ Notes
2213
+ -----
2214
+ The event will be triggered every six hours at the specified minute and second,
2215
+ within the optional scheduling window defined by `start_date` and `end_date`.
2216
+ """
2217
+
2218
+ # Delegate scheduling to the everyHoursAt method with an interval of 6 hours
2219
+ # and the specified minute and second.
2220
+ return self.everyHoursAt(6, minute, second)
2221
+
2222
+ def everySevenHours(
2223
+ self
2224
+ ) -> bool:
2225
+ """
2226
+ Schedule the event to run every seven hours.
2227
+
2228
+ This method configures the event to execute at a fixed interval of seven hours using the
2229
+ `everyHours` method. The scheduling window can be further restricted by previously set
2230
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2231
+ it will be applied to the trigger.
2232
+
2233
+ Returns
2234
+ -------
2235
+ bool
2236
+ True if the scheduling was successfully configured. The method always returns True
2237
+ after delegating the scheduling to `everyHours`.
2238
+
2239
+ Notes
2240
+ -----
2241
+ The event will be triggered at 0:00, 7:00, 14:00, and 21:00 of each day.
2242
+ """
2243
+
2244
+ # Delegate the scheduling to the `everyHours` method with an interval of 7 hours.
2245
+ return self.everyHours(7)
2246
+
2247
+ def everySevenHoursAt(
2248
+ self,
2249
+ minute: int,
2250
+ second: int = 0
2251
+ ) -> bool:
2252
+ """
2253
+ Schedule the event to run every seven hours at a specific minute and second.
2254
+
2255
+ This method configures the event to execute every seven hours at the specified
2256
+ minute and second. The schedule can be further restricted by previously set
2257
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2258
+ for this schedule.
2259
+
2260
+ Parameters
2261
+ ----------
2262
+ minute : int
2263
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2264
+ second : int, optional
2265
+ The second of the minute when the event should run. Must be in the range [0, 59].
2266
+ Default is 0.
2267
+
2268
+ Returns
2269
+ -------
2270
+ bool
2271
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2272
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2273
+
2274
+ Raises
2275
+ ------
2276
+ CLIOrionisValueError
2277
+ If `minute` or `second` are not integers within the valid ranges.
2278
+
2279
+ Notes
2280
+ -----
2281
+ The event will be triggered every seven hours at the specified minute and second,
2282
+ within the optional scheduling window defined by `start_date` and `end_date`.
2283
+ """
2284
+
2285
+ # Delegate scheduling to the everyHoursAt method with an interval of 7 hours
2286
+ # and the specified minute and second.
2287
+ return self.everyHoursAt(7, minute, second)
2288
+
2289
+ def everyEightHours(
2290
+ self
2291
+ ) -> bool:
2292
+ """
2293
+ Schedule the event to run every eight hours.
2294
+
2295
+ This method configures the event to execute at a fixed interval of eight hours using the
2296
+ `everyHours` method. The scheduling window can be further restricted by previously set
2297
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2298
+ it will be applied to the trigger.
2299
+
2300
+ Returns
2301
+ -------
2302
+ bool
2303
+ True if the scheduling was successfully configured. The method always returns True
2304
+ after delegating the scheduling to `everyHours`.
2305
+
2306
+ Notes
2307
+ -----
2308
+ The event will be triggered at 0:00, 8:00, 16:00 of each day.
2309
+ """
2310
+
2311
+ # Delegate the scheduling to the `everyHours` method with an interval of 8 hours.
2312
+ return self.everyHours(8)
2313
+
2314
+ def everyEightHoursAt(
2315
+ self,
2316
+ minute: int,
2317
+ second: int = 0
2318
+ ) -> bool:
2319
+ """
2320
+ Schedule the event to run every eight hours at a specific minute and second.
2321
+
2322
+ This method configures the event to execute every eight hours at the specified
2323
+ minute and second. The schedule can be further restricted by previously set
2324
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2325
+ for this schedule.
2326
+
2327
+ Parameters
2328
+ ----------
2329
+ minute : int
2330
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2331
+ second : int, optional
2332
+ The second of the minute when the event should run. Must be in the range [0, 59].
2333
+ Default is 0.
2334
+
2335
+ Returns
2336
+ -------
2337
+ bool
2338
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2339
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2340
+
2341
+ Raises
2342
+ ------
2343
+ CLIOrionisValueError
2344
+ If `minute` or `second` are not integers within the valid ranges.
2345
+
2346
+ Notes
2347
+ -----
2348
+ The event will be triggered every eight hours at the specified minute and second,
2349
+ within the optional scheduling window defined by `start_date` and `end_date`.
2350
+ """
2351
+
2352
+ # Delegate scheduling to the everyHoursAt method with an interval of 8 hours
2353
+ # and the specified minute and second.
2354
+ return self.everyHoursAt(8, minute, second)
2355
+
2356
+ def everyNineHours(
2357
+ self
2358
+ ) -> bool:
2359
+ """
2360
+ Schedule the event to run every nine hours.
2361
+
2362
+ This method configures the event to execute at a fixed interval of nine hours using the
2363
+ `everyHours` method. The scheduling window can be further restricted by previously set
2364
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2365
+ it will be applied to the trigger.
2366
+
2367
+ Returns
2368
+ -------
2369
+ bool
2370
+ True if the scheduling was successfully configured. The method always returns True
2371
+ after delegating the scheduling to `everyHours`.
2372
+
2373
+ Notes
2374
+ -----
2375
+ The event will be triggered at 0:00, 9:00, and 18:00 of each day.
2376
+ """
2377
+
2378
+ # Delegate the scheduling to the `everyHours` method with an interval of 9 hours.
2379
+ return self.everyHours(9)
2380
+
2381
+ def everyNineHoursAt(
2382
+ self,
2383
+ minute: int,
2384
+ second: int = 0
2385
+ ) -> bool:
2386
+ """
2387
+ Schedule the event to run every nine hours at a specific minute and second.
2388
+
2389
+ This method configures the event to execute every nine hours at the specified
2390
+ minute and second. The schedule can be further restricted by previously set
2391
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2392
+ for this schedule.
2393
+
2394
+ Parameters
2395
+ ----------
2396
+ minute : int
2397
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2398
+ second : int, optional
2399
+ The second of the minute when the event should run. Must be in the range [0, 59].
2400
+ Default is 0.
2401
+
2402
+ Returns
2403
+ -------
2404
+ bool
2405
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2406
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2407
+
2408
+ Raises
2409
+ ------
2410
+ CLIOrionisValueError
2411
+ If `minute` or `second` are not integers within the valid ranges.
2412
+
2413
+ Notes
2414
+ -----
2415
+ The event will be triggered every nine hours at the specified minute and second,
2416
+ within the optional scheduling window defined by `start_date` and `end_date`.
2417
+ """
2418
+
2419
+ # Delegate scheduling to the everyHoursAt method with an interval of 9 hours
2420
+ # and the specified minute and second.
2421
+ return self.everyHoursAt(9, minute, second)
2422
+
2423
+ def everyTenHours(
2424
+ self
2425
+ ) -> bool:
2426
+ """
2427
+ Schedule the event to run every ten hours.
2428
+
2429
+ This method configures the event to execute at a fixed interval of ten hours using the
2430
+ `everyHours` method. The scheduling window can be further restricted by previously set
2431
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2432
+ it will be applied to the trigger.
2433
+
2434
+ Returns
2435
+ -------
2436
+ bool
2437
+ True if the scheduling was successfully configured. The method always returns True
2438
+ after delegating the scheduling to `everyHours`.
2439
+
2440
+ Notes
2441
+ -----
2442
+ The event will be triggered at 0:00, 10:00, and 20:00 of each day.
2443
+ """
2444
+
2445
+ # Delegate the scheduling to the `everyHours` method with an interval of 10 hours.
2446
+ return self.everyHours(10)
2447
+
2448
+ def everyTenHoursAt(
2449
+ self,
2450
+ minute: int,
2451
+ second: int = 0
2452
+ ) -> bool:
2453
+ """
2454
+ Schedule the event to run every ten hours at a specific minute and second.
2455
+
2456
+ This method configures the event to execute every ten hours at the specified
2457
+ minute and second. The schedule can be further restricted by previously set
2458
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2459
+ for this schedule.
2460
+
2461
+ Parameters
2462
+ ----------
2463
+ minute : int
2464
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2465
+ second : int, optional
2466
+ The second of the minute when the event should run. Must be in the range [0, 59].
2467
+ Default is 0.
2468
+
2469
+ Returns
2470
+ -------
2471
+ bool
2472
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2473
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2474
+
2475
+ Raises
2476
+ ------
2477
+ CLIOrionisValueError
2478
+ If `minute` or `second` are not integers within the valid ranges.
2479
+
2480
+ Notes
2481
+ -----
2482
+ The event will be triggered every ten hours at the specified minute and second,
2483
+ within the optional scheduling window defined by `start_date` and `end_date`.
2484
+ """
2485
+
2486
+ # Delegate scheduling to the everyHoursAt method with an interval of 10 hours
2487
+ # and the specified minute and second.
2488
+ return self.everyHoursAt(10, minute, second)
2489
+
2490
+ def everyElevenHours(
2491
+ self
2492
+ ) -> bool:
2493
+ """
2494
+ Schedule the event to run every eleven hours.
2495
+
2496
+ This method configures the event to execute at a fixed interval of eleven hours using the
2497
+ `everyHours` method. The scheduling window can be further restricted by previously set
2498
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2499
+ it will be applied to the trigger.
2500
+
2501
+ Returns
2502
+ -------
2503
+ bool
2504
+ True if the scheduling was successfully configured. The method always returns True
2505
+ after delegating the scheduling to `everyHours`.
2506
+
2507
+ Notes
2508
+ -----
2509
+ The event will be triggered at 0:00, 11:00, and 22:00 of each day.
2510
+ """
2511
+
2512
+ # Delegate the scheduling to the `everyHours` method with an interval of 11 hours.
2513
+ return self.everyHours(11)
2514
+
2515
+ def everyElevenHoursAt(
2516
+ self,
2517
+ minute: int,
2518
+ second: int = 0
2519
+ ) -> bool:
2520
+ """
2521
+ Schedule the event to run every eleven hours at a specific minute and second.
2522
+
2523
+ This method configures the event to execute every eleven hours at the specified
2524
+ minute and second. The schedule can be further restricted by previously set
2525
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2526
+ for this schedule.
2527
+
2528
+ Parameters
2529
+ ----------
2530
+ minute : int
2531
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2532
+ second : int, optional
2533
+ The second of the minute when the event should run. Must be in the range [0, 59].
2534
+ Default is 0.
2535
+
2536
+ Returns
2537
+ -------
2538
+ bool
2539
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2540
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2541
+
2542
+ Raises
2543
+ ------
2544
+ CLIOrionisValueError
2545
+ If `minute` or `second` are not integers within the valid ranges.
2546
+
2547
+ Notes
2548
+ -----
2549
+ The event will be triggered every eleven hours at the specified minute and second,
2550
+ within the optional scheduling window defined by `start_date` and `end_date`.
2551
+ """
2552
+
2553
+ # Delegate scheduling to the everyHoursAt method with an interval of 11 hours
2554
+ # and the specified minute and second.
2555
+ return self.everyHoursAt(11, minute, second)
2556
+
2557
+ def everyTwelveHours(
2558
+ self
2559
+ ) -> bool:
2560
+ """
2561
+ Schedule the event to run every twelve hours.
2562
+
2563
+ This method configures the event to execute at a fixed interval of twelve hours using the
2564
+ `everyHours` method. The scheduling window can be further restricted by previously set
2565
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2566
+ it will be applied to the trigger.
2567
+
2568
+ Returns
2569
+ -------
2570
+ bool
2571
+ True if the scheduling was successfully configured. The method always returns True
2572
+ after delegating the scheduling to `everyHours`.
2573
+
2574
+ Notes
2575
+ -----
2576
+ The event will be triggered at 0:00, 12:00 of each day.
2577
+ """
2578
+
2579
+ # Delegate the scheduling to the `everyHours` method with an interval of 12 hours.
2580
+ return self.everyHours(12)
2581
+
2582
+ def everyTwelveHoursAt(
2583
+ self,
2584
+ minute: int,
2585
+ second: int = 0
2586
+ ) -> bool:
2587
+ """
2588
+ Schedule the event to run every twelve hours at a specific minute and second.
2589
+
2590
+ This method configures the event to execute every twelve hours at the specified
2591
+ minute and second. The schedule can be further restricted by previously set
2592
+ `start_date` and `end_date` attributes. Jitter (random delay) is not applied
2593
+ for this schedule.
2594
+
2595
+ Parameters
2596
+ ----------
2597
+ minute : int
2598
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2599
+ second : int, optional
2600
+ The second of the minute when the event should run. Must be in the range [0, 59].
2601
+ Default is 0.
2602
+
2603
+ Returns
2604
+ -------
2605
+ bool
2606
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2607
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2608
+
2609
+ Raises
2610
+ ------
2611
+ CLIOrionisValueError
2612
+ If `minute` or `second` are not integers within the valid ranges.
2613
+
2614
+ Notes
2615
+ -----
2616
+ The event will be triggered every twelve hours at the specified minute and second,
2617
+ within the optional scheduling window defined by `start_date` and `end_date`.
2618
+ """
2619
+
2620
+ # Delegate scheduling to the everyHoursAt method with an interval of 12 hours
2621
+ # and the specified minute and second.
2622
+ return self.everyHoursAt(12, minute, second)
2623
+
2624
+ def daily(
2625
+ self
2626
+ ) -> bool:
2627
+ """
2628
+ Schedule the event to run once per day.
2629
+
2630
+ This method configures the event to execute at a fixed interval of one day using an
2631
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
2632
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2633
+ it will be applied to the trigger to help distribute load or avoid collisions.
2634
+
2635
+ Parameters
2636
+ ----------
2637
+ None
2638
+
2639
+ Returns
2640
+ -------
2641
+ bool
2642
+ Returns True after successfully configuring the interval trigger for daily execution.
2643
+ The method always returns True after setting up the interval trigger.
2644
+
2645
+ Notes
2646
+ -----
2647
+ The event will be triggered once every day, within the optional scheduling window defined
2648
+ by `start_date` and `end_date`. If a random delay (jitter) is set, it will be applied to
2649
+ the trigger.
2650
+ """
2651
+
2652
+ # Configure the trigger to execute the event every day.
2653
+ # Apply any configured start_date, end_date, and random_delay (jitter).
2654
+ self.__trigger = IntervalTrigger(
2655
+ days=1,
2656
+ start_date=self.__start_date, # Restrict the schedule start if set
2657
+ end_date=self.__end_date, # Restrict the schedule end if set
2658
+ jitter=self.__random_delay # Apply random delay if configured
2659
+ )
2660
+
2661
+ # Store a human-readable description of the schedule.
2662
+ self.__details = "Every day"
2663
+
2664
+ # Indicate that the scheduling was successful.
2665
+ return True
2666
+
2667
+ def dailyAt(
2668
+ self,
2669
+ hour: int,
2670
+ minute: int = 0,
2671
+ second: int = 0
2672
+ ) -> bool:
2673
+ """
2674
+ Schedule the event to run daily at a specific hour, minute, and second.
2675
+
2676
+ This method configures the event to execute once every day at the specified
2677
+ hour, minute, and second. The schedule can be further restricted by previously
2678
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
2679
+ configured, it will be applied to the trigger to help distribute load or avoid
2680
+ collisions.
2681
+
2682
+ Parameters
2683
+ ----------
2684
+ hour : int
2685
+ The hour of the day when the event should run. Must be in the range [0, 23].
2686
+ minute : int, optional
2687
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
2688
+ second : int, optional
2689
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
2690
+
2691
+ Returns
2692
+ -------
2693
+ bool
2694
+ Returns True if the scheduling was successfully configured. If the input
2695
+ is invalid, a `CLIOrionisValueError` is raised and the trigger is not set.
2696
+
2697
+ Raises
2698
+ ------
2699
+ CLIOrionisValueError
2700
+ If `hour`, `minute`, or `second` are not integers within the valid ranges.
2701
+
2702
+ Notes
2703
+ -----
2704
+ The event will be triggered once per day at the specified time, within the optional
2705
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
2706
+ is set, it will be applied to the trigger.
2707
+ """
2708
+
2709
+ # Validate that hour, minute, and second are integers.
2710
+ if not isinstance(hour, int) or not isinstance(minute, int) or not isinstance(second, int):
2711
+ raise CLIOrionisValueError("Hour, minute, and second must be integers.")
2712
+
2713
+ # Validate that hour is within valid range.
2714
+ if not (0 <= hour < 24):
2715
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
2716
+
2717
+ # Validate that minute and second are within valid ranges.
2718
+ if not (0 <= minute < 60):
2719
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
2720
+ if not (0 <= second < 60):
2721
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
2722
+
2723
+ # Set up the trigger to execute the event daily at the specified time.
2724
+ # The IntervalTrigger will fire every day at the given hour, minute, and second.
2725
+ self.__trigger = IntervalTrigger(
2726
+ days=1,
2727
+ hour=hour,
2728
+ minute=minute,
2729
+ second=second,
2730
+ start_date=self.__start_date,
2731
+ end_date=self.__end_date
2732
+ )
2733
+
2734
+ # Store a human-readable description of the schedule.
2735
+ self.__details = f"Every day at {hour:02d}:{minute:02d}:{second:02d}"
2736
+
2737
+ # Indicate that the scheduling was successful.
2738
+ return True
2739
+
2740
+ def everyDays(
2741
+ self,
2742
+ days: int
2743
+ ) -> bool:
2744
+ """
2745
+ Schedule the event to run at fixed intervals measured in days.
2746
+
2747
+ This method configures the event to execute repeatedly at a specified interval
2748
+ (in days). The interval must be a positive integer. Optionally, the event can be
2749
+ restricted to a time window using previously set `start_date` and `end_date`.
2750
+ If a random delay (jitter) has been configured, it will be applied to the trigger.
2751
+
2752
+ Parameters
2753
+ ----------
2754
+ days : int
2755
+ The interval, in days, at which the event should be executed. Must be a positive integer.
2756
+
2757
+ Returns
2758
+ -------
2759
+ bool
2760
+ Returns True if the interval scheduling was successfully configured. If the input
2761
+ is invalid, a `CLIOrionisValueError` is raised and the trigger is not set.
2762
+
2763
+ Raises
2764
+ ------
2765
+ CLIOrionisValueError
2766
+ If `days` is not a positive integer.
2767
+
2768
+ Notes
2769
+ -----
2770
+ The event will be triggered every `days` days, starting from the configured
2771
+ `start_date` (if set) and ending at `end_date` (if set). If a random delay (jitter)
2772
+ is set, it will be applied to the trigger.
2773
+ """
2774
+
2775
+ # Validate that the days parameter is a positive integer.
2776
+ if not isinstance(days, int) or days <= 0:
2777
+ raise CLIOrionisValueError("The interval must be a positive integer.")
2778
+
2779
+ # Configure the trigger to execute the event at the specified interval,
2780
+ # using any previously set start_date, end_date, and random_delay (jitter).
2781
+ self.__trigger = IntervalTrigger(
2782
+ days=days,
2783
+ start_date=self.__start_date, # Restrict the schedule start if set
2784
+ end_date=self.__end_date, # Restrict the schedule end if set
2785
+ jitter=self.__random_delay # Apply random delay if configured
2786
+ )
2787
+
2788
+ # Store a human-readable description of the schedule.
2789
+ self.__details = f"Every {days} days"
2790
+
2791
+ # Indicate that the scheduling was successful.
2792
+ return True
2793
+
2794
+ def everyDaysAt(
2795
+ self,
2796
+ days: int,
2797
+ hour: int,
2798
+ minute: int = 0,
2799
+ second: int = 0
2800
+ ) -> bool:
2801
+ """
2802
+ Schedule the event to run every day at a specific hour, minute, and second.
2803
+
2804
+ This method configures the event to execute once per day at the specified
2805
+ hour, minute, and second. The schedule can be further restricted by previously
2806
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
2807
+ configured, it will be applied to the trigger to help distribute load or avoid
2808
+ collisions.
2809
+
2810
+ Parameters
2811
+ ----------
2812
+ hour : int
2813
+ The hour of the day when the event should run. Must be in the range [0, 23].
2814
+ minute : int, optional
2815
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
2816
+ second : int, optional
2817
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
2818
+
2819
+ Returns
2820
+ -------
2821
+ bool
2822
+ Returns True if the scheduling was successfully configured. If the input
2823
+ is invalid, a `CLIOrionisValueError` is raised and the trigger is not set.
2824
+ On success, returns True.
2825
+
2826
+ Raises
2827
+ ------
2828
+ CLIOrionisValueError
2829
+ If `hour`, `minute`, or `second` are not integers within the valid ranges.
2830
+
2831
+ Notes
2832
+ -----
2833
+ The event will be triggered once per day at the specified time, within the optional
2834
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
2835
+ is set, it will be applied to the trigger.
2836
+ """
2837
+
2838
+ # Validate that the days parameter is a positive integer.
2839
+ if not isinstance(days, int) or days <= 0:
2840
+ raise CLIOrionisValueError("The interval must be a positive integer.")
2841
+
2842
+ # Validate that hour, minute, and second are integers.
2843
+ if not isinstance(hour, int) or not isinstance(minute, int) or not isinstance(second, int):
2844
+ raise CLIOrionisValueError("Hour, minute, and second must be integers.")
2845
+
2846
+ # Validate that hour is within the valid range [0, 23].
2847
+ if not (0 <= hour < 24):
2848
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
2849
+
2850
+ # Validate that minute and second are within the valid range [0, 59].
2851
+ if not (0 <= minute < 60):
2852
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
2853
+ if not (0 <= second < 60):
2854
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
2855
+
2856
+ # Set up the trigger to execute the event daily at the specified time.
2857
+ # The IntervalTrigger will fire every day at the given hour, minute, and second.
2858
+ self.__trigger = IntervalTrigger(
2859
+ days=1,
2860
+ hour=hour,
2861
+ minute=minute,
2862
+ second=second,
2863
+ start_date=self.__start_date,
2864
+ end_date=self.__end_date
2865
+ )
2866
+
2867
+ # Store a human-readable description of the schedule.
2868
+ self.__details = f"Every day at {hour:02d}:{minute:02d}:{second:02d}"
2869
+
2870
+ # Indicate that the scheduling was successful.
2871
+ return True
2872
+
2873
+ def everyTwoDays(
2874
+ self
2875
+ ) -> bool:
2876
+ """
2877
+ Schedule the event to run every two days.
2878
+
2879
+ This method configures the event to execute at a fixed interval of two days using an
2880
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
2881
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2882
+ it will be applied to the trigger.
2883
+
2884
+ Returns
2885
+ -------
2886
+ bool
2887
+ True if the scheduling was successfully configured. The method always returns True
2888
+ after delegating the scheduling to `everyDays`.
2889
+ """
2890
+
2891
+ # Delegate the scheduling to the `everyDays` method with an interval of 2 days.
2892
+ return self.everyDays(2)
2893
+
2894
+ def everyTwoDaysAt(
2895
+ self,
2896
+ hour: int,
2897
+ minute: int = 0,
2898
+ second: int = 0
2899
+ ) -> bool:
2900
+ """
2901
+ Schedule the event to run every two days at a specific hour, minute, and second.
2902
+
2903
+ This method configures the event to execute every two days at the specified
2904
+ hour, minute, and second. The schedule can be further restricted by previously
2905
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
2906
+ configured, it will be applied to the trigger.
2907
+
2908
+ Parameters
2909
+ ----------
2910
+ hour : int
2911
+ The hour of the day when the event should run. Must be in the range [0, 23].
2912
+ minute : int, optional
2913
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2914
+ Default is 0.
2915
+ second : int, optional
2916
+ The second of the minute when the event should run. Must be in the range [0, 59].
2917
+ Default is 0.
2918
+
2919
+ Returns
2920
+ -------
2921
+ bool
2922
+ True if the scheduling was successfully configured. If the input is invalid,
2923
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2924
+
2925
+ Notes
2926
+ -----
2927
+ The event will be triggered every two days at the specified time, within the optional
2928
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
2929
+ is set, it will be applied to the trigger.
2930
+ """
2931
+
2932
+ # Delegate scheduling to the everyDaysAt method with an interval of 2 days
2933
+ # and the specified hour, minute, and second.
2934
+ return self.everyDaysAt(2, hour, minute, second)
2935
+
2936
+ def everyThreeDays(
2937
+ self
2938
+ ) -> bool:
2939
+ """
2940
+ Schedule the event to run every three days.
2941
+
2942
+ This method configures the event to execute at a fixed interval of three days using the
2943
+ `everyDays` method. The scheduling window can be further restricted by previously set
2944
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
2945
+ it will be applied to the trigger.
2946
+
2947
+ Parameters
2948
+ ----------
2949
+ None
2950
+
2951
+ Returns
2952
+ -------
2953
+ bool
2954
+ Returns True if the scheduling was successfully configured. The method always
2955
+ returns True after delegating the scheduling to `everyDays`.
2956
+
2957
+ Notes
2958
+ -----
2959
+ The event will be triggered every three days, starting from the configured `start_date`
2960
+ (if set) and ending at `end_date` (if set). If a random delay (jitter) is set, it will
2961
+ be applied to the trigger.
2962
+ """
2963
+
2964
+ # Delegate the scheduling to the `everyDays` method with an interval of 3 days.
2965
+ return self.everyDays(3)
2966
+
2967
+ def everyThreeDaysAt(
2968
+ self,
2969
+ hour: int,
2970
+ minute: int = 0,
2971
+ second: int = 0
2972
+ ) -> bool:
2973
+ """
2974
+ Schedule the event to run every three days at a specific hour, minute, and second.
2975
+
2976
+ This method configures the event to execute every three days at the specified
2977
+ hour, minute, and second. The schedule can be further restricted by previously
2978
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
2979
+ configured, it will be applied to the trigger.
2980
+
2981
+ Parameters
2982
+ ----------
2983
+ hour : int
2984
+ The hour of the day when the event should run. Must be in the range [0, 23].
2985
+ minute : int, optional
2986
+ The minute of the hour when the event should run. Must be in the range [0, 59].
2987
+ Default is 0.
2988
+ second : int, optional
2989
+ The second of the minute when the event should run. Must be in the range [0, 59].
2990
+ Default is 0.
2991
+
2992
+ Returns
2993
+ -------
2994
+ bool
2995
+ Returns True if the scheduling was successfully configured. If the input is invalid,
2996
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
2997
+
2998
+ Notes
2999
+ -----
3000
+ The event will be triggered every three days at the specified time, within the optional
3001
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3002
+ is set, it will be applied to the trigger.
3003
+ """
3004
+
3005
+ # Delegate scheduling to the everyDaysAt method with an interval of 3 days
3006
+ # and the specified hour, minute, and second.
3007
+ return self.everyDaysAt(3, hour, minute, second)
3008
+
3009
+ def everyFourDays(
3010
+ self
3011
+ ) -> bool:
3012
+ """
3013
+ Schedule the event to run every four days.
3014
+
3015
+ This method configures the event to execute at a fixed interval of four days using the
3016
+ `everyDays` method. The scheduling window can be further restricted by previously set
3017
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3018
+ it will be applied to the trigger.
3019
+
3020
+ Returns
3021
+ -------
3022
+ bool
3023
+ True if the scheduling was successfully configured. The method always returns True
3024
+ after delegating the scheduling to `everyDays`.
3025
+
3026
+ Notes
3027
+ -----
3028
+ The event will be triggered every four days, starting from the configured `start_date`
3029
+ (if set) and ending at `end_date` (if set). If a random delay (jitter) is set, it will
3030
+ be applied to the trigger.
3031
+ """
3032
+
3033
+ # Delegate the scheduling to the `everyDays` method with an interval of 4 days.
3034
+ return self.everyDays(4)
3035
+
3036
+ def everyFourDaysAt(
3037
+ self,
3038
+ hour: int,
3039
+ minute: int = 0,
3040
+ second: int = 0
3041
+ ) -> bool:
3042
+ """
3043
+ Schedule the event to run every four days at a specific hour, minute, and second.
3044
+
3045
+ This method configures the event to execute every four days at the specified
3046
+ hour, minute, and second. The schedule can be further restricted by previously
3047
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
3048
+ configured, it will be applied to the trigger.
3049
+
3050
+ Parameters
3051
+ ----------
3052
+ hour : int
3053
+ The hour of the day when the event should run. Must be in the range [0, 23].
3054
+ minute : int, optional
3055
+ The minute of the hour when the event should run. Must be in the range [0, 59].
3056
+ Default is 0.
3057
+ second : int, optional
3058
+ The second of the minute when the event should run. Must be in the range [0, 59].
3059
+ Default is 0.
3060
+
3061
+ Returns
3062
+ -------
3063
+ bool
3064
+ Returns True if the scheduling was successfully configured. If the input is invalid,
3065
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3066
+
3067
+ Notes
3068
+ -----
3069
+ The event will be triggered every four days at the specified time, within the optional
3070
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3071
+ is set, it will be applied to the trigger.
3072
+ """
3073
+
3074
+ # Delegate scheduling to the everyDaysAt method with an interval of 4 days
3075
+ # and the specified hour, minute, and second.
3076
+ return self.everyDaysAt(4, hour, minute, second)
3077
+
3078
+ def everyFiveDays(
3079
+ self
3080
+ ) -> bool:
3081
+ """
3082
+ Schedule the event to run every five days.
3083
+
3084
+ This method configures the event to execute at a fixed interval of five days using the
3085
+ `everyDays` method. The scheduling window can be further restricted by previously set
3086
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3087
+ it will be applied to the trigger.
3088
+
3089
+ Returns
3090
+ -------
3091
+ bool
3092
+ True if the scheduling was successfully configured. The method always returns True
3093
+ after delegating the scheduling to `everyDays`.
3094
+
3095
+ Notes
3096
+ -----
3097
+ The event will be triggered every five days, starting from the configured `start_date`
3098
+ (if set) and ending at `end_date` (if set). If a random delay (jitter) is set, it will
3099
+ be applied to the trigger.
3100
+ """
3101
+
3102
+ # Delegate the scheduling to the `everyDays` method with an interval of 5 days.
3103
+ return self.everyDays(5)
3104
+
3105
+ def everyFiveDaysAt(
3106
+ self,
3107
+ hour: int,
3108
+ minute: int = 0,
3109
+ second: int = 0
3110
+ ) -> bool:
3111
+ """
3112
+ Schedule the event to run every five days at a specific hour, minute, and second.
3113
+
3114
+ This method configures the event to execute every five days at the specified
3115
+ hour, minute, and second. The schedule can be further restricted by previously
3116
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
3117
+ configured, it will be applied to the trigger.
3118
+
3119
+ Parameters
3120
+ ----------
3121
+ hour : int
3122
+ The hour of the day when the event should run. Must be in the range [0, 23].
3123
+ minute : int, optional
3124
+ The minute of the hour when the event should run. Must be in the range [0, 59].
3125
+ Default is 0.
3126
+ second : int, optional
3127
+ The second of the minute when the event should run. Must be in the range [0, 59].
3128
+ Default is 0.
3129
+
3130
+ Returns
3131
+ -------
3132
+ bool
3133
+ Returns True if the scheduling was successfully configured. If the input is invalid,
3134
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3135
+
3136
+ Notes
3137
+ -----
3138
+ The event will be triggered every five days at the specified time, within the optional
3139
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3140
+ is set, it will be applied to the trigger.
3141
+ """
3142
+
3143
+ # Delegate scheduling to the everyDaysAt method with an interval of 5 days
3144
+ # and the specified hour, minute, and second.
3145
+ return self.everyDaysAt(5, hour, minute, second)
3146
+
3147
+ def everySixDays(
3148
+ self
3149
+ ) -> bool:
3150
+ """
3151
+ Schedule the event to run every six days.
3152
+
3153
+ This method configures the event to execute at a fixed interval of six days using the
3154
+ `everyDays` method. The scheduling window can be further restricted by previously set
3155
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3156
+ it will be applied to the trigger.
3157
+
3158
+ Returns
3159
+ -------
3160
+ bool
3161
+ True if the scheduling was successfully configured. The method always returns True
3162
+ after delegating the scheduling to `everyDays`.
3163
+
3164
+ Notes
3165
+ -----
3166
+ The event will be triggered every six days, starting from the configured `start_date`
3167
+ (if set) and ending at `end_date` (if set). If a random delay (jitter) is set, it will
3168
+ be applied to the trigger.
3169
+ """
3170
+
3171
+ # Delegate the scheduling to the `everyDays` method with an interval of 6 days.
3172
+ return self.everyDays(6)
3173
+
3174
+ def everySixDaysAt(
3175
+ self,
3176
+ hour: int,
3177
+ minute: int = 0,
3178
+ second: int = 0
3179
+ ) -> bool:
3180
+ """
3181
+ Schedule the event to run every six days at a specific hour, minute, and second.
3182
+
3183
+ This method configures the event to execute every six days at the specified
3184
+ hour, minute, and second. The schedule can be further restricted by previously
3185
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
3186
+ configured, it will be applied to the trigger.
3187
+
3188
+ Parameters
3189
+ ----------
3190
+ hour : int
3191
+ The hour of the day when the event should run. Must be in the range [0, 23].
3192
+ minute : int, optional
3193
+ The minute of the hour when the event should run. Must be in the range [0, 59].
3194
+ Default is 0.
3195
+ second : int, optional
3196
+ The second of the minute when the event should run. Must be in the range [0, 59].
3197
+ Default is 0.
3198
+
3199
+ Returns
3200
+ -------
3201
+ bool
3202
+ Returns True if the scheduling was successfully configured. If the input is invalid,
3203
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3204
+
3205
+ Notes
3206
+ -----
3207
+ The event will be triggered every six days at the specified time, within the optional
3208
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3209
+ is set, it will be applied to the trigger.
3210
+ """
3211
+
3212
+ # Delegate scheduling to the everyDaysAt method with an interval of 6 days
3213
+ # and the specified hour, minute, and second.
3214
+ return self.everyDaysAt(6, hour, minute, second)
3215
+
3216
+ def everySevenDays(
3217
+ self
3218
+ ) -> bool:
3219
+ """
3220
+ Schedule the event to run every seven days.
3221
+
3222
+ This method configures the event to execute at a fixed interval of seven days using the
3223
+ `everyDays` method. The scheduling window can be further restricted by previously set
3224
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3225
+ it will be applied to the trigger.
3226
+
3227
+ Returns
3228
+ -------
3229
+ bool
3230
+ True if the scheduling was successfully configured. The method always returns True
3231
+ after delegating the scheduling to `everyDays`.
3232
+
3233
+ Notes
3234
+ -----
3235
+ The event will be triggered every seven days, starting from the configured `start_date`
3236
+ (if set) and ending at `end_date` (if set). If a random delay (jitter) is set, it will
3237
+ be applied to the trigger.
3238
+ """
3239
+
3240
+ # Delegate the scheduling to the `everyDays` method with an interval of 7 days.
3241
+ return self.everyDays(7)
3242
+
3243
+ def everySevenDaysAt(
3244
+ self,
3245
+ hour: int,
3246
+ minute: int = 0,
3247
+ second: int = 0
3248
+ ) -> bool:
3249
+ """
3250
+ Schedule the event to run every seven days at a specific hour, minute, and second.
3251
+
3252
+ This method configures the event to execute every seven days at the specified
3253
+ hour, minute, and second. The schedule can be further restricted by previously
3254
+ set `start_date` and `end_date` attributes. If a random delay (jitter) has been
3255
+ configured, it will be applied to the trigger.
3256
+
3257
+ Parameters
3258
+ ----------
3259
+ hour : int
3260
+ The hour of the day when the event should run. Must be in the range [0, 23].
3261
+ minute : int, optional
3262
+ The minute of the hour when the event should run. Must be in the range [0, 59].
3263
+ Default is 0.
3264
+ second : int, optional
3265
+ The second of the minute when the event should run. Must be in the range [0, 59].
3266
+ Default is 0.
3267
+
3268
+ Returns
3269
+ -------
3270
+ bool
3271
+ Returns True if the scheduling was successfully configured. If the input is invalid,
3272
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3273
+
3274
+ Notes
3275
+ -----
3276
+ The event will be triggered every seven days at the specified time, within the optional
3277
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3278
+ is set, it will be applied to the trigger.
3279
+ """
3280
+
3281
+ # Delegate scheduling to the everyDaysAt method with an interval of 7 days
3282
+ # and the specified hour, minute, and second.
3283
+ return self.everyDaysAt(7, hour, minute, second)
3284
+
3285
+ def everyMondayAt(
3286
+ self,
3287
+ hour: int = 0,
3288
+ minute: int = 0,
3289
+ second: int = 0
3290
+ ) -> bool:
3291
+ """
3292
+ Schedule the event to run every Monday at a specific hour, minute, and second.
3293
+
3294
+ This method configures the event to execute once every week on Mondays at the specified
3295
+ hour, minute, and second. The schedule can be further restricted by previously set
3296
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3297
+ it will be applied to the trigger.
3298
+
3299
+ Parameters
3300
+ ----------
3301
+ hour : int, optional
3302
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3303
+ minute : int, optional
3304
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3305
+ second : int, optional
3306
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3307
+
3308
+ Returns
3309
+ -------
3310
+ bool
3311
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3312
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3313
+
3314
+ Raises
3315
+ ------
3316
+ CLIOrionisValueError
3317
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3318
+
3319
+ Notes
3320
+ -----
3321
+ The event will be triggered every Monday at the specified time, within the optional
3322
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3323
+ is set, it will be applied to the trigger.
3324
+ """
3325
+
3326
+ # Validate that the hour is within the valid range [0, 23].
3327
+ if not (0 <= hour < 24):
3328
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3329
+
3330
+ # Validate that the minute is within the valid range [0, 59].
3331
+ if not (0 <= minute < 60):
3332
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3333
+
3334
+ # Validate that the second is within the valid range [0, 59].
3335
+ if not (0 <= second < 60):
3336
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3337
+
3338
+ # Configure the trigger to execute the event every Monday at the specified hour, minute, and second.
3339
+ # The `CronTrigger` is used to specify the day of the week and time for the event.
3340
+ self.__trigger = CronTrigger(
3341
+ day_of_week='mon', # Schedule the event for Mondays.
3342
+ hour=hour, # Set the hour of execution.
3343
+ minute=minute, # Set the minute of execution.
3344
+ second=second, # Set the second of execution.
3345
+ start_date=self.__start_date, # Restrict the schedule start if set.
3346
+ end_date=self.__end_date, # Restrict the schedule end if set.
3347
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3348
+ )
3349
+
3350
+ # Store a human-readable description of the schedule.
3351
+ self.__details = f"Every Monday at {hour:02d}:{minute:02d}:{second:02d}"
3352
+
3353
+ # Indicate that the scheduling was successfully configured.
3354
+ return True
3355
+
3356
+ def everyTuesdayAt(
3357
+ self,
3358
+ hour: int = 0,
3359
+ minute: int = 0,
3360
+ second: int = 0
3361
+ ) -> bool:
3362
+ """
3363
+ Schedule the event to run every Tuesday at a specific hour, minute, and second.
3364
+
3365
+ This method configures the event to execute once every week on Tuesdays at the specified
3366
+ hour, minute, and second. The schedule can be further restricted by previously set
3367
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3368
+ it will be applied to the trigger.
3369
+
3370
+ Parameters
3371
+ ----------
3372
+ hour : int, optional
3373
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3374
+ minute : int, optional
3375
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3376
+ second : int, optional
3377
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3378
+
3379
+ Returns
3380
+ -------
3381
+ bool
3382
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3383
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3384
+
3385
+ Raises
3386
+ ------
3387
+ CLIOrionisValueError
3388
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3389
+
3390
+ Notes
3391
+ -----
3392
+ The event will be triggered every Tuesday at the specified time, within the optional
3393
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3394
+ is set, it will be applied to the trigger.
3395
+ """
3396
+
3397
+ # Validate that the hour is within the valid range [0, 23].
3398
+ if not (0 <= hour < 24):
3399
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3400
+
3401
+ # Validate that the minute is within the valid range [0, 59].
3402
+ if not (0 <= minute < 60):
3403
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3404
+
3405
+ # Validate that the second is within the valid range [0, 59].
3406
+ if not (0 <= second < 60):
3407
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3408
+
3409
+ # Configure the trigger to execute the event every Tuesday at the specified hour, minute, and second.
3410
+ self.__trigger = CronTrigger(
3411
+ day_of_week='tue', # Schedule the event for Tuesdays.
3412
+ hour=hour, # Set the hour of execution.
3413
+ minute=minute, # Set the minute of execution.
3414
+ second=second, # Set the second of execution.
3415
+ start_date=self.__start_date, # Restrict the schedule start if set.
3416
+ end_date=self.__end_date, # Restrict the schedule end if set.
3417
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3418
+ )
3419
+
3420
+ # Store a human-readable description of the schedule.
3421
+ self.__details = f"Every Tuesday at {hour:02d}:{minute:02d}:{second:02d}"
3422
+
3423
+ # Indicate that the scheduling was successfully configured.
3424
+ return True
3425
+
3426
+ def everyWednesdayAt(
3427
+ self,
3428
+ hour: int = 0,
3429
+ minute: int = 0,
3430
+ second: int = 0
3431
+ ) -> bool:
3432
+ """
3433
+ Schedule the event to run every Wednesday at a specific hour, minute, and second.
3434
+
3435
+ This method configures the event to execute once every week on Wednesdays at the specified
3436
+ hour, minute, and second. The schedule can be further restricted by previously set
3437
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3438
+ it will be applied to the trigger.
3439
+
3440
+ Parameters
3441
+ ----------
3442
+ hour : int, optional
3443
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3444
+ minute : int, optional
3445
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3446
+ second : int, optional
3447
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3448
+
3449
+ Returns
3450
+ -------
3451
+ bool
3452
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3453
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3454
+
3455
+ Raises
3456
+ ------
3457
+ CLIOrionisValueError
3458
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3459
+
3460
+ Notes
3461
+ -----
3462
+ The event will be triggered every Wednesday at the specified time, within the optional
3463
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3464
+ is set, it will be applied to the trigger.
3465
+ """
3466
+
3467
+ # Validate that the hour is within the valid range [0, 23].
3468
+ if not (0 <= hour < 24):
3469
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3470
+
3471
+ # Validate that the minute is within the valid range [0, 59].
3472
+ if not (0 <= minute < 60):
3473
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3474
+
3475
+ # Validate that the second is within the valid range [0, 59].
3476
+ if not (0 <= second < 60):
3477
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3478
+
3479
+ # Configure the trigger to execute the event every Wednesday at the specified hour, minute, and second.
3480
+ self.__trigger = CronTrigger(
3481
+ day_of_week='wed', # Schedule the event for Wednesdays.
3482
+ hour=hour, # Set the hour of execution.
3483
+ minute=minute, # Set the minute of execution.
3484
+ second=second, # Set the second of execution.
3485
+ start_date=self.__start_date, # Restrict the schedule start if set.
3486
+ end_date=self.__end_date, # Restrict the schedule end if set.
3487
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3488
+ )
3489
+
3490
+ # Store a human-readable description of the schedule.
3491
+ self.__details = f"Every Wednesday at {hour:02d}:{minute:02d}:{second:02d}"
3492
+
3493
+ # Indicate that the scheduling was successfully configured.
3494
+ return True
3495
+
3496
+ def everyThursdayAt(
3497
+ self,
3498
+ hour: int = 0,
3499
+ minute: int = 0,
3500
+ second: int = 0
3501
+ ) -> bool:
3502
+ """
3503
+ Schedule the event to run every Thursday at a specific hour, minute, and second.
3504
+
3505
+ This method configures the event to execute once every week on Thursdays at the specified
3506
+ hour, minute, and second. The schedule can be further restricted by previously set
3507
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3508
+ it will be applied to the trigger.
3509
+
3510
+ Parameters
3511
+ ----------
3512
+ hour : int, optional
3513
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3514
+ minute : int, optional
3515
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3516
+ second : int, optional
3517
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3518
+
3519
+ Returns
3520
+ -------
3521
+ bool
3522
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3523
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3524
+
3525
+ Raises
3526
+ ------
3527
+ CLIOrionisValueError
3528
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3529
+
3530
+ Notes
3531
+ -----
3532
+ The event will be triggered every Thursday at the specified time, within the optional
3533
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3534
+ is set, it will be applied to the trigger.
3535
+ """
3536
+
3537
+ # Validate that the hour is within the valid range [0, 23].
3538
+ if not (0 <= hour < 24):
3539
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3540
+
3541
+ # Validate that the minute is within the valid range [0, 59].
3542
+ if not (0 <= minute < 60):
3543
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3544
+
3545
+ # Validate that the second is within the valid range [0, 59].
3546
+ if not (0 <= second < 60):
3547
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3548
+
3549
+ # Configure the trigger to execute the event every Thursday at the specified hour, minute, and second.
3550
+ self.__trigger = CronTrigger(
3551
+ day_of_week='thu', # Schedule the event for Thursdays.
3552
+ hour=hour, # Set the hour of execution.
3553
+ minute=minute, # Set the minute of execution.
3554
+ second=second, # Set the second of execution.
3555
+ start_date=self.__start_date, # Restrict the schedule start if set.
3556
+ end_date=self.__end_date, # Restrict the schedule end if set.
3557
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3558
+ )
3559
+
3560
+ # Store a human-readable description of the schedule.
3561
+ self.__details = f"Every Thursday at {hour:02d}:{minute:02d}:{second:02d}"
3562
+
3563
+ # Indicate that the scheduling was successfully configured.
3564
+ return True
3565
+
3566
+ def everyFridayAt(
3567
+ self,
3568
+ hour: int = 0,
3569
+ minute: int = 0,
3570
+ second: int = 0
3571
+ ) -> bool:
3572
+ """
3573
+ Schedule the event to run every Friday at a specific hour, minute, and second.
3574
+
3575
+ This method configures the event to execute once every week on Fridays at the specified
3576
+ hour, minute, and second. The schedule can be further restricted by previously set
3577
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3578
+ it will be applied to the trigger.
3579
+
3580
+ Parameters
3581
+ ----------
3582
+ hour : int, optional
3583
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3584
+ minute : int, optional
3585
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3586
+ second : int, optional
3587
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3588
+
3589
+ Returns
3590
+ -------
3591
+ bool
3592
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3593
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3594
+
3595
+ Raises
3596
+ ------
3597
+ CLIOrionisValueError
3598
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3599
+
3600
+ Notes
3601
+ -----
3602
+ The event will be triggered every Friday at the specified time, within the optional
3603
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3604
+ is set, it will be applied to the trigger.
3605
+ """
3606
+
3607
+ # Validate that the hour is within the valid range [0, 23].
3608
+ if not (0 <= hour < 24):
3609
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3610
+
3611
+ # Validate that the minute is within the valid range [0, 59].
3612
+ if not (0 <= minute < 60):
3613
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3614
+
3615
+ # Validate that the second is within the valid range [0, 59].
3616
+ if not (0 <= second < 60):
3617
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3618
+
3619
+ # Configure the trigger to execute the event every Friday at the specified hour, minute, and second.
3620
+ self.__trigger = CronTrigger(
3621
+ day_of_week='fri', # Schedule the event for Fridays.
3622
+ hour=hour, # Set the hour of execution.
3623
+ minute=minute, # Set the minute of execution.
3624
+ second=second, # Set the second of execution.
3625
+ start_date=self.__start_date, # Restrict the schedule start if set.
3626
+ end_date=self.__end_date, # Restrict the schedule end if set.
3627
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3628
+ )
3629
+
3630
+ # Store a human-readable description of the schedule.
3631
+ self.__details = f"Every Friday at {hour:02d}:{minute:02d}:{second:02d}"
3632
+
3633
+ # Indicate that the scheduling was successfully configured.
3634
+ return True
3635
+
3636
+ def everySaturdayAt(
3637
+ self,
3638
+ hour: int = 0,
3639
+ minute: int = 0,
3640
+ second: int = 0
3641
+ ) -> bool:
3642
+ """
3643
+ Schedule the event to run every Saturday at a specific hour, minute, and second.
3644
+
3645
+ This method configures the event to execute once every week on Saturdays at the specified
3646
+ hour, minute, and second. The schedule can be further restricted by previously set
3647
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3648
+ it will be applied to the trigger.
3649
+
3650
+ Parameters
3651
+ ----------
3652
+ hour : int, optional
3653
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3654
+ minute : int, optional
3655
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3656
+ second : int, optional
3657
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3658
+
3659
+ Returns
3660
+ -------
3661
+ bool
3662
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3663
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3664
+
3665
+ Raises
3666
+ ------
3667
+ CLIOrionisValueError
3668
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3669
+
3670
+ Notes
3671
+ -----
3672
+ The event will be triggered every Saturday at the specified time, within the optional
3673
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3674
+ is set, it will be applied to the trigger.
3675
+ """
3676
+
3677
+ # Validate that the hour is within the valid range [0, 23].
3678
+ if not (0 <= hour < 24):
3679
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3680
+
3681
+ # Validate that the minute is within the valid range [0, 59].
3682
+ if not (0 <= minute < 60):
3683
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3684
+
3685
+ # Validate that the second is within the valid range [0, 59].
3686
+ if not (0 <= second < 60):
3687
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3688
+
3689
+ # Configure the trigger to execute the event every Saturday at the specified hour, minute, and second.
3690
+ self.__trigger = CronTrigger(
3691
+ day_of_week='sat', # Schedule the event for Saturdays.
3692
+ hour=hour, # Set the hour of execution.
3693
+ minute=minute, # Set the minute of execution.
3694
+ second=second, # Set the second of execution.
3695
+ start_date=self.__start_date, # Restrict the schedule start if set.
3696
+ end_date=self.__end_date, # Restrict the schedule end if set.
3697
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3698
+ )
3699
+
3700
+ # Store a human-readable description of the schedule.
3701
+ self.__details = f"Every Saturday at {hour:02d}:{minute:02d}:{second:02d}"
3702
+
3703
+ # Indicate that the scheduling was successfully configured.
3704
+ return True
3705
+
3706
+ def everySundayAt(
3707
+ self,
3708
+ hour: int = 0,
3709
+ minute: int = 0,
3710
+ second: int = 0
3711
+ ) -> bool:
3712
+ """
3713
+ Schedule the event to run every Sunday at a specific hour, minute, and second.
3714
+
3715
+ This method configures the event to execute once every week on Sundays at the specified
3716
+ hour, minute, and second. The schedule can be further restricted by previously set
3717
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3718
+ it will be applied to the trigger.
3719
+
3720
+ Parameters
3721
+ ----------
3722
+ hour : int, optional
3723
+ The hour of the day when the event should run. Must be in the range [0, 23]. Default is 0.
3724
+ minute : int, optional
3725
+ The minute of the hour when the event should run. Must be in the range [0, 59]. Default is 0.
3726
+ second : int, optional
3727
+ The second of the minute when the event should run. Must be in the range [0, 59]. Default is 0.
3728
+
3729
+ Returns
3730
+ -------
3731
+ bool
3732
+ True if the scheduling was successfully configured. If the input parameters are invalid,
3733
+ a `CLIOrionisValueError` is raised, and the trigger is not set.
3734
+
3735
+ Raises
3736
+ ------
3737
+ CLIOrionisValueError
3738
+ If `hour`, `minute`, or `second` are not integers within their respective valid ranges.
3739
+
3740
+ Notes
3741
+ -----
3742
+ The event will be triggered every Sunday at the specified time, within the optional
3743
+ scheduling window defined by `start_date` and `end_date`. If a random delay (jitter)
3744
+ is set, it will be applied to the trigger.
3745
+ """
3746
+
3747
+ # Validate that the hour is within the valid range [0, 23].
3748
+ if not (0 <= hour < 24):
3749
+ raise CLIOrionisValueError("Hour must be between 0 and 23.")
3750
+
3751
+ # Validate that the minute is within the valid range [0, 59].
3752
+ if not (0 <= minute < 60):
3753
+ raise CLIOrionisValueError("Minute must be between 0 and 59.")
3754
+
3755
+ # Validate that the second is within the valid range [0, 59].
3756
+ if not (0 <= second < 60):
3757
+ raise CLIOrionisValueError("Second must be between 0 and 59.")
3758
+
3759
+ # Configure the trigger to execute the event every Sunday at the specified hour, minute, and second.
3760
+ self.__trigger = CronTrigger(
3761
+ day_of_week='sun', # Schedule the event for Sundays.
3762
+ hour=hour, # Set the hour of execution.
3763
+ minute=minute, # Set the minute of execution.
3764
+ second=second, # Set the second of execution.
3765
+ start_date=self.__start_date, # Restrict the schedule start if set.
3766
+ end_date=self.__end_date, # Restrict the schedule end if set.
3767
+ jitter=self.__random_delay # Apply random delay (jitter) if configured.
3768
+ )
3769
+
3770
+ # Store a human-readable description of the schedule.
3771
+ self.__details = f"Every Sunday at {hour:02d}:{minute:02d}:{second:02d}"
3772
+
3773
+ # Indicate that the scheduling was successfully configured.
3774
+ return True
3775
+
3776
+ def weekly(
3777
+ self
3778
+ ) -> bool:
3779
+ """
3780
+ Schedule the event to run every week.
3781
+
3782
+ This method configures the event to execute at a fixed interval of one week using an
3783
+ `IntervalTrigger`. The scheduling window can be further restricted by previously set
3784
+ `start_date` and `end_date` attributes. If a random delay (jitter) has been configured,
3785
+ it will be applied to the trigger to help distribute load or avoid collisions.
3786
+
3787
+ Returns
3788
+ -------
3789
+ bool
3790
+ Returns True after successfully configuring the interval trigger for weekly execution.
3791
+
3792
+ Notes
3793
+ -----
3794
+ The event will be triggered once every week, starting from the configured `start_date`
3795
+ (if set) and ending at `end_date` (if set). If a random delay (jitter) is set, it will
3796
+ be applied to the trigger.
3797
+ """
3798
+
3799
+ # Configure the trigger to execute the event every week using an IntervalTrigger.
3800
+ # Apply any configured start_date, end_date, and random_delay (jitter).
3801
+ self.__trigger = IntervalTrigger(
3802
+ weeks=1,
3803
+ start_date=self.__start_date, # Restrict the schedule start if set.
3804
+ end_date=self.__end_date, # Restrict the schedule end if set.
3805
+ jitter=self.__random_delay # Apply random delay if configured.
3806
+ )
3807
+
3808
+ # Store a human-readable description of the schedule for reference or logging.
3809
+ self.__details = "Every week"
3810
+
3811
+ # Indicate that the scheduling was successfully configured.
3812
+ return True
3813
+
3814
+ def everyWeeks(
3815
+ self,
3816
+ weeks: int
3817
+ ) -> bool:
3818
+ """
3819
+ Schedule the event to run at fixed intervals measured in weeks.
3820
+
3821
+ This method configures the event to execute repeatedly at a specified interval
3822
+ (in weeks). The interval must be a positive integer. Optionally, the event can
3823
+ be restricted to a time window using previously set `start_date` and `end_date`.
3824
+ If a random delay (jitter) has been configured, it will be applied to the trigger.
3825
+
3826
+ Parameters
3827
+ ----------
3828
+ weeks : int
3829
+ The interval, in weeks, at which the event should be executed. Must be a positive integer.
3830
+
3831
+ Returns
3832
+ -------
3833
+ bool
3834
+ True if the interval scheduling was successfully configured. If the input
3835
+ is invalid, a `CLIOrionisValueError` is raised, and the trigger is not set.
3836
+
3837
+ Raises
3838
+ ------
3839
+ CLIOrionisValueError
3840
+ If `weeks` is not a positive integer.
3841
+
3842
+ Notes
3843
+ -----
3844
+ The event will be triggered every `weeks` weeks, starting from the configured
3845
+ `start_date` (if set) and ending at `end_date` (if set). If a random delay (jitter)
3846
+ is set, it will be applied to the trigger.
3847
+ """
3848
+
3849
+ # Validate that the `weeks` parameter is a positive integer.
3850
+ if not isinstance(weeks, int) or weeks <= 0:
3851
+ raise CLIOrionisValueError("The interval must be a positive integer.")
3852
+
3853
+ # Configure the trigger to execute the event at the specified interval.
3854
+ # The `start_date` and `end_date` define the optional scheduling window.
3855
+ # The `jitter` adds a random delay if configured.
3856
+ self.__trigger = IntervalTrigger(
3857
+ weeks=weeks,
3858
+ start_date=self.__start_date,
3859
+ end_date=self.__end_date,
3860
+ jitter=self.__random_delay
3861
+ )
3862
+
3863
+ # Store a human-readable description of the schedule for reference or logging.
3864
+ self.__details = f"Every {weeks} week(s)"
3865
+
3866
+ # Indicate that the scheduling was successfully configured.
3867
+ return True
3868
+
3869
+ def every(
3870
+ self,
3871
+ weeks: int = 0,
3872
+ days: int = 0,
3873
+ hours: int = 0,
3874
+ minutes: int = 0,
3875
+ seconds: int = 0
3876
+ ) -> bool:
3877
+ """
3878
+ Schedule the event to run at fixed intervals specified in weeks, days, hours, minutes, and seconds.
3879
+
3880
+ This method configures the event to execute repeatedly at a specified interval
3881
+ composed of weeks, days, hours, minutes, and seconds. At least one of these parameters
3882
+ must be a positive integer. Optionally, the event can be restricted to a time window
3883
+ using previously set `start_date` and `end_date`. If a random delay (jitter) has been
3884
+ configured, it will be applied to the trigger.
3885
+
3886
+ Parameters
3887
+ ----------
3888
+ weeks : int, optional
3889
+ The interval in weeks. Must be a non-negative integer. Default is 0.
3890
+ days : int, optional
3891
+ The interval in days. Must be a non-negative integer. Default is 0.
3892
+ hours : int, optional
3893
+ The interval in hours. Must be a non-negative integer. Default is 0.
3894
+ minutes : int, optional
3895
+ The interval in minutes. Must be a non-negative integer. Default is 0.
3896
+ seconds : int, optional
3897
+ The interval in seconds. Must be a non-negative integer. Default is 0.
3898
+
3899
+ Returns
3900
+ -------
3901
+ bool
3902
+ True if the interval scheduling was successfully configured. If the input
3903
+ is invalid, a `CLIOrionisValueError` is raised, and the trigger is not set.
3904
+
3905
+ Raises
3906
+ ------
3907
+ CLIOrionisValueError
3908
+ If all parameters are zero or if any parameter is not a non-negative integer.
3909
+
3910
+ Notes
3911
+ -----
3912
+ The event will be triggered at the specified interval, starting from the configured
3913
+ `start_date` (if set) and ending at `end_date` (if set). If a random delay (jitter)
3914
+ is set, it will be applied to the trigger.
3915
+ """
3916
+
3917
+ # Validate that all parameters are integers and non-negative.
3918
+ for param_name, param_value in {
3919
+ 'weeks': weeks,
3920
+ 'days': days,
3921
+ 'hours': hours,
3922
+ 'minutes': minutes,
3923
+ 'seconds': seconds
3924
+ }.items():
3925
+ if not isinstance(param_value, int) or param_value < 0:
3926
+ raise CLIOrionisValueError(f"{param_name.capitalize()} must be a non-negative integer.")
3927
+
3928
+ # Ensure that at least one parameter is greater than zero to define a valid interval.
3929
+ if all(param == 0 for param in [weeks, days, hours, minutes, seconds]):
3930
+ raise CLIOrionisValueError("At least one interval parameter must be greater than zero.")
3931
+
3932
+ # Configure the trigger to execute the event at the specified interval.
3933
+ # The `start_date` and `end_date` define the optional scheduling window.
3934
+ self.__trigger = IntervalTrigger(
3935
+ weeks=weeks,
3936
+ days=days,
3937
+ hours=hours,
3938
+ minutes=minutes,
3939
+ seconds=seconds,
3940
+ start_date=self.__start_date,
3941
+ end_date=self.__end_date,
3942
+ jitter=self.__random_delay
3943
+ )
3944
+
3945
+ # Build a human-readable description of the schedule.
3946
+ interval_parts = []
3947
+ if weeks > 0:
3948
+ interval_parts.append(f"{weeks} week(s)")
3949
+ if days > 0:
3950
+ interval_parts.append(f"{days} day(s)")
3951
+ if hours > 0:
3952
+ interval_parts.append(f"{hours} hour(s)")
3953
+ if minutes > 0:
3954
+ interval_parts.append(f"{minutes} minute(s)")
3955
+ if seconds > 0:
3956
+ interval_parts.append(f"{seconds} second(s)")
3957
+ self.__details = "Every " + ", ".join(interval_parts)
3958
+
3959
+ # Indicate that the scheduling was successfully configured.
3960
+ return True
3961
+
3962
+ def cron(
3963
+ self,
3964
+ year: str | None = None,
3965
+ month: str | None = None,
3966
+ day: str | None = None,
3967
+ week: str | None = None,
3968
+ day_of_week: str | None = None,
3969
+ hour: str | None = None,
3970
+ minute: str | None = None,
3971
+ second: str | None = None,
3972
+ ) -> bool:
3973
+ """
3974
+ Schedule the event using a CRON-like expression.
3975
+
3976
+ This method configures the event to execute according to cron rules,
3977
+ allowing highly customizable schedules (e.g., every Monday at 8am).
3978
+
3979
+ Parameters
3980
+ ----------
3981
+ year, month, day, week, day_of_week, hour, minute, second : str | None
3982
+ Cron-like expressions defining when the job should run.
3983
+ Examples: "*/5" (every 5 units), "1-5" (range), "0,15,30,45" (list).
3984
+
3985
+ Returns
3986
+ -------
3987
+ bool
3988
+ True if the cron scheduling was successfully configured.
3989
+ """
3990
+
3991
+ # Validate that at least one field is provided
3992
+ if all(v is None for v in [year, month, day, week, day_of_week, hour, minute, second]):
3993
+ raise CLIOrionisValueError("At least one CRON parameter must be specified.")
3994
+
3995
+ self.__trigger = CronTrigger(
3996
+ year=year,
3997
+ month=month,
3998
+ day=day,
3999
+ week=week,
4000
+ day_of_week=day_of_week,
4001
+ hour=hour,
4002
+ minute=minute,
4003
+ second=second,
4004
+ start_date=self.__start_date,
4005
+ end_date=self.__end_date,
4006
+ jitter=self.__random_delay,
4007
+ )
4008
+
4009
+ # Build human-readable description
4010
+ parts = []
4011
+ if day_of_week: parts.append(f"on {day_of_week}")
4012
+ if hour is not None and minute is not None:
4013
+ parts.append(f"at {hour}:{minute.zfill(2)}")
4014
+ elif hour is not None:
4015
+ parts.append(f"at {hour}:00")
4016
+
4017
+ # Store a human-readable description of the schedule
4018
+ self.__details = "Cron schedule " + ", ".join(parts) if parts else "Custom CRON schedule"
4019
+
4020
+ # Indicate that the scheduling was successfully configured.
339
4021
  return True