r4iּddlZddlZddlmZmZddlmZmZddlm Z ddl m Z m Z ddl m Z ddlmZddlmZmZdd lmZdd lmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'dd l(m)Z)m*Z*dd l+m,Z,dd l-m.Z.ddl/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6m7Z7ddl8m9Z9ddl:m;Z;mZ>m?Z?m@Z@mAZAdZBdZCdZDGddeZEy)N)ABCMetaabstractmethod)MappingMutableMapping) ExitStack)datetime timedelta) entry_points) getLogger) TIMEOUT_MAXRLock) get_localzone) EVENT_ALLEVENT_ALL_JOBS_REMOVEDEVENT_EXECUTOR_ADDEDEVENT_EXECUTOR_REMOVEDEVENT_JOB_ADDEDEVENT_JOB_MAX_INSTANCESEVENT_JOB_MODIFIEDEVENT_JOB_REMOVEDEVENT_JOB_SUBMITTEDEVENT_JOBSTORE_ADDEDEVENT_JOBSTORE_REMOVEDEVENT_SCHEDULER_PAUSEDEVENT_SCHEDULER_RESUMEDEVENT_SCHEDULER_SHUTDOWNEVENT_SCHEDULER_STARTEDJobEventJobSubmissionEventSchedulerEvent) BaseExecutorMaxInstancesReachedErrorThreadPoolExecutor)Job) BaseJobStoreConflictingIdErrorJobLookupErrorMemoryJobStore)SchedulerAlreadyRunningErrorSchedulerNotRunningError) BaseTrigger)asboolasint astimezone maybe_ref obj_to_ref ref_to_obj undefinedc eZdZdZdej cxkrdkrsnnpedDcic]}|j|c}}ZedDcic]}|j|c}}Z edDcic]}|j|c}}Z nledDcic]}|j|c}}ZedDcic]}|j|c}}Z edDcic]}|j|c}}Z iZ iZ iZ iffd Zd Zid fd Zd5d Zed6dZdZdZedZd7dZd6dZd7dZd6dZefdZdZdddddeeeeddd f dZ ddddeeeeddf dZ!d8dZ"d9dZ#d8dZ$d8dZ%d9d Z&d8d!Z'd8d"Z(d8d#Z)d9d$Z*d8d%Z+d7d&Z,ed'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3d.Z4d/Z5d0Z6d1Z7d2Z8d3Z9d4Z:xZ;Scc}}wcc}}wcc}}wcc}}wcc}}wcc}}w): BaseSchedulera Abstract base class for all schedulers. Takes the following keyword arguments: :param str|logging.Logger logger: logger to use for the scheduler's logging (defaults to apscheduler.scheduler) :param str|datetime.tzinfo timezone: the default time zone (defaults to the local timezone) :param int|float jobstore_retry_interval: the minimum number of seconds to wait between retries in the scheduler's main loop if the job store raises an exception when getting the list of due jobs :param dict job_defaults: default values for newly added jobs :param dict jobstores: a dictionary of job store alias -> job store instance or configuration dict :param dict executors: a dictionary of executor alias -> executor instance or configuration dict :ivar int state: current running state of the scheduler (one of the following constants from ``apscheduler.schedulers.base``: ``STATE_STOPPED``, ``STATE_RUNNING``, ``STATE_PAUSED``) .. seealso:: :ref:`scheduler-config` ))r9 zapscheduler.triggerszapscheduler.executorszapscheduler.jobstores)groupc t|i|_|j|_i|_|j|_g|_|j|_g|_ t|_ |j|fi|yN) super__init__ _executors _create_lock_executors_lock _jobstores_jobstores_lock _listeners_listeners_lock _pending_jobs STATE_STOPPEDstate configure)selfgconfigoptions __class__s g/mnt/ssd/data/python-lab/DaemonControl/venv/lib/python3.12/site-packages/apscheduler/schedulers/base.pyr@zBaseScheduler.__init__ssx #002#002#002" w*'*ctd)NzSchedulers cannot be serialized. Ensure that you are not passing a scheduler instance as an argument to a job, or scheduling an instance method where the instance contains a scheduler as an attribute.) TypeErrorrLs rP __getstate__zBaseScheduler.__getstate__s N  rQz apscheduler.c  |jtk7rtr.t t  fd|j D}i}|j D]V\}}|j d}|}|jd}|r&|j|i}|jd}|r&|||<X|j||j|y)a Reconfigures the scheduler with the given options. Can only be done when the scheduler isn't running. :param dict gconfig: a "global" configuration dictionary whose values can be overridden by keyword arguments to this method :param str|unicode prefix: pick only those keys from ``gconfig`` that are prefixed with this string (pass an empty string or ``None`` to use all keys) :raises SchedulerAlreadyRunningError: if the scheduler is already running c3TK|]\}}|jr |d|f!ywr>) startswith).0keyvalueprefix prefixlens rP z*BaseScheduler.configure..s4C>>&)YZ%(s%(.rN) rJrIr+lendictitemssplitpop setdefaultupdate _configure) rLrMr\rNconfigrZr[partsparentr]s ` @rPrKzBaseScheduler.configures :: &. . F I")--/G!--/ JCIIcNEF))A,C**33iil F3K   g rQFc|jtk7rt|j|j5d|j vr |j |jd|j jD]\}}|j|| ddd|j5d|jvr |j|jd|jjD]\}}|j|||jD]\}}}|j||||jdd=ddd|rt nt"|_|j$j'd|j)t+t,|s|j/yy#1swYxYw#1swYvxYw)af Start the configured executors and job stores and begin processing scheduled jobs. :param bool paused: if ``True``, don't start job processing until :meth:`resume` is called :raises SchedulerAlreadyRunningError: if the scheduler is already running :raises RuntimeError: if running under uWSGI with threads disabled defaultNzScheduler started)rJrIr+ _check_uwsgirCrA add_executor_create_default_executorrbstartrErD add_jobstore_create_default_jobstorerH _real_add_job STATE_PAUSED STATE_RUNNING_loggerinfo_dispatch_eventr rwakeup)rLpausedaliasexecutorstorejobjobstore_aliasreplace_existings rPrpzBaseScheduler.starts :: &. .   ! ! ,/!!$"?"?"A9M$(??#8#8#: ,xtU+ ,  , ! ! &/!!$"?"?"A9M!% 5 5 7 ) u D%( ):>9K9K J5^%5""38HI J""1% &&,\  -. ^,CDE KKM7 , , & &sA#F0.BF=0F:=Gc|jtk(rtt|_|j5|j5|j j D]}|j||jj D]}|j dddddd|jjd|jtty#1swYKxYw#1swYOxYw)a> Shuts down the scheduler, along with its executors and job stores. Does not interrupt any currently running jobs. :param bool wait: ``True`` to wait until all currently executing jobs have finished :raises SchedulerNotRunningError: if the scheduler has not been started yet NzScheduler has been shut down)rJrIr,rCrErAvaluesshutdownrDrvrwrxr r)rLwaitr|jobstores rPrzBaseScheduler.shutdowns :: &* *"  ! ! $4#7#7 $ OO224 (!!$' (!OO224 $!!# $  $ $ 89 ^,DEF $ $ $ $s# C5A C)C5)C2 .C55C>c|jtk(rt|jtk(rEt|_|j j d|jttyy)z Pause job processing in the scheduler. This will prevent the scheduler from waking up to do job processing until :meth:`resume` is called. It will not however stop any already running job processing. zPaused scheduler job processingN) rJrIr,rurtrvrwrxr rrTs rPpausezBaseScheduler.pausesU :: &* * ZZ= (%DJ LL  ? @  0F!G H)rQc|jtk(rt|jtk(rUt|_|j j d|jtt|jyy)z'Resume job processing in the scheduler.z Resumed scheduler job processingN) rJrIr,rtrurvrwrxr rryrTs rPresumezBaseScheduler.resumes\ :: &* * ZZ< '&DJ LL  @ A  0G!H I KKM (rQc(|jtk7S)z Return ``True`` if the scheduler has been started. This is a shortcut for ``scheduler.state != STATE_STOPPED``. )rJrIrTs rPrunningzBaseScheduler.runningszz]**rQrlc |j5||jvrtd|dt|tr||j|<nVt|t r#|j d||x|j|<}n#td|jjd|jtk7r|j||ddd|jtt|y#1swY)xYw)a Adds an executor to this scheduler. Any extra keyword arguments will be passed to the executor plugin's constructor, assuming that the first argument is the name of an executor plugin. :param str|unicode|apscheduler.executors.base.BaseExecutor executor: either an executor instance or the name of an executor plugin :param str|unicode alias: alias for the scheduler :raises ValueError: if there is already an executor by the given alias z8This scheduler already has an executor by the alias of ""r|z/Expected an executor instance or a string, got  insteadN)rCrA ValueError isinstancer!str_create_plugin_instancerSrO__name__rJrIrprxr r)rLr|r{ executor_optss rPrnzBaseScheduler.add_executors ! ! ,' NugUVW(L1)1&Hc*484P4P-5& EhFXFXFaFaEbbjk zz]*tU+' ,* ^,@%HI+ , ,s B9C..C7c|j5|j|}|j|=ddd|rj|j t t |y#1swY;xYw)z Removes the executor by the given alias from this scheduler. :param str|unicode alias: alias of the executor :param bool shutdown: ``True`` to shut down the executor after removing it N)rC_lookup_executorrArrxr r)rLr{rr|s rPremove_executorzBaseScheduler.remove_executor?se ! ! ',,U3H& '      ^,BEJK ' ' A&&A/c <|j5||jvrtd|dt|tr||j|<nVt|t r#|j d||x|j|<}n#td|jjd|jtk7r|j||ddd|jtt||jtk7r|j!yy#1swYMxYw)a Adds a job store to this scheduler. Any extra keyword arguments will be passed to the job store plugin's constructor, assuming that the first argument is the name of a job store plugin. :param str|unicode|apscheduler.jobstores.base.BaseJobStore jobstore: job store to be added :param str|unicode alias: alias for the job store :raises ValueError: if there is already a job store by the given alias z8This scheduler already has a job store by the alias of "rrz/Expected a job store instance or a string, got rN)rErDrrr&rrrSrOrrJrIrprxr rry)rLrr{ jobstore_optss rPrqzBaseScheduler.add_jobstoreQs  ! ! ,' NugUVW(L1)1&Hc*484P4P-5& EhFXFXFaFaEbbjk zz]*tU+' ,, ^,@%HI :: & KKM '3 , ,s B9DDc|j5|j|}|j|=ddd|rj|j t t |y#1swY;xYw)z Removes the job store by the given alias from this scheduler. :param str|unicode alias: alias of the job store :param bool shutdown: ``True`` to shut down the job store after removing it N)rE_lookup_jobstorerDrrxr r)rLr{rrs rPremove_jobstorezBaseScheduler.remove_jobstoreyse ! ! ',,U3H& '      ^,BEJK ' 'rc|j5|jj||fdddy#1swYyxYw)a: add_listener(callback, mask=EVENT_ALL) Adds a listener for scheduler events. When a matching event occurs, ``callback`` is executed with the event object as its sole argument. If the ``mask`` parameter is not provided, the callback will receive events of all types. :param callback: any callable that takes one argument :param int mask: bitmask that indicates which events should be listened to .. seealso:: :mod:`apscheduler.events` .. seealso:: :ref:`scheduler-events` N)rGrFappend)rLcallbackmasks rP add_listenerzBaseScheduler.add_listeners9$ ! ! 5 OO " "Hd#3 4 5 5 5s4=c|j5t|jD]\}\}}||k(s|j|= dddy#1swYyxYw)z*Removes a previously added event listener.N)rG enumeraterF)rLricb_s rPremove_listenerzBaseScheduler.remove_listenersU ! ! +'8 + 7Br>* + + + +s$A A  ANc |j||| || t|nd| t|ni||||| | d }td|jD}t |fi|}|j 5|j tk(r:|jj|| | f|jjdn|j|| | ddd|S#1swY|SxYw)a add_job(func, trigger=None, args=None, kwargs=None, id=None, name=None, misfire_grace_time=undefined, coalesce=undefined, max_instances=undefined, next_run_time=undefined, jobstore='default', executor='default', replace_existing=False, **trigger_args) Adds the given job to the job list and wakes up the scheduler if it's already running. Any option that defaults to ``undefined`` will be replaced with the corresponding default value when the job is scheduled (which happens when the scheduler is started, or immediately if the scheduler is already running). The ``func`` argument can be given either as a callable object or a textual reference in the ``package.module:some.object`` format, where the first half (separated by ``:``) is an importable module and the second half is a reference to the callable object, relative to the module. The ``trigger`` argument can either be: #. the alias name of the trigger (e.g. ``date``, ``interval`` or ``cron``), in which case any extra keyword arguments to this method are passed on to the trigger's constructor #. an instance of a trigger class :param func: callable (or a textual reference to one) to run at the given time :param str|apscheduler.triggers.base.BaseTrigger trigger: trigger that determines when ``func`` is called :param list|tuple args: list of positional arguments to call func with :param dict kwargs: dict of keyword arguments to call func with :param str|unicode id: explicit identifier for the job (for modifying it later) :param str|unicode name: textual description of the job :param int misfire_grace_time: seconds after the designated runtime that the job is still allowed to be run (or ``None`` to allow the job to run no matter how late it is) :param bool coalesce: run once instead of many times if the scheduler determines that the job should be run more than once in succession :param int max_instances: maximum number of concurrently running instances allowed for this job :param datetime next_run_time: when to first run the job, regardless of the trigger (pass ``None`` to add the job as paused) :param str|unicode jobstore: alias of the job store to store the job in :param str|unicode executor: alias of the executor to run the job with :param bool replace_existing: ``True`` to replace an existing job with the same ``id`` (but retain the number of runs from the existing one) :rtype: Job N) triggerr|funcargskwargsidnamemisfire_grace_timecoalesce max_instances next_run_timec3<K|]\}}|tus||fywr>)r4)rYrZr[s rPr^z(BaseScheduler.add_job..s$ 'S%iAWS%L s zQAdding job tentatively -- it will be properly scheduled when the scheduler starts) _create_triggertuplerarbr%rErJrIrHrrvrwrs)rLrrrrrrrrrrrr|r trigger_args job_kwargsr~s rPadd_jobzBaseScheduler.add_jobs~++G\B #'#3E$K&,&8d6lb"4 **   +5+;+;+=  $%*% ! ! Dzz]*""))3:J*KL !!+ ""32BC D  D s 1A!CC&c B     f d} | S)a8 scheduled_job(trigger, args=None, kwargs=None, id=None, name=None, misfire_grace_time=undefined, coalesce=undefined, max_instances=undefined, next_run_time=undefined, jobstore='default', executor='default',**trigger_args) A decorator version of :meth:`add_job`, except that ``replace_existing`` is always ``True``. .. important:: The ``id`` argument must be given if scheduling a job in a persistent job store. The scheduler cannot, however, enforce this requirement. cF  j|   df i |S)NT)r)rrrr|rrrrrrrrLrrs rPinnerz*BaseScheduler.scheduled_job..inner"sI DLL"   KrQr)rLrrrrrrrrrrr|rrs````````````` rP scheduled_jobzBaseScheduler.scheduled_jobs<   & rQc `|j5|j||\}}|jdi||r |j|j |ddd|j t t|||jtk(r|jS#1swYNxYw)aG Modifies the properties of a single job. Modifications are passed to this method as extra keyword arguments. :param str|unicode job_id: the identifier of the job :param str|unicode jobstore: alias of the job store that contains the job :return Job: the relevant job instance Nr) rE _lookup_job_modifyr update_jobrxrrrJrury)rLjob_idrchangesr~s rP modify_jobzBaseScheduler.modify_job7s ! ! @ ,,VX>MC CKK "' "%%h/::3?  @ X&8&(KL :: & KKM  @ @s A B$$B-c |j||}tj|j}|j d|}|j ||||S)a Constructs a new trigger for a job and updates its next run time. Extra keyword arguments are passed directly to the trigger's constructor. :param str|unicode job_id: the identifier of the job :param str|unicode jobstore: alias of the job store that contains the job :param trigger: alias of the trigger type or a trigger instance :return Job: the relevant job instance N)rr)rrnowtimezoneget_next_fire_timer)rLrrrrrrs rPreschedule_jobzBaseScheduler.reschedule_jobPsY&&w =ll4==)224=  Hg]  rQc*|j||dS)a Causes the given job not to be executed until it is explicitly resumed. :param str|unicode job_id: the identifier of the job :param str|unicode jobstore: alias of the job store that contains the job :return Job: the relevant job instance Nr)rrLrrs rP pause_jobzBaseScheduler.pause_jobcsvxtDDrQc^|j5|j||\}}tj|j}|j j d|}|r|j|||cdddS|j|j| dddy#1swYyxYw)a Resumes the schedule of the given job, or removes the job if its schedule is finished. :param str|unicode job_id: the identifier of the job :param str|unicode jobstore: alias of the job store that contains the job :return Job|None: the relevant job instance if the job was rescheduled, or ``None`` if no next run time could be calculated and the job was removed Nr) rErrrrrrr remove_jobr)rLrrr~rrs rP resume_jobzBaseScheduler.resume_jobns ! ! 2 ,,VX>MC,,t}}-CKK::4EMvx}U  2 21 2 2 2sA&B#=B##B,c|tjdt|j5g}|jt k(r/|j D]\}}}|||k(s|j|!nI|jjD],\}}|||k(s|j|j.|cdddS#1swYyxYw)a Returns a list of pending jobs (if the scheduler hasn't been started yet) and scheduled jobs, either from a specific job store or from all of them. If the scheduler has not been started yet, only pending jobs can be returned because the job stores haven't been started yet either. :param str|unicode jobstore: alias of the job store :param bool pending: **DEPRECATED** :rtype: list[Job] NzThe "pending" option is deprecated -- get_jobs() always returns scheduled jobs if the scheduler has been started and pending jobs otherwise) warningswarnDeprecationWarningrErJrIrHrrDrbextend get_all_jobs)rLrpendingjobsr~r{rr}s rPget_jobszBaseScheduler.get_jobss   MM#   ! ! Dzz]*484F4F)0C 0'5H+< C()%)OO$9$9$;:LE5'5H+< E$6$6$89:   s0C;C"CC c|j5 |j||dcdddS#t$r YdddywxYw#1swYyxYw)a> Returns the Job that matches the given ``job_id``. :param str|unicode job_id: the identifier of the job :param str|unicode jobstore: alias of the job store that most likely contains the job :return: the Job by the given ID, or ``None`` if it wasn't found :rtype: Job rN)rErr(rs rPget_jobzBaseScheduler.get_jobs_ ! !  ''9!<  "       s%A- AAAAA c2d}|j5|jtk(rIt|jD]0\}\}}}|j |k(s|d|fvs!|j|=|}n@n>|j jD]!\}}|d|fvs |j||}nddd| t|tt||} |j| |jjd|y#t$rYwxYw#1swYdxYw)a Removes a job, preventing it from being run any more. :param str|unicode job_id: the identifier of the job :param str|unicode jobstore: alias of the job store that contains the job :raises JobLookupError: if the job was not found NzRemoved job %s)rErJrIrrHrrDrbrr(rrrxrvrw) rLrrrrr~r{rr}events rPrzBaseScheduler.remove_jobs+  ! ! %zz]*9B4CUCU9V5A5U$4vv'Hu ,E ..q1). %)OO$9$9$;%LE5D%=0%!,,V4-2N! % %(  ! ( (*FNC U# *F3 .%$%# % %s<AD D 9D C>'D > D D  D  D  Dc|j5|jtk(r2|r(|jDcgc] }|d|k7r|c}|_nAg|_n9|jj D]\}}|d|fvs |j ddd|jtt|ycc}w#1swY.xYw)z Removes all jobs from the specified job store, or all job stores if none is given. :param str|unicode jobstore: alias of the job store r5N) rErJrIrHrDrbremove_all_jobsrxr r)rLrrr{r}s rPrzBaseScheduler.remove_all_jobss ! ! 0zz]*(,'9'9*#"1:1 *D& *,D&$(OO$9$9$;0LE5D%=0--/0 0 ^,BHMN* 0 0s"$B9B47B9:B94B99Cc0|xstj}|j5|jtk(rTt d||j r-|j D]\}}}|d|fvst d||nt d|nzt|jjD]T\}}|d|fvs t d|d||j}|r|D]}t d||Ht d|Vdddy#1swYyxYw) a print_jobs(jobstore=None, out=sys.stdout) Prints out a textual listing of all jobs currently scheduled on either all job stores or just a specific one. :param str|unicode jobstore: alias of the job store, ``None`` to list jobs from all stores :param file out: a file-like object to print to (defaults to **sys.stdout** if nothing is given) z Pending jobs:)fileNz z No pending jobsz Jobstore :z No scheduled jobs) sysstdoutrErJrIprintrHsortedrDrbr) rLroutr~rrr{r}rs rP print_jobszBaseScheduler.print_jobssSZZ  ! ! Ezz]*oC0%%AEASAS:=^-=#n'==!D,S9:/c:$*4??+@+@+B$CELE5D%=0 %2=$113'+> %SEl =>""9DE E E EsAD (AD 9A D  Dc d ddl}ddl ddlm ddlm}|j tk(r td fd fd}|j5|jjDcgc]"\}}|jD] }|d|fvr| $} }}}dddt5} t|ds| jt!|d }|j#d | Dcgc]}|j%c}d || dddycc}}}w#1swYxYwcc}w#1swYyxYw) a* Export stored jobs as JSON. :param outfile: either a file object opened in text write mode ("w"), or a path to the target file :param jobstore: alias of the job store to export jobs from (if omitted, export from all configured job stores) rN) b64encode)versionz;the scheduler must have been started for job export to workcfj|jjdS)Nascii)dumpsHIGHEST_PROTOCOLdecode)objrpickles rPencode_with_picklez5BaseScheduler.export_jobs..encode_with_pickle(s+V\\#v/F/FGHOOPWX XrQct|drDt|dr8|j}t|trt |j |dSd|iS)NrU __setstate__)__apscheduler_class____apscheduler_state____apscheduler_pickle__)hasattrrUrrr2rO)rrJrs rP json_defaultz/BaseScheduler.export_jobs..json_default+sZsN+^0L((*eW-1;CMM1J16 -.@.EF FrQwritewr5)rscheduler_versionrrl)jsonrbase64r apschedulerrrJrI RuntimeErrorrErDrbrrr enter_contextopendumprU)rLoutfilerrrrr{r}r~all_jobsstackrrrs @@@rP export_jobszBaseScheduler.export_jobssA $' :: &M  Y G ! ! %)OO$9$9$; E5 --/e},H [ E7G,--d7C.@A II )0;CDCS--/D $       E  s< D,'D D)9D&"D!9 D&DD!D&&D/c ddl}ddl ddlm  fd}|j|}t 5}t |ds|jt|}|j||}t|ts t|jddx}dk7rtd ||d D]=}tjt } | j#||j%| ? dddy#1swYyxYw) a) Import jobs previously exported via :meth:`export_jobs. :param infile: either a file object opened in text read mode ("r") or a path to a JSON file containing previously exported jobs :param jobstore: the alias of the job store to import the jobs to rN) b64decodec|jdx}rj|S|jdx}rF|jdx}r3t|}tj |}|j ||S|S)Nrrr)getloadsr3object__new__r)dct pickle_data obj_class obj_staterr rs rPjson_object_hookz3BaseScheduler.import_jobs..json_object_hookYs!gg&>??{?||Ik$:;;GG$;<C88Dcy)z Notifies the scheduler that there may be jobs due for execution. Triggers :meth:`_process_jobs` to be run in an implementation specific manner. NrrTs rPryzBaseScheduler.wakeupwsrQct|jddxs td|_t |jddxs t |_t|jdd|_|jdi}t|jddt|jd d t|jd dd |_ |jj|jd ijD]\}}t!|t"r|j%||)t!|t&rr|jdd}|jdd}|r|j)d||}n%|rt|}|di|}nt+d|d|j%||t-d|d|j.j0d|j2j|jdijD]\}}t!|t4r|j7||)t!|t&rr|jdd} |jdd}|r|j)d||} n%| rt| }|di|} nt+d|d|j7| |t-d|d|j.j0dy)Nloggerzapscheduler.schedulerrjobstore_retry_intervalr; job_defaultsrr5rTr)rrr executorsclasstyper|zCannot create executor "z-" -- either "type" or "class" must be definedz2Expected executor instance or dict for executors['z'], got r jobstoresrzCannot create job store "z3Expected job store instance or dict for jobstores['r)r1rdr rvr0rrfloatr!rr/r. _job_defaultsrAclearrbrr!rnrrrrSrOrrDr&rq) rLrhr"r{r[executor_classpluginr|clsjobstore_classrs rPrgzBaseScheduler._configures Hd!;< #A  #6::j$#?@SMO ',VZZ8QSU-V'W$zz."5 "' (8(89Mq(Q"R|// DAB"<#3#3OQ#GH  "JJ{B7==? LE5%.!!%/E>2!&7D!9640#;;JPUVH##N3C"|U|H$25'9fg!!(E2HxX]XgXgXpXpWqqyz% . "JJ{B7==? LE5%.!!%/E>2!&7D!9640#;;JPUVH##N3C"|U|H$3E7;"" !!(E2I%PXY^YhYhYqYqXrrz{' rQctS)zLCreates a default executor store, specific to the particular scheduler type.r#rTs rProz&BaseScheduler._create_default_executors !##rQctS)zGCreates a default job store, specific to the particular scheduler type.r)rTs rPrrz&BaseScheduler._create_default_jobstores rQcX |j|S#t$rtd|wxYw)z Returns the executor instance by the given name from the list of executors that were added to this scheduler. :type alias: str :raises KeyError: if no executor by the given alias is not found zNo such executor: )rAKeyErrorrLr{s rPrzBaseScheduler._lookup_executors8 9??5) ) 9/w78 8 9)cX |j|S#t$rtd|wxYw)z Returns the job store instance by the given name from the list of job stores that were added to this scheduler. :type alias: str :raises KeyError: if no job store by the given alias is not found zNo such job store: )rDr1r2s rPrzBaseScheduler._lookup_jobstores8 :??5) ) :089 9 :r3c,|jtk(r5|jD]\}}}|j|k(s|dfcSt||jj D]%\}}|d|fvs |j |}|!||fcSt|)aI Finds a job by its ID. :type job_id: str :param str jobstore_alias: alias of a job store to look in :return tuple[Job, str]: a tuple of job, jobstore alias (jobstore alias is None in case of a pending job) :raises JobLookupError: if no job by the given ID is found. N)rJrIrHrrDrb lookup_jobr()rLrrr~r{rr}s rPrzBaseScheduler._lookup_jobs :: &040B0B %,U,66V#9$ %V$$ !% 5 5 7 * u!dE]2**62C"Ez)  * V$$rQc |j5t|j}dddD]\}}|j|zs || y#1swY-xYw#t$r|j j dYTwxYw)z~ Dispatches the given event to interested listeners. :param SchedulerEvent event: the event to send NzError notifying listener)rGrrFcode BaseExceptionrv exception)rLr listenersrrs rPrxzBaseScheduler._dispatch_events ! ! /doo.I /" GHBzzD GuI G / /%GLL**+EFGsAAA$BBcrtjjd}t|dds t dy)z9Check if we're running under uWSGI with threads disabled.uwsgi has_threadsTzThe scheduler seems to be running under uWSGI, but threads have been disabled. You must run uWSGI with the --enable-threads option for the scheduler to work.N)rmodulesrgetattrr)rL uwsgi_modules rPrmzBaseScheduler._check_uwsgis7{{w/ |]D94 :rQci}|jjD]\}}t||r|||<t|ds>tj|j }|j jd||d<|jdi||j|} |j|||_ tt|j |} |j#| |j$j'd|j(||j*t,k(r|j/yy#t$r|r|j|nYwxYw)z :param Job job: the job to add :param bool replace_existing: ``True`` to use update_job() in case the job already exists in the store rNz Added job "%s" to job store "%s"r)r(rbrrrrrrrrrr'r_jobstore_aliasrrrrxrvrwrrJrury) rLr~rr replacementsrZr[rr}rs rPrszBaseScheduler._real_add_jobs< ,,224 *JC3$$) S! * sO,,,t}}-C,/KK,J,J4QT,UL )  #l#%%n5  MM# -#&&.A U# O>O>X>X=YYab   DMM:++Iw MMrQctS)z Creates a reentrant lock object.)r rTs rPrBzBaseScheduler._create_lockns wrQc |jtk(r|jjdy|jjdt j |j }d}g}|j5|jjD]=\}} |j|}|D]} |j| j } | j+|} | r| j,r| ddn| } | sH | j/| | t1t2| j(|| } |j5| | j>jA| d|} | r$| jC| |jE| |j'| j(||jG}|s|||ks#|jI|j }@ ddd|D]} |jK| |jtk(rd}|jjd |S|d}|jjd |St j |j }tMtO||z jQd tR}|jjd|||S#t$rJ}|jjd|||t|jz}|r||kDr|}Yd}~ld}~wwxYw#t"$rG|jj%d| j | |j'| j(|YwxYw#t6$rX|jjd| | j8t1t:| j(|| } |j5| Yt"$r+|jj=d | | j YwxYw#1swYxYw)a! Iterates through jobs in every jobstore, starts jobs that are due and figures out how long to wait for the next round. If the ``get_due_jobs()`` call raises an exception, a new wakeup is scheduled in at least ``jobstore_retry_interval`` seconds. z*Scheduler is paused -- not processing jobsNzLooking for jobs to runz,Error getting due jobs from job store %r: %s)secondszLExecutor lookup ("%s") failed for job "%s" -- removing it from the job storezOExecution of job "%s" skipped: maximum number of running instances reached (%d)z*Error submitting job "%s" to executor "%s"rz5Scheduler is paused; waiting until resume() is calledz%No jobs; waiting until a job is addedrz(Next wakeup is due at %s (in %f seconds))*rJrtrvdebugrrrrErDrb get_due_jobs Exceptionwarningr r!rr|r9errorrr_get_run_timesr submit_jobrrrr"rrr:rrrrget_next_run_timer0rxminmax total_secondsr )rLrnext_wakeup_timeeventsrrdue_jobseretry_wakeup_timer~r| run_timesr job_next_runjobstore_next_run_time wait_secondss rP _process_jobszBaseScheduler._process_jobsrs :: % LL  K L 45ll4==)  ! !T X,0OO,A,A,CS X('44S9H $8DC !#'#8#8#F!$ 2 23 7I*3 "#)!1$//Y?,%7 3SVV^Y%E#MM%0(+{{'E'E%bM3( (KKlKC$//4 OOCFFNCq8Dx*2)C)C)E&)$,-0@@'='H'H'W$gS XT Xn (E   ' ( :: %L LL  V W %L LL  F G,,t}}-C%+::)NN)( T*XGG6 I++"JHL$&PL"+45*+   $[@  $1f2 & E2& D %4NO0EB7r)&V  ?B$  9 :%4G"*X0,N ~w       s#GG7GGG$G r8) metaclass)Frrabcrrcollections.abcrr contextlibrrr importlib.metadatar loggingr threadingr r tzlocalrapscheduler.eventsrrrrrrrrrrrrrrrrrr apscheduler.executors.baser!r"apscheduler.executors.poolr$apscheduler.jobr%apscheduler.jobstores.baser&r'r(apscheduler.jobstores.memoryr*apscheduler.schedulersr+r,apscheduler.triggers.baser-apscheduler.utilr.r/r0r1r2r3r4rIrurtr8rrQrPrs '3 (+(!(N9WW72   sgsrQ