From 194f49c561c1b43d2c1142a16bf0fddc7079637b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 20 Nov 2022 19:37:29 -0600 Subject: [PATCH] Add luigi module/class awareness for overnight tasks --- tailbone/templates/luigi/configure.mako | 25 ++++++++++++++++++++++--- tailbone/views/luigi.py | 10 +++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tailbone/templates/luigi/configure.mako b/tailbone/templates/luigi/configure.mako index dd9581ae..bac57b75 100644 --- a/tailbone/templates/luigi/configure.mako +++ b/tailbone/templates/luigi/configure.mako @@ -37,6 +37,10 @@ label="Description"> {{ props.row.description }} + + {{ props.row.class_name }} + {{ props.row.script }} @@ -79,8 +83,15 @@ ref="overnightTaskDescription"> - + + + + + + + + + @@ -96,7 +107,7 @@ icon-pack="fas" icon-left="save" @click="overnightTaskSave()" - :disabled="!overnightTaskKey || !overnightTaskDescription || !overnightTaskScript"> + :disabled="!overnightTaskKey || !overnightTaskDescription"> Save @@ -270,6 +281,8 @@ ThisPageData.overnightTaskCounter = 0 ThisPageData.overnightTaskKey = null ThisPageData.overnightTaskDescription = null + ThisPageData.overnightTaskModule = null + ThisPageData.overnightTaskClass = null ThisPageData.overnightTaskScript = null ThisPageData.overnightTaskNotes = null @@ -277,6 +290,8 @@ this.overnightTask = {key: null, isNew: true} this.overnightTaskKey = null this.overnightTaskDescription = null + this.overnightTaskModule = null + this.overnightTaskClass = null this.overnightTaskScript = null this.overnightTaskNotes = null this.overnightTaskShowDialog = true @@ -289,6 +304,8 @@ this.overnightTask = task this.overnightTaskKey = task.key this.overnightTaskDescription = task.description + this.overnightTaskModule = task.module + this.overnightTaskClass = task.class_name this.overnightTaskScript = task.script this.overnightTaskNotes = task.notes this.overnightTaskShowDialog = true @@ -297,6 +314,8 @@ ThisPage.methods.overnightTaskSave = function() { this.overnightTask.key = this.overnightTaskKey this.overnightTask.description = this.overnightTaskDescription + this.overnightTask.module = this.overnightTaskModule + this.overnightTask.class_name = this.overnightTaskClass this.overnightTask.script = this.overnightTaskScript this.overnightTask.notes = this.overnightTaskNotes diff --git a/tailbone/views/luigi.py b/tailbone/views/luigi.py index c7efa50e..4f293943 100644 --- a/tailbone/views/luigi.py +++ b/tailbone/views/luigi.py @@ -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()