Add luigi module/class awareness for overnight tasks

This commit is contained in:
Lance Edgar 2022-11-20 19:37:29 -06:00
parent 922b550c17
commit 194f49c561
2 changed files with 31 additions and 4 deletions

View file

@ -86,7 +86,9 @@ class LuigiTaskView(MasterView):
return self.json_response({'error': "Task not found"})
try:
self.luigi_handler.launch_overnight_task(task, app.yesterday())
self.luigi_handler.launch_overnight_task(task, app.yesterday(),
email_if_empty=True,
wait=False)
except Exception as error:
log.warning("failed to launch overnight task: %s", task,
exc_info=True)
@ -171,6 +173,10 @@ class LuigiTaskView(MasterView):
settings.extend([
{'name': 'rattail.luigi.overnight.task.{}.description'.format(key),
'value': task['description']},
{'name': 'rattail.luigi.overnight.task.{}.module'.format(key),
'value': task['module']},
{'name': 'rattail.luigi.overnight.task.{}.class_name'.format(key),
'value': task['class_name']},
{'name': 'rattail.luigi.overnight.task.{}.script'.format(key),
'value': task['script']},
{'name': 'rattail.luigi.overnight.task.{}.notes'.format(key),
@ -229,6 +235,8 @@ class LuigiTaskView(MasterView):
model.Setting.name.like('rattail.luigi.overnight.%.description'),
model.Setting.name.like('rattail.luigi.overnight.task.%.notes'),
model.Setting.name.like('rattail.luigi.overnight.%.notes'),
model.Setting.name.like('rattail.luigi.overnight.task.%.module'),
model.Setting.name.like('rattail.luigi.overnight.task.%.class_name'),
model.Setting.name.like('rattail.luigi.overnight.task.%.script'),
model.Setting.name.like('rattail.luigi.overnight.%.script')))\
.all()