runperiodic: --exclude

This commit is contained in:
Raphael Michel
2021-03-09 11:50:19 +01:00
parent a84a726185
commit 002ab4aa06

View File

@@ -16,6 +16,8 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--tasks', action='store', type=str, help='Only execute the tasks with this name ' parser.add_argument('--tasks', action='store', type=str, help='Only execute the tasks with this name '
'(dotted path, comma separation)') '(dotted path, comma separation)')
parser.add_argument('--exclude', action='store', type=str, help='Exclude the tasks with this name '
'(dotted path, comma separation)')
def handle(self, *args, **options): def handle(self, *args, **options):
verbosity = int(options['verbosity']) verbosity = int(options['verbosity'])
@@ -28,6 +30,9 @@ class Command(BaseCommand):
if options.get('tasks'): if options.get('tasks'):
if name not in options.get('tasks').split(','): if name not in options.get('tasks').split(','):
continue continue
if options.get('exclude'):
if name in options.get('exclude').split(','):
continue
if verbosity > 1: if verbosity > 1:
self.stdout.write(f'INFO Running {name}') self.stdout.write(f'INFO Running {name}')