def handle(self, *args, **options):
        if not options.get("restart_failed") and not options.get("files"):
            raise CommandError("One of the options --restart_failed or --file must be provided")

        backend = CeleryBackend(settings.FROM, settings.TO)
        if options["restart_failed"]:
            backend.restart_failed()
            print("Failed task has been restarted")
        else:
            files = list(map(str.strip, open(options["files"], "r+").readlines()))
            backend.move_files(files)
Example #2
0
    def handle(self, *args, **options):
        if not options.get('restart_failed') and not options.get('files'):
            raise CommandError(
                'One of the options --restart_failed or --file must be provided'
            )

        backend = CeleryBackend(settings.FROM, settings.TO)
        if options['restart_failed']:
            backend.restart_failed()
            print('Failed task has been restarted')
        else:
            files = list(
                map(str.strip,
                    open(options['files'], 'r+').readlines()))
            backend.move_files(files)
Example #3
0
 def handle(self, *args, **options):
     backend = CeleryBackend(settings.FROM, settings.TO)
     files = ['sample/%s.txt' % i for i in range(options['count'])]
     backend.create_sample_files(files, 'Sample content')
 def handle(self, *args, **options):
     backend = CeleryBackend(settings.FROM, settings.TO)
     files = ["sample/%s.txt" % i for i in range(options["count"])]
     backend.create_sample_files(files, "Sample content")