Commit b22ac975 authored by kaiyou's avatar kaiyou

Have per-instance name for checks

parent bf27d561
......@@ -17,10 +17,10 @@ class Scheduler(object):
""" Called by celery upon configuration so we can add beat tasks
"""
for name, check in app.config["checks"].items():
instances = check.get("instances", {name: {}})
instances = check.get("instances", {None: {}})
context = check.get("context", {})
args = check.get("args", {})
for name, instance in instances.items():
for instance_name, instance in instances.items():
instance_context = context.copy()
instance_context.update(instance.get("context", {}))
instance_args = args.copy()
......@@ -28,7 +28,9 @@ class Scheduler(object):
app.add_periodic_task(
instance.get("schedule", check["schedule"]),
check_run.s(
name, instance.get("function", check["function"]),
"{}[{}]".format(name, instance_name)
if instance_name else name,
instance.get("function", check["function"]),
instance_context, instance_args
)
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment