misc: add a --force-replay argument to runjob command, for debugging (#67455)
This commit is contained in:
parent
a9aef3861f
commit
9cf08439e3
|
@ -466,6 +466,15 @@ def test_runjob(pub):
|
|||
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id)
|
||||
assert AfterJob.get(job.id).status == 'completed'
|
||||
assert AfterJob.get(job.id).l10n_month == 'octobre'
|
||||
completion_time = AfterJob.get(job.id).completion_time
|
||||
|
||||
# running again the job will skip it
|
||||
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id)
|
||||
assert AfterJob.get(job.id).completion_time == completion_time
|
||||
|
||||
# --force-replay will force the job to run again
|
||||
call_command('runjob', '--domain=example.net', '--job-id=%s' % job.id, '--force-replay')
|
||||
assert AfterJob.get(job.id).completion_time != completion_time
|
||||
|
||||
|
||||
def test_ctl_print_help(capsys):
|
||||
|
|
|
@ -27,6 +27,7 @@ class Command(TenantCommand):
|
|||
def add_arguments(self, parser):
|
||||
parser.add_argument('--domain', action='store', required=True)
|
||||
parser.add_argument('--job-id', action='store', required=True)
|
||||
parser.add_argument('--force-replay', action='store_true', default=False)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
domain = options.pop('domain')
|
||||
|
@ -35,4 +36,6 @@ class Command(TenantCommand):
|
|||
job = AfterJob.get(options['job_id'])
|
||||
except KeyError:
|
||||
raise CommandError('missing job')
|
||||
if options.get('force_replay'):
|
||||
job.completion_time = None
|
||||
job.run()
|
||||
|
|
Loading…
Reference in New Issue