Exemple #1
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 = AsyncIOBackend(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)
Exemple #2
0
 def handle(self, *args, **options):
     backend = AsyncIOBackend(settings.FROM, settings.TO)
     files = ['sample/%s.txt' % i for i in range(options['count'])]
     backend.create_sample_files(files, 'Sample content')