change README.md and default config file

This commit is contained in:
2022-08-12 09:43:18 +02:00
parent f71af57288
commit 641d467069
2 changed files with 11 additions and 2 deletions

View File

@@ -58,6 +58,9 @@ All arguments except for *job* are optional.
# Bad: time.sleep(10) # Bad: time.sleep(10)
# Good: await asyncio.sleep(10) # Good: await asyncio.sleep(10)
import asyncio
import logging
async def custom_job(event, task_id): async def custom_job(event, task_id):
await asyncio.sleep(10) await asyncio.sleep(10)
logging.info(f"{task_id}: execute example task: {event}") logging.info(f"{task_id}: execute example task: {event}")
@@ -67,7 +70,8 @@ task_sched = TaskScheduler(
files=True, files=True,
dirs=False, dirs=False,
delay=0, delay=0,
logname="sched") logname="sched",
global_vars=globals())
``` ```
### ShellScheduler ### ShellScheduler

View File

@@ -2,14 +2,19 @@
# TaskScheduler config # # TaskScheduler config #
########################## ##########################
#import asyncio
#import logging
#
#async def custom_job(event, task_id): #async def custom_job(event, task_id):
# asyncio.sleep(1)
# logging.info(f"{task_id}: execute example task: {event}") # logging.info(f"{task_id}: execute example task: {event}")
# #
#task_sched = TaskScheduler( #task_sched = TaskScheduler(
# job=custom_job, # job=custom_job,
# files=True, # files=True,
# dirs=False, # dirs=False,
# delay=10) # delay=10
# global_vars=globals())
########################### ###########################