def do_clear(self, args):
        '''remove work units from a work spec'''
        # Which units?
        work_spec_name = self._get_work_spec_name(args)
        units = args.unit or None
        # What to do?
        count = 0
        if args.status is None:
            all = units is None
            count += self.task_master.del_work_units(work_spec_name, work_unit_keys=units, all=all)
        elif args.status == 'available':
            count += self.task_master.del_work_units(
                work_spec_name, work_unit_keys=units, state=self.task_master.AVAILABLE)
        elif args.status == 'pending':
            count += self.task_master.del_work_units(
                work_spec_name, work_unit_keys=units, state=self.task_master.PENDING)
        elif args.status == 'blocked':
            count += self.task_master.del_work_units(
                work_spec_name, work_unit_keys=units, state=self.task_master.BLOCKED)
        elif args.status == 'finished':
            count += self.task_master.del_work_units(
                work_spec_name, work_unit_keys=units, state=self.task_master.FINISHED)
        elif args.status == 'failed':
            count += self.task_master.del_work_units(
                work_spec_name, work_unit_keys=units, state=self.task_master.FAILED)
        self.stdout.write('Removed {0} work units.\n'.format(count))
remove work units from a work spec