def do_global_lock(self, args):
        '''read (or clear) the global lock'''
        if args.purge:
            self.task_master.registry.force_clear_lock()
        else:
            owner = self.task_master.registry.read_lock()
            if owner:
                heartbeat = self.task_master.get_heartbeat(owner)
                if 'hostname' in heartbeat:
                    self.stdout.write('{0} ({1})\n'.format(owner,
                                                         heartbeat['hostname']))
                else:
                    self.stdout.write('{0}\n'.format(owner))
            else:
                self.stdout.write('(unlocked)\n')