# Path: rep0st/framework/execute.py
# def execute(order: float = 0) -> Any:
# 
#   def decorator(function: Any):
#     function.__execute__ = _ExecuteConfiguration(order)
#     return function
# 
#   return decorator
# 
# Path: rep0st/framework/signal_handler.py
# def on_shutdown() -> Any:
# 
#   def decorator(function: Any):
#     function.__on_shutdown__ = _OnShutdownConfiguration()
#     return function
# 
#   return decorator


import calendar
import ctypes
import datetime
import logging
import sched
import threading
from threading import Thread
from typing import Callable, List
from crontab import CronTab
from injector import Module, inject, singleton
from prometheus_client.metrics import Gauge
from rep0st.framework.execute import execute
from rep0st.framework.signal_handler import on_shutdown
    framework_scheduler_tasks_running_z.set_function(
        lambda: len(self.running_tasks))
    framework_scheduler_tasks_scheduled_z.set_function(
        lambda: len(self.scheduler.queue))
    framework_scheduler_exit_z.set_function(lambda: self.exit.is_set())

  def _get_utc_time(self) -> float:
    dts = datetime.datetime.utcnow()
    return calendar.timegm(dts.utctimetuple()) + dts.microsecond / 1e6

  def _run_task(self, schedule: _Schedule, fun: Callable[[], None]) -> None:
    log.debug(f'Executing job {fun.__module__}.{fun.__name__}')
    try:
      fun()
    except _SignalFinish:
      pass
    except:
      log.exception(f'Error executing job {fun.__name__}')
    finally:
      if not self.exit.is_set():
        if not schedule.should_loop():
          log.debug(f'Task {fun} will not be scheduled again')
        else:
          self._schedule_task(schedule, fun)
      self.running_tasks.remove(threading.current_thread())

  def _schedule_handler(self, schedule: _Schedule, fun: Callable[[],
                                                                 None]) -> None:
    thread = Thread(
        name=f'Job {fun.__module__}.{fun.__name__}',

# Path: rep0st/framework/execute.py
# def execute(order: float = 0) -> Any:
# 
#   def decorator(function: Any):
#     function.__execute__ = _ExecuteConfiguration(order)
#     return function
# 
#   return decorator
# 
# Path: rep0st/framework/signal_handler.py
# def on_shutdown() -> Any:
# 
#   def decorator(function: Any):
#     function.__on_shutdown__ = _OnShutdownConfiguration()
#     return function
# 
#   return decorator


# Path: rep0st/framework/scheduler.py
import calendar
import ctypes
import datetime
import logging
import sched
import threading
from threading import Thread
from typing import Callable, List
from crontab import CronTab
from injector import Module, inject, singleton
from prometheus_client.metrics import Gauge
from rep0st.framework.execute import execute
from rep0st.framework.signal_handler import on_shutdown

    framework_scheduler_tasks_running_z.set_function(
        lambda: len(self.running_tasks))
    framework_scheduler_tasks_scheduled_z.set_function(
        lambda: len(self.scheduler.queue))
    framework_scheduler_exit_z.set_function(lambda: self.exit.is_set())

  def _get_utc_time(self) -> float:
    dts = datetime.datetime.utcnow()
    return calendar.timegm(dts.utctimetuple()) + dts.microsecond / 1e6

  def _run_task(self, schedule: _Schedule, fun: Callable[[], None]) -> None:
    log.debug(f'Executing job {fun.__module__}.{fun.__name__}')
    try:
      fun()
    except _SignalFinish:
      pass
    except:
      log.exception(f'Error executing job {fun.__name__}')
    finally:
      if not self.exit.is_set():
        if not schedule.should_loop():
          log.debug(f'Task {fun} will not be scheduled again')
        else:
          self._schedule_task(schedule, fun)
      self.running_tasks.remove(threading.current_thread())

  def _schedule_handler(self, schedule: _Schedule, fun: Callable[[],
                                                                 None]) -> None:
    thread = Thread(
        name=f'Job {fun.__module__}.{fun.__name__}',

        target=self._run_task,