本文整理汇总了Python中schedule.run_pending函数的典型用法代码示例。如果您正苦于以下问题:Python run_pending函数的具体用法?Python run_pending怎么用?Python run_pending使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_pending函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __main__
def __main__():
hus = json.loads(hint_url)
for (index, url) in enumerate(hus):
schedule.every(int(frequency_rate[index])).seconds.do(check_request, index, url)
while True:
schedule.run_pending()
time.sleep(1)
开发者ID:fantasycool,项目名称:open_checker,代码行数:7,代码来源:scheduled_send_request.py
示例2: schedule_with_delay
def schedule_with_delay(self):
for task in self.tasks:
interval = task.get('interval')
schedule.every(interval).minutes.do(self.schedule_task_with_lock, task)
while True:
schedule.run_pending()
time.sleep(1)
开发者ID:yb123speed,项目名称:haipproxy,代码行数:7,代码来源:scheduler.py
示例3: otherstuff
def otherstuff():
from sdjson import sddata
from mint import minttrans, mintaccounts
from location import locationkml
# from nesttest import neststart
# neststart()
locationkml()
minttrans()
mintaccounts()
sddata()
# testlocationquery()
schedule.every(60).seconds.do(jobqueue.put, locationkml)
schedule.every(2).hours.do(jobqueue.put, minttrans)
schedule.every(6).hours.do(jobqueue.put, mintaccounts)
schedule.every(12).hours.do(jobqueue.put, sddata)
# schedule.every(20).seconds.do(jobqueue.put, grr)
worker_thread = Thread(target=worker_main)
worker_thread.start()
worker_thread2 = Thread(target=worker_main)
worker_thread2.start()
worker_thread3 = Thread(target=worker_main)
worker_thread3.start()
worker_thread4 = Thread(target=worker_main)
worker_thread4.start()
while 1:
schedule.run_pending()
time.sleep(1)
开发者ID:thacolonel,项目名称:test,代码行数:27,代码来源:app.py
示例4: minecraftlistener
def minecraftlistener():
nextlineforlist = False
numplayers = 0
logfile = os.path.abspath(mcfolder + "/logs/latest.log")
f = open(logfile, "r", encoding="utf-8")
file_len = os.stat(logfile)[stat.ST_SIZE]
f.seek(file_len)
pos = f.tell()
UUID = {}
while True:
pos = f.tell()
line = f.readline().strip()
schedule.run_pending()
if not line:
if os.stat(logfile)[stat.ST_SIZE] < pos:
f.close()
time.sleep( 1 )
f = open(logfile, "r")
pos = f.tell()
else:
time.sleep( 1 )
f.seek(pos)
else:
eventData = vanillabean.genEvent(line)
event = ""
data = ()
if eventData:
# print(eventData)
event, data = eventData
print(event, data)
if nextlineforlist:
nextlineforlist = False
playerlist(numplayers, line)
if event == "playerList":
numplayers = data[1]
nextlineforlist = True
if event == "achievement":
eventAchievement(data)
if event == "command":
eventCommand(data)
if event == "UUID":
eventUUID(data)
if event == "chat":
eventChat(data)
if event == "logged":
eventLogged(data)
if event == "lag":
eventLag(data)
开发者ID:jason-green-io,项目名称:littlepod,代码行数:60,代码来源:minecraft-notify.py
示例5: run_schedule
def run_schedule():
global counter
log.info('scheduler started')
while 1:
schedule.run_pending()
if counter < parser.number_of_requests:
# acquiring banks and rates data
banks = parser.banks
rates = parser.rates
log.info('data gathered')
log.info('banks: %s' % banks.__len__())
log.info('rates: %s' % rates.__len__())
# saving data into DB
for logo, bank in banks.iteritems():
saved_bank = Bank.query.filter_by(uri_logo=bank.uri_logo).first()
rate = rates[logo]
if saved_bank:
saved_bank.update_time = bank.update_time
rate.bank_id = saved_bank.id
else:
db.session.add(bank)
rate.bank = bank
db.session.add(rate)
try:
db.session.commit()
except SQLAlchemyError as e:
log.error(e.message, e)
# increasing counter
counter += 1
time.sleep(1)
开发者ID:artexnet,项目名称:rate-parser,代码行数:34,代码来源:application.py
示例6: process
def process(run_once=False):
"""
runs the processign loop as log as running_event is set or undefined
:param running_event: Event or None
:return: None
"""
print("Starting qshape processing")
# handle ctrl+c
print('Press Ctrl+C to exit')
running_event = threading.Event()
running_event.set()
def signal_handler(signal, frame):
print('Attempting to close workers')
running_event.clear()
signal.signal(signal.SIGINT, signal_handler)
def report_stats():
with statsd.pipeline() as pipe:
for stat, value in get_qshape_stats():
pipe.incr(stat, value)
report_stats() # report current metrics and schedule them to the future
if not run_once:
schedule.every(STATSD_DELAY).seconds.do(report_stats)
while running_event.is_set():
schedule.run_pending()
time.sleep(0.1)
print("Finished qshape processing")
开发者ID:ministryofjustice,项目名称:postfix-stats-collector,代码行数:29,代码来源:qshape.py
示例7: main
def main():
port = "5918"
if len(sys.argv) > 1:
port = sys.argv[1]
socket = initiate_zmq(port)
logging.basicConfig(filename='./log/ingest_lottery.log', level=logging.INFO)
tz = pytz.timezone(pytz.country_timezones('cn')[0])
schedule.every(30).seconds.do(run, socket, tz)
while True:
try:
schedule.run_pending()
time.sleep(1)
except KeyboardInterrupt:
now = datetime.now(tz)
message = "CTRL-C to quit the program at [%s]" % now.isoformat()
logging.info(message)
break
except Exception as e:
now = datetime.now(tz)
message = "Error at time [%s]" % now.isoformat()
logging.info(message)
logging.info(e)
# reschedule the job
schedule.clear()
socket = initiate_zmq(port)
schedule.every(30).seconds.do(run, socket, tz)
开发者ID:Tskatom,项目名称:Lottery,代码行数:27,代码来源:ingest_lottery.py
示例8: scheduler_init
def scheduler_init (parent):
'''
Schedule Init
Start the main loop for the internal scheduler that
ticks every second.
--
@param parent:int The PID of the parent.
@return void
'''
# Define the jobs to run at which intervals
schedule.every().minute.do(Reminder.run_remind_once)
schedule.every().minute.do(Reminder.run_remind_recurring)
# Start the main thread, polling the schedules
# every second
while True:
# Check if the current parent pid matches the original
# parent that started us. If not, we should end.
if os.getppid() != parent:
logger.error(
'Killing scheduler as it has become detached from parent PID.')
sys.exit(1)
# Run the schedule
schedule.run_pending()
time.sleep(1)
return
开发者ID:Methimpact,项目名称:hogar,代码行数:34,代码来源:Scheduler.py
示例9: dynamically_scrape_combined_data
def dynamically_scrape_combined_data(data_filename,
sales_filename,
interval,
num_retries = 10):
"""
Dynamically scrapes a continuously updated list of unique clean links and
appends the data to their respective files.
"""
old_list = []
def job(old_list):
new_list = collect_all_featured_links()
new_links = remove_old_links(old_list, new_list)
bad_links = collect_bad_links(new_links)
clean_links = remove_bad_links_from_link_list(bad_links, new_links)
scrape_combined_data_from_all_featured_products(data_filename,
sales_filename,
clean_links,
num_retries)
old_list = new_list
job(old_list)
schedule.every(interval).hours.do(job)
while True:
schedule.run_pending()
time.sleep(30)
print "Dynamic scraping finished"
开发者ID:fgscivittaro,项目名称:ebay,代码行数:32,代码来源:combined.py
示例10: watch
def watch():
# set up argument parsing
parser = example.BigFixArgParser()
parser.add_argument('-a', '--actions', required = False, help = 'List of actions to watch')
parser.add_argument('-v', '--verbose', default = False, action = "store_true", required = False, help = 'To see the full list of commands that contain watched actions')
parser.add_argument('-t', '--time', default = 60, required = False, help = 'To set the waiting period')
parser.base_usage += """
-a, --actions [ACTIONS/FILENAME] Specify a list of actions to watch, seperated by comma(,);
if FILENAME with .wal extension detected, will read the file to get the list.
-v, --verbose To see the full list of commands that contain watched actions
-t, --time [MINUTE] A number specifing the waiting period between checks"""
parser.description = 'Used to watch certain actions'
ext = ".wal"
args = parser.parse_args()
args_actions = ""
if ext in args.actions:
actions_file = open(args.actions, 'r')
for line in actions_file:
args_actions += line
else:
args_actions = args.actions
actions_list = args_actions.split(",")
watched_actions = gen_regex(actions_list)
action_record = {}
for a in actions_list:
action_record[a] = False
t = int(args.time)
gen_summary(action_record, watched_actions, args)
schedule.every(t).minutes.do(gen_summary, action_record, watched_actions, args)
while True:
schedule.run_pending()
开发者ID:bigfix,项目名称:tools,代码行数:34,代码来源:watch_action.py
示例11: run
def run(cfg, configToExecute):
global remote, remoteUser
remote = cfg.get('remote', 'host')
remoteUser = cfg.get('remote', 'user')
# get task configs
configs = glob.glob(cfg.get('backup', 'task_dir', '/etc/backup/tasks/') + "*.conf")
tasks = []
if (configToExecute == None):
# load all config files
for config in configs:
cfg = ConfigParser.ConfigParser()
cfg.read(config)
tasks.append(cfg)
# setup timers for each task
for task in tasks:
schedule_task(task)
# run the scheduler loop
while True:
schedule.run_pending()
time.sleep(60)
else:
# just execute the config then exit
config = cfg.get('backup', 'task_dir', '/etc/backup/tasks/') + configToExecute
cfg = ConfigParser.ConfigParser()
cfg.read(config)
execute(cfg)
return
开发者ID:dunkelstern,项目名称:server-backup-script,代码行数:31,代码来源:backup.py
示例12: SendFrame
def SendFrame(send_type=0):
global acknowledgement_status
#serial.write(consumption_frame)
while True:
if not send_type:
schedule.run_pending()
#frame = receiver.ReceiveFrame()
if frame:
frame_data = ConvertDatasToInt(frame[7:-1])
if frame_data[0]==6 and frame_data[frame_data[1]+3]==frame_id:
now = datetime.datetime.now()
date_time = now.strftime("%Y-%m-%d %H:%M:%S")
acknowledgement_status = 1
sql.UpdateQuery("frames", [["frames_status", 1]], "frames_id={}".format(frame_id))
sql.InsertQuery("room_consumptions", "{}, {}, {}".format(rooms_id, frame_data[frame_data[1]+5], date_time))
sql.Commit()
break
开发者ID:nicolerey,项目名称:Thesis,代码行数:26,代码来源:request_consumption.py
示例13: main
def main():
logging.info("Starting application")
capture_nature()
schedule.every(5).minutes.do(upload_to_gdrive)
while True:
schedule.run_pending()
time.sleep(1)
开发者ID:ryan-bradon,项目名称:raspberry-picamera-nature-feed,代码行数:7,代码来源:nature_feeder.py
示例14: geotagx_harvestor
def geotagx_harvestor(media_object):
image_url = media_object['media_url']
source_uri = media_object['expanded_url']
create_time = media_object['tweet_created_at']
id_str = media_object['id_str']
try:
foo = DATA_DUMP[image_url]
#if the image does not exist, the control should move to the exception block
print "Duplicate image found, ignoring.....", image_url
except:
# Create Object for pushing to geotagx-sourcerer-proxy
print "Pushing image to geotagx-sourcerer-proxy : ", image_url
_sourcerer_object = {}
_sourcerer_object['source'] = GEOTAGX_SOURCERER_TYPE
_sourcerer_object['type'] = "IMAGE_SOURCE"
_sourcerer_object['categories'] = CATEGORIES
_sourcerer_object['image_url'] = image_url
_sourcerer_object['source_uri'] = source_uri
_sourcerer_object['create_time'] =create_time
_sourcerer_object['id'] = id_str
# Push data via geotagx-sourcerer-proxy
ARGUMENTS = base64.b64encode(json.dumps(_sourcerer_object))
GEOTAGX_SOURCERER_PROXY_URL = TARGET_HOST+TARGET_URI+"?sourcerer-data="+ARGUMENTS;
try:
urllib2.urlopen(GEOTAGX_SOURCERER_PROXY_URL)
print "SUCCESSFULLY PUSHED : ", image_url
DATA_DUMP[image_url] = _sourcerer_object
except:
print "FAILURE", image_url
schedule.run_pending()
开发者ID:geotagx,项目名称:geotagx-twitter-sourcerer,代码行数:33,代码来源:geotagx-twitter-sourcerer.py
示例15: run
def run(self, path_local_log=None, branch='next', sched='false', launch_pause='false'):
"""
:param str path_local_log: Path to the local log file copied from the remote server. If ``None``, do not copy
remote log file.
:param str branch: Target git branch to test.
:param str sched: If ``'true'``, run tests only once. Otherwise, run tests at 23:00 hours daily.
:param str launch_pause: If ``'true'``, pause at a breakpoint after launching the instance and mounting the data
volume. Continuing from the breakpoint will terminate the instance and destroy the volume.
"""
import schedule
from logbook import Logger
self.log = Logger('nesii-testing')
self.path_local_log = path_local_log
self.branch = branch
self.launch_pause = launch_pause
if self.launch_pause == 'true':
self.log.info('launching instance then pausing')
self._run_tests_(should_email=False)
else:
if sched == 'true':
self.log.info('begin continous loop')
schedule.every().day.at("6:00").do(self._run_tests_, should_email=True)
while True:
schedule.run_pending()
time.sleep(1)
else:
self.log.info('running tests once')
self._run_tests_(should_email=True)
开发者ID:HydroLogic,项目名称:ocgis,代码行数:32,代码来源:fabfile.py
示例16: routine
def routine(self):
# install schedule
for entity in self.entities:
pieces = entity.getschedule().split(" ")
if re.match("^\d*$", pieces[1]):
every = schedule.every(int(pieces[1]))
pieces = pieces[2 : len(pieces)]
else:
every = schedule.every()
pieces = pieces[1 : len(pieces)]
timedes = getattr(every, pieces[0])
pieces = pieces[1 : len(pieces)]
if len(pieces) and pieces[0] == "at":
finish = timedes.at(pieces[1])
else:
finish = timedes
finish.do(self.monitor, entity)
while True:
time.sleep(1)
for entity in self.entities:
schedule.run_pending()
开发者ID:louis-she,项目名称:apimonitor,代码行数:25,代码来源:apimonitor.py
示例17: main
def main():
for job in schedule.jobs:
project_logger.info(job)
while True:
schedule.run_pending()
time.sleep(10)
开发者ID:thm-tech,项目名称:forward_scripts,代码行数:7,代码来源:app.py
示例18: main
def main():
args = parser.parse_args()
log = logging.getLogger()
log.level = logging.INFO
stream = logging.StreamHandler()
file_handler = logging.FileHandler(args.logfile)
log.addHandler(stream)
log.addHandler(file_handler)
with open(args.config) as f:
config = yaml.safe_load(f)
log.info('Connecting to database')
database = connect_to_database(**config['mongodb'])
log.info('Connection established')
services = [
service(auxdir=args.auxdir)
for service in supported_services.values()
]
schedule.every().day.at('15:00').do(
fill_last_night, services=services, database=database
)
log.info('Schedule started')
try:
while True:
schedule.run_pending()
sleep(60)
except (KeyboardInterrupt, SystemExit):
pass
开发者ID:fact-project,项目名称:aux2mongodb,代码行数:33,代码来源:cron.py
示例19: run
def run(self):
sendHour = str(self.parameters.get('maillist', 'sendhour'))
print(sendHour)
schedule.every().day.at(sendHour).do(self.sendMail)
while(1):
schedule.run_pending()
time.sleep(5)
开发者ID:dangraf,项目名称:PycharmProjects,代码行数:7,代码来源:mailposi.py
示例20: __init__
def __init__(self):
# Check weather every 5 minutes for more verbose detailing of conditions
# during amber level scenarios. Mostly silent.
schedule.every(5).minutes.do(self.checking)
# Daily notifications for dawn outings
schedule.every().day.at('06:00').do(self.outing_notify)
# Notifies ahead of wednesday afternoon outings
schedule.every().wednesday.at('12:00').do(self.outing_notify)
# Notifies ahead of weekend morning outings
schedule.every().saturday.at('07:00').do(self.outing_notify)
schedule.every().sunday.at('07:00').do(self.outing_notify)
# Notifies ahead of weekend afternoon (novice) outings
schedule.every().saturday.at('11:00').do(self.outing_notify)
schedule.every().sunday.at('11:00').do(self.outing_notify)
# Terminates late at night to stay within free Heroku usage limits
schedule.every().day.at('22:00').do(self.terminate)
while True:
schedule.run_pending()
time.sleep(1)
开发者ID:UYBC,项目名称:Archimedes,代码行数:26,代码来源:rowbot.py
注:本文中的schedule.run_pending函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论