Let the Luigi handler take care of removing some DB settings

so that command line can also remove them via same logic
This commit is contained in:
Lance Edgar 2022-11-21 14:01:22 -06:00
parent de5a8fae7c
commit 4741ee0a7b

View file

@ -211,38 +211,9 @@ class LuigiTaskView(MasterView):
def configure_remove_settings(self): def configure_remove_settings(self):
super(LuigiTaskView, self).configure_remove_settings() super(LuigiTaskView, self).configure_remove_settings()
app = self.get_rattail_app()
model = self.model
session = self.Session()
to_delete = session.query(model.Setting)\ self.luigi_handler.purge_overnight_settings(self.Session())
.filter(sa.or_( self.luigi_handler.purge_backfill_settings(self.Session())
model.Setting.name == 'rattail.luigi.backfill.tasks',
model.Setting.name == 'rattail.luigi.backfill_tasks',
model.Setting.name.like('rattail.luigi.backfill.task.%.description'),
model.Setting.name.like('rattail.luigi.backfill.%.description'),
model.Setting.name.like('rattail.luigi.backfill.task.%.forward'),
model.Setting.name.like('rattail.luigi.backfill.%.forward'),
model.Setting.name.like('rattail.luigi.backfill.task.%.notes'),
model.Setting.name.like('rattail.luigi.backfill.%.notes'),
model.Setting.name.like('rattail.luigi.backfill.task.%.script'),
model.Setting.name.like('rattail.luigi.backfill.%.script'),
model.Setting.name.like('rattail.luigi.backfill.task.%.target_date'),
model.Setting.name.like('rattail.luigi.backfill.%.target_date'),
model.Setting.name == 'rattail.luigi.overnight.tasks',
model.Setting.name == 'rattail.luigi.overnight_tasks',
model.Setting.name.like('rattail.luigi.overnight.task.%.description'),
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()
for setting in to_delete:
app.delete_setting(session, setting.name)
@classmethod @classmethod
def defaults(cls, config): def defaults(cls, config):