jjzjj

Scheduler

全部标签

java - 如何在 Play 2.0.4 中每天安排任务 + onStart()?

我需要每天在playframework2.0.4中执行一段代码1次,当我尝试使用类扩展GlobalSettings时它可以工作。但它适用于每个实例请求。我希望它在服务器启动时工作并且每天执行1次任务。packagecontrollers;importjava.util.concurrent.TimeUnit;importakka.util.Duration;importplay.Application;importplay.GlobalSettings;importplay.libs.Akka;publicclassParserJobAppextendsGlobalSettings{@

java - ScheduledExecutorService start stop 几次

我正在使用ScheduledExecutorService,在我称之为shutdown之后方法,我无法在其上安排Runnable。调用scheduleAtFixedRate(runnable,INITIAL_DELAY,INTERVAL,TimeUnit.SECONDS)在shutdown()之后抛出java.util.concurrent.RejectedExecutionException。在ScheduledExecutorService上调用shutdown()后,是否还有另一种运行新任务的方法?? 最佳答案 您可以重复使用

完全独立于系统时间变化的Java调度器

之前用的是JavaTimer,后来改用ScheduledExecutorService,但是我的问题没有解决。由于在系统时间更改(通过ntpd)之前安排的任务不会按指定的延迟执行。没有相同的日志,因为什么都没有发生:(。在我的64位Linux目标中使用jre1.6.0_2664位。Update:ScheduledExecutorServiceworksfineonWindows.Problemisonlyon64bitLinuxbasedsystemrunning64bitJVM.Itworksfineon64bitlinuxrunning32bitJVM...strange.Have

java - scheduler的standby()和pauseAll()有什么区别?

我正在使用QuartzSchedulerv.1.8.0。scheduler.standby()之间有什么区别?和scheduler.pauseAll()?standby()-TemporarilyhaltstheScheduler'sfiringofTriggers.pauseAll()-Pausealltriggers-similartocallingpauseTriggerGroup(group)oneverygroup,however,afterusingthismethodresumeAll()mustbecalledtoclearthescheduler'sstateof'r

Python:code.interact(local=locals()) 其中 stdin/stdout 不可用

在Python中,以下代码片段将在执行时打开一个交互式shell。importcode;code.interact(local=locals())事实证明,这对于调试大量文档不足的代码非常有用。即使没有调试器,也可以使用shell导航程序内环境并弄清楚发生了什么。到目前为止,还不错。现在是挑战。我正在使用的软件(顺便说一句,它是用Django编写的)使用某种调度机制,然后与另一个Python进程对话,除了编辑它的代码。除了发送给它进行处理的变量外,我没有任何输入。但是,我不知道代码是如何工作的,因为文档很差,所以我想使用code.interact方法来解决问题。但是这个过程是由一些特殊

python - 自定义调度程序以具有带超时/终止开关的顺序 + 半顺序脚本?

下面是我的代码的很大一部分,基本上,如果您向下滚动到execute_subscripts()函数,您可以看到我有两个通过execfile运行的脚本工作精美,它们显示prints,它们将traceback错误保存到错误文件中。我正在尝试将第二个脚本变成一个不等待自己完成就可以继续下一个脚本的脚本。如您所见,我尝试将subprocess与Popen一起使用来启动一个静默的隐藏窗口...但是它似乎没有运行而且我有不知道如何正确使用p.communicate()函数来检索tracebacks和/或prints。我也...需要帮助创建某种超时/终止开关,所以如果通过Popen或execfile路

python - 关闭计划库中的日志记录

目标:防止schedule每次运行时记录。背景:我在python项目中使用logging和schedule库。我的日志文件包含有关由RaspberryPi运行的仪器的物理状态的信息,并且每10秒更新一次。我使用schedule库来安排该定期日志。Here是我为schedule找到的有限文档。问题:schedule库会在每次运行作业时记录此语句。2016-06-2909:01:51,022INFO:Runningjobevery10secondsdoupdate_log()(Lastrun...schedule调用的函数是update_log(),该函数计算我每十秒运行一次的日志中包含的

python - 如何取消python计划

我有一个重复的python计划任务如下,它需要在startMonitor()中每3分钟运行一次getMyStock():fromstocktrace.utilimportsettingsimporttime,os,sys,schedschedule=sched.scheduler(time.time,time.sleep)defperiodic(scheduler,interval,action,actionargs=()):scheduler.enter(interval,1,periodic,(scheduler,interval,action,actionargs))action

python - APScheduler(高级Python调度器) ImportError : No module named scheduler

我有以下导入错误“导入错误:没有名为调度程序的模块”当我运行以下python脚本时:"""Demonstrateshowtousetheblockingschedulertoscheduleajobthatexecute$"""fromdatetimeimportdatetimeimportosfromapscheduler.schedulerimportBlockingSchedulerdeftick():print('Tick!Thetimeis:%s'%datetime.now())if__name__=='__main__':scheduler=BlockingSchedule

python - Airflow :将 {{ ds }} 作为参数传递给 PostgresOperator

我想使用执行日期作为我的sql文件的参数:我试过了dt='{{ds}}'s3_to_redshift=PostgresOperator(task_id='s3_to_redshift',postgres_conn_id='redshift',sql='s3_to_redshift.sql',params={'file':dt},dag=dag)但它不起作用。 最佳答案 dt='{{ds}}'不起作用,因为Jinja(Airflow中使用的模板引擎)不处理整个Dag定义文件。对于每个Operator都有Jinja将处理的字段,它们是运