You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove deceptive boostrap argument.
* Allow customization of the APS scheduler.
* Go home VScode you're drunk.
* Allow customization of the APS scheduler.
* Go home VScode you're drunk.
* Remove some exploratory code.
* Test with lowewr interval, possibly change for the future.
:param cache_directory: Location of the cache directory. When unset, FCache will determine the location.
36
40
:param verbose_log_level: Numerical log level (https://docs.python.org/3/library/logging.html#logging-levels) for cases where checking a feature flag fails.
37
41
:param cache: Custom cache implementation that extends UnleashClient.cache.BaseCache. When unset, UnleashClient will use Fcache.
42
+
:param scheduler: Custom APScheduler object. Use this if you want to customize jobstore or executors. When unset, UnleashClient will create it's own scheduler.
43
+
:param scheduler_executor: Name of APSCheduler executor to use if using a custom scheduler.
38
44
"""
39
45
def__init__(self,
40
46
url: str,
@@ -53,7 +59,9 @@ def __init__(self,
53
59
cache_directory: Optional[str] =None,
54
60
project_name: str=None,
55
61
verbose_log_level: int=30,
56
-
cache: Optional[BaseCache] =None) ->None:
62
+
cache: Optional[BaseCache] =None,
63
+
scheduler: Optional[BaseScheduler] =None,
64
+
scheduler_executor: Optional[str] =None) ->None:
57
65
custom_headers=custom_headersor {}
58
66
custom_options=custom_optionsor {}
59
67
custom_strategies=custom_strategiesor {}
@@ -80,7 +88,6 @@ def __init__(self,
80
88
81
89
# Class objects
82
90
self.features: dict= {}
83
-
self.scheduler=BackgroundScheduler()
84
91
self.fl_job: Job=None
85
92
self.metric_job: Job=None
86
93
@@ -91,6 +98,27 @@ def __init__(self,
91
98
})
92
99
self.unleash_bootstrapped=self.cache.bootstrapped
93
100
101
+
# Scheduler bootstrapping
102
+
# - Figure out the Unleash executor name.
103
+
ifschedulerandscheduler_executor:
104
+
self.unleash_executor_name=scheduler_executor
105
+
elifschedulerandnotscheduler_executor:
106
+
raiseValueError("If using a custom scheduler, you must specify a executor.")
107
+
else:
108
+
ifnotscheduler:
109
+
LOGGER.warning("scheduler_executor should only be used with a custom scheduler.")
0 commit comments