Package org.apache.hadoop.yarn.server.timeline

Examples of org.apache.hadoop.yarn.server.timeline.EntityIdentifier


  public boolean checkAccess(UserGroupInformation callerUGI,
      TimelineEntity entity) throws YarnException, IOException {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Verifying the access of " + callerUGI.getShortUserName()
          + " on the timeline entity "
          + new EntityIdentifier(entity.getEntityId(), entity.getEntityType()));
    }

    if (!adminAclsManager.areACLsEnabled()) {
      return true;
    }

    Set<Object> values =
        entity.getPrimaryFilters().get(
            SystemFilter.ENTITY_OWNER.toString());
    if (values == null || values.size() != 1) {
      throw new YarnException("Owner information of the timeline entity "
          + new EntityIdentifier(entity.getEntityId(), entity.getEntityType())
          + " is corrupted.");
    }
    String owner = values.iterator().next().toString();
    // TODO: Currently we just check the user is the admin or the timeline
    // entity owner. In the future, we need to check whether the user is in the
View Full Code Here


              }
            }
          } catch (YarnException e) {
            LOG.error("Error when verifying access for user " + callerUGI
                + " on the events of the timeline entity "
                + new EntityIdentifier(entity.getEntityId(),
                    entity.getEntityType()), e);
            entitiesItr.remove();
          }
        }
      }
View Full Code Here

      throw new WebApplicationException(e,
          Response.Status.INTERNAL_SERVER_ERROR);
    }
    if (entity == null) {
      throw new NotFoundException("Timeline entity "
          + new EntityIdentifier(parseStr(entityId), parseStr(entityType))
          + " is not found");
    }
    return entity;
  }
View Full Code Here

              eventsItr.remove();
            }
          } catch (Exception e) {
            LOG.error("Error when verifying access for user " + callerUGI
                + " on the events of the timeline entity "
                + new EntityIdentifier(eventsOfOneEntity.getEntityId(),
                    eventsOfOneEntity.getEntityType()), e);
            eventsItr.remove();
          }
        }
      }
View Full Code Here

      List<EntityIdentifier> entityIDs = new ArrayList<EntityIdentifier>();
      TimelineEntities entitiesToPut = new TimelineEntities();
      List<TimelinePutResponse.TimelinePutError> errors =
          new ArrayList<TimelinePutResponse.TimelinePutError>();
      for (TimelineEntity entity : entities.getEntities()) {
        EntityIdentifier entityID =
            new EntityIdentifier(entity.getEntityId(), entity.getEntityType());

        // check if there is existing entity
        TimelineEntity existingEntity = null;
        try {
          existingEntity =
              store.getEntity(entityID.getId(), entityID.getType(),
                  EnumSet.of(Field.PRIMARY_FILTERS));
          if (existingEntity != null
              && !timelineACLsManager.checkAccess(callerUGI, existingEntity)) {
            throw new YarnException("The timeline entity " + entityID
                + " was not put by " + callerUGI + " before");
          }
        } catch (Exception e) {
          // Skip the entity which already exists and was put by others
          LOG.warn("Skip the timeline entity: " + entityID + ", because "
              + e.getMessage());
          TimelinePutResponse.TimelinePutError error =
              new TimelinePutResponse.TimelinePutError();
          error.setEntityId(entityID.getId());
          error.setEntityType(entityID.getType());
          error.setErrorCode(
              TimelinePutResponse.TimelinePutError.ACCESS_DENIED);
          errors.add(error);
          continue;
        }

        // inject owner information for the access check if this is the first
        // time to post the entity, in case it's the admin who is updating
        // the timeline data.
        try {
          if (existingEntity == null) {
            injectOwnerInfo(entity,
                callerUGI == null ? "" : callerUGI.getShortUserName());
          }
        } catch (YarnException e) {
          // Skip the entity which messes up the primary filter and record the
          // error
          LOG.warn("Skip the timeline entity: " + entityID + ", because "
              + e.getMessage());
          TimelinePutResponse.TimelinePutError error =
              new TimelinePutResponse.TimelinePutError();
          error.setEntityId(entityID.getId());
          error.setEntityType(entityID.getType());
          error.setErrorCode(
              TimelinePutResponse.TimelinePutError.SYSTEM_FILTER_CONFLICT);
          errors.add(error);
          continue;
        }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.server.timeline.EntityIdentifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.