orionis 0.518.0__py3-none-any.whl → 0.519.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.
@@ -289,7 +289,7 @@ class Scheduler(ISchedule):
289
289
  # Return the Event instance for further scheduling configuration
290
290
  return self.__events[signature]
291
291
 
292
- def __suscribeListeners(
292
+ def __subscribeListeners(
293
293
  self
294
294
  ) -> None:
295
295
  """
@@ -367,12 +367,16 @@ class Scheduler(ISchedule):
367
367
 
368
368
  # Ensure the listener is callable before invoking it
369
369
  if callable(listener):
370
- # If the listener is a coroutine, schedule it as an asyncio task
371
- if asyncio.iscoroutinefunction(listener):
372
- asyncio.create_task(listener(event_data, self))
373
- # Otherwise, invoke the listener directly as a regular function
374
- else:
375
- listener(event_data, self)
370
+ try:
371
+ # If the listener is a coroutine, schedule it as an asyncio task
372
+ if asyncio.iscoroutinefunction(listener):
373
+ asyncio.create_task(listener(event_data, self))
374
+ # Otherwise, invoke the listener directly as a regular function
375
+ else:
376
+ listener(event_data, self)
377
+ except Exception as e:
378
+ # Log any exceptions that occur during listener invocation
379
+ self.__logger.error(f"Error invoking global listener for event '{scheduler_event}': {str(e)}")
376
380
 
377
381
  def __taskCallableListener(
378
382
  self,
@@ -412,6 +416,10 @@ class Scheduler(ISchedule):
412
416
  if not isinstance(listening_vent, ListeningEvent):
413
417
  raise CLIOrionisValueError("The event must be an instance of ListeningEvent.")
414
418
 
419
+ # Validate that event_data is not None and has a job_id attribute
420
+ if event_data is None or not hasattr(event_data, 'job_id'):
421
+ return
422
+
415
423
  # Retrieve the global identifier for the event from the ListeningEvent enum
416
424
  scheduler_event = listening_vent.value
417
425
 
@@ -428,13 +436,17 @@ class Scheduler(ISchedule):
428
436
  if hasattr(listener, scheduler_event) and callable(getattr(listener, scheduler_event)):
429
437
  listener_method = getattr(listener, scheduler_event)
430
438
 
431
- # Invoke the listener method, handling both coroutine and regular functions
432
- if asyncio.iscoroutinefunction(listener_method):
433
- # Schedule the coroutine listener method as an asyncio task
434
- asyncio.create_task(listener_method(event_data, self))
435
- else:
436
- # Call the regular listener method directly
437
- listener_method(event_data, self)
439
+ try:
440
+ # Invoke the listener method, handling both coroutine and regular functions
441
+ if asyncio.iscoroutinefunction(listener_method):
442
+ # Schedule the coroutine listener method as an asyncio task
443
+ asyncio.create_task(listener_method(event_data, self))
444
+ else:
445
+ # Call the regular listener method directly
446
+ listener_method(event_data, self)
447
+ except Exception as e:
448
+ # Log any exceptions that occur during listener invocation
449
+ self.__logger.error(f"Error invoking listener method '{scheduler_event}' for job '{event_data.job_id}': {str(e)}")
438
450
 
439
451
  def __startedListener(
440
452
  self,
@@ -525,7 +537,7 @@ class Scheduler(ISchedule):
525
537
  # Log an informational message indicating that the scheduler has been paused
526
538
  self.__logger.info(message)
527
539
 
528
- # Check if a listener is registered for the scheduler started event
540
+ # Check if a listener is registered for the scheduler paused event
529
541
  self.__globalCallableListener(event, ListeningEvent.SCHEDULER_PAUSED)
530
542
 
531
543
  def __resumedListener(
@@ -562,7 +574,7 @@ class Scheduler(ISchedule):
562
574
  # Log an informational message indicating that the scheduler has resumed
563
575
  self.__logger.info(message)
564
576
 
565
- # Check if a listener is registered for the scheduler started event
577
+ # Check if a listener is registered for the scheduler resumed event
566
578
  self.__globalCallableListener(event, ListeningEvent.SCHEDULER_RESUMED)
567
579
 
568
580
  def __shutdownListener(
@@ -599,7 +611,7 @@ class Scheduler(ISchedule):
599
611
  # Log an informational message indicating that the scheduler has shut down
600
612
  self.__logger.info(message)
601
613
 
602
- # Check if a listener is registered for the scheduler started event
614
+ # Check if a listener is registered for the scheduler shutdown event
603
615
  self.__globalCallableListener(event, ListeningEvent.SCHEDULER_SHUTDOWN)
604
616
 
605
617
  def __errorListener(
@@ -879,11 +891,11 @@ class Scheduler(ISchedule):
879
891
  self.__jobs.append(entity)
880
892
 
881
893
  # Create a unique key for the job based on its signature
894
+ def create_job_func(cmd, args_list):
895
+ return lambda: self.__reactor.call(cmd, args_list)
896
+
882
897
  self.__scheduler.add_job(
883
- func= lambda command=signature, args=list(entity.args): self.__reactor.call(
884
- command,
885
- args
886
- ),
898
+ func=create_job_func(signature, list(entity.args)),
887
899
  trigger=entity.trigger,
888
900
  id=signature,
889
901
  name=signature,
@@ -1091,7 +1103,7 @@ class Scheduler(ISchedule):
1091
1103
  self.__loadEvents()
1092
1104
 
1093
1105
  # Subscribe to scheduler events for monitoring and handling
1094
- self.__suscribeListeners()
1106
+ self.__subscribeListeners()
1095
1107
 
1096
1108
  # Ensure we're in an asyncio context
1097
1109
  asyncio.get_running_loop()
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.518.0"
8
+ VERSION = "0.519.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.518.0
3
+ Version: 0.519.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -81,7 +81,7 @@ orionis/console/request/cli_request.py,sha256=7-sgYmNUCipuHLVAwWLJiHv0cJCDmsM1Lu
81
81
  orionis/console/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
82
  orionis/console/tasks/event.py,sha256=l4J-HEPaj1mxB_PYQMgG9dRHUe01wUag8fKLLnR2N2M,164395
83
83
  orionis/console/tasks/listener.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
- orionis/console/tasks/schedule.py,sha256=kKRqjy5IVRnVtFH_M1j_CXiRRP5GWlAtm6OFkMVuq5w,56567
84
+ orionis/console/tasks/schedule.py,sha256=pUU9583IfF4_SSR2QShOC9emYIRVZIw55L0I231OCzE,57354
85
85
  orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  orionis/container/container.py,sha256=aF_b6lTUpG4YCo9yFJEzsntTdIzgMMXFW5LyWqAJVBQ,87987
87
87
  orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -239,7 +239,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=72SoixFog9IOE9Ve9Xcfw6
239
239
  orionis/foundation/providers/testing_provider.py,sha256=SrJRpdvcblx9WvX7x9Y3zc7OQfiTf7la0HAJrm2ESlE,3725
240
240
  orionis/foundation/providers/workers_provider.py,sha256=oa_2NIDH6UxZrtuGkkoo_zEoNIMGgJ46vg5CCgAm7wI,3926
241
241
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
242
- orionis/metadata/framework.py,sha256=wug5g4rr99G557BnwMHazwC0CR8MPOjrfZhcyhWmfWo,4109
242
+ orionis/metadata/framework.py,sha256=VeR527XQrx3ObhbRQw5nqCi2-UqaggUmArNd_JGPPIw,4109
243
243
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
244
244
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
245
245
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -415,7 +415,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
415
415
  orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
416
416
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
417
417
  orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
418
- orionis-0.518.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
418
+ orionis-0.519.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
419
419
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
420
420
  tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
421
421
  tests/container/context/test_manager.py,sha256=wOwXpl9rHNfTTexa9GBKYMwK0_-KSQPbI-AEyGNkmAE,1356
@@ -561,8 +561,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
561
561
  tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
562
562
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
563
563
  tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
564
- orionis-0.518.0.dist-info/METADATA,sha256=57ipFsdsX4YY8wMWB_LqFKG5Y6eBUj8MkjFdM4WERuo,4801
565
- orionis-0.518.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
566
- orionis-0.518.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
567
- orionis-0.518.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
568
- orionis-0.518.0.dist-info/RECORD,,
564
+ orionis-0.519.0.dist-info/METADATA,sha256=XE_Lo42wgelgD9vBLaDtuWArC0hUaAI-nqGUiBTZvSs,4801
565
+ orionis-0.519.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
566
+ orionis-0.519.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
567
+ orionis-0.519.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
568
+ orionis-0.519.0.dist-info/RECORD,,