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

@ -37,6 +37,10 @@
label="Description">
{{ props.row.description }}
</b-table-column>
<b-table-column field="class_name"
label="Class Name">
{{ props.row.class_name }}
</b-table-column>
<b-table-column field="script"
label="Script">
{{ props.row.script }}
@ -79,8 +83,15 @@
ref="overnightTaskDescription">
</b-input>
</b-field>
<b-field label="Script"
:type="overnightTaskScript ? null : 'is-danger'">
<b-field label="Module">
<b-input v-model.trim="overnightTaskModule">
</b-input>
</b-field>
<b-field label="Class Name">
<b-input v-model.trim="overnightTaskClass">
</b-input>
</b-field>
<b-field label="Script">
<b-input v-model.trim="overnightTaskScript">
</b-input>
</b-field>
@ -96,7 +107,7 @@
icon-pack="fas"
icon-left="save"
@click="overnightTaskSave()"
:disabled="!overnightTaskKey || !overnightTaskDescription || !overnightTaskScript">
:disabled="!overnightTaskKey || !overnightTaskDescription">
Save
</b-button>
<b-button @click="overnightTaskShowDialog = false">
@ -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

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()