'Create a worker entry at the API.'

def create_worker(self, pinned=True):

    if (not self.is_cleanable(pinned)):
        return False
    resource_type = self.__class__.__name__
    entry_in_db = False
    while (not entry_in_db):
        try:
            db.worker_create(self._context, status=self.status, resource_type=resource_type, resource_id=self.id)
            entry_in_db = True
        except exception.WorkerExists:
            try:
                db.worker_update(self._context, None, filters={'resource_type': resource_type, 'resource_id': self.id}, service_id=None, status=self.status)
                entry_in_db = True
            except exception.WorkerNotFound:
                pass
    return entry_in_db
