Examples of JobException


Examples of ch.entwine.weblounge.common.scheduler.JobException

    Site site = (Site) ctx.get(Site.class.getName());

    // Get hold of the content repository
    WritableContentRepository contentRepository = null;
    if (site.getContentRepository().isReadOnly())
      throw new JobException(this, "Content repository of site '" + site + "' is read only");
    contentRepository = (WritableContentRepository) site.getContentRepository();

    // Read the configuration value for the repository url
    String repositoryUrl = (String) ctx.get(OPT_REPOSITORY_URL);
    if (StringUtils.isBlank(repositoryUrl))
      throw new JobException(this, "Configuration option '" + OPT_REPOSITORY_URL + "' is missing from the job configuration");

    // Make sure the url is well formed
    URL url = null;
    try {
      url = new URL(repositoryUrl);
    } catch (MalformedURLException e) {
      throw new JobException(this, "Repository url '" + repositoryUrl + "' is malformed: " + e.getMessage());
    }

    // Read the configuration value for the flavors
    String presentationTrackFlavor = (String) ctx.get(OPT_PRSENTATION_TRACK_FLAVORS);
    if (StringUtils.isBlank(presentationTrackFlavor))
      throw new JobException(this, "Configuration option '" + OPT_PRSENTATION_TRACK_FLAVORS + "' is missing from the job configuration");

    String presenterTrackFlavor = (String) ctx.get(OPT_PRESENTER_TRACK_FLAVORS);
    if (StringUtils.isBlank(presenterTrackFlavor))
      throw new JobException(this, "Configuration option '" + OPT_PRESENTER_TRACK_FLAVORS + "' is missing from the job configuration");

    String dcEpisodeFlavor = (String) ctx.get(OPT_EPISODE_DC_FLAVORS);
    if (StringUtils.isBlank(dcEpisodeFlavor))
      throw new JobException(this, "Configuration option '" + OPT_EPISODE_DC_FLAVORS + "' is missing from the job configuration");

    String dcSeriesFlavor = (String) ctx.get(OPT_SERIES_DC_FLAVORS);
    if (StringUtils.isBlank(dcSeriesFlavor))
      throw new JobException(this, "Configuration option '" + OPT_SERIES_DC_FLAVORS + "' is missing from the job configuration");
   
    String mimesTypes = (String) ctx.get(OPT_MIMETYPES);
    if (StringUtils.isBlank(mimesTypes))
      throw new JobException(this, "Configuration option '" + OPT_MIMETYPES + "' is missing from the job configuration");
   
   
    // Read the configuration value for the handler class
    String handlerClass = (String) ctx.get(OPT_HANDLER_CLASS);
    if (StringUtils.isBlank(handlerClass))
      throw new JobException(this, "Configuration option '" + OPT_HANDLER_CLASS + "' is missing from the job configuration");

    UserImpl harvesterUser = new UserImpl(name, site.getIdentifier(), "Harvester");

    RecordHandler handler;
    try {
View Full Code Here

Examples of ch.entwine.weblounge.common.scheduler.JobException

      if (StringUtils.isBlank(provider)) {
        provider = DEFAULT_PROVIDER;
      }
      account = new Account(ctx);
    } catch (IllegalArgumentException e) {
      throw new JobException(this, e);
    }

    // Connect to the server
    Properties sessionProperties = new Properties();
    Session session = Session.getDefaultInstance(sessionProperties, null);
    Store store = null;
    Folder inbox = null;

    try {

      // Connect to the server
      try {
        store = session.getStore(provider);
        store.connect(account.getHost(), account.getLogin(), account.getPassword());
      } catch (NoSuchProviderException e) {
        throw new JobException(this, "Unable to connect using unknown e-mail provider '" + provider + "'", e);
      } catch (MessagingException e) {
        throw new JobException(this, "Error connecting to " + provider + " account " + account, e);
      }

      // Open the account's inbox
      try {
        inbox = store.getFolder(INBOX);
        if (inbox == null)
          throw new JobException(this, "No inbox found at " + account);
        inbox.open(Folder.READ_WRITE);
      } catch (MessagingException e) {
        throw new JobException(this, "Error connecting to inbox at " + account, e);
      }

      // Get the messages from the server
      try {
        for (Message message : inbox.getMessages()) {
          if (!message.isSet(Flag.SEEN)) {
            try {
              Page page = aggregate(message, site);
              message.setFlag(Flag.DELETED, true);
              repository.put(page, true);
              logger.info("E-Mail message published at {}", page.getURI());
            } catch (Exception e) {
              logger.info("E-Mail message discarded: {}", e.getMessage());
              message.setFlag(Flag.SEEN, true);
              // TODO: Reply to sender if the "from" field exists
            }
          }
        }
      } catch (MessagingException e) {
        throw new JobException(this, "Error loading e-mail messages from inbox", e);
      }

      // Close the connection
      // but don't remove the messages from the server
    } finally {
      if (inbox != null) {
        try {
          inbox.close(true);
        } catch (MessagingException e) {
          throw new JobException(this, "Error closing inbox", e);
        }
      }
      if (store != null) {
        try {
          store.close();
        } catch (MessagingException e) {
          throw new JobException(this, "Error closing connection to e-mail server", e);
        }
      }
    }

  }
View Full Code Here

Examples of ch.entwine.weblounge.common.scheduler.JobException

    // Update the context
    lastContext = ctx;
    ctx.put(CTX_EXECUTIONS, Integer.valueOf(executions));

    if (executions == JOB_EXCEPTION_COUNT)
      throw new JobException(this, "The third execution always triggers this exception");
    if (executions == ARITHMETIC_EXCEPTION_COUNT)
      throw new ArithmeticException("The tenth execution always triggers this exception");
  }
View Full Code Here

Examples of org.apache.flink.runtime.JobException

      ExecutionJobVertex ejv = new ExecutionJobVertex(this, jobVertex, 1, createTimestamp);
      ejv.connectToPredecessors(this.intermediateResults);
     
      ExecutionJobVertex previousTask = this.tasks.putIfAbsent(jobVertex.getID(), ejv);
      if (previousTask != null) {
        throw new JobException(String.format("Encountered two job vertices with ID %s : previous=[%s] / new=[%s]",
            jobVertex.getID(), ejv, previousTask));
      }
     
      for (IntermediateResult res : ejv.getProducedDataSets()) {
        IntermediateResult previousDataSet = this.intermediateResults.putIfAbsent(res.getId(), res);
        if (previousDataSet != null) {
          throw new JobException(String.format("Encountered two intermediate data set with ID %s : previous=[%s] / new=[%s]",
              res.getId(), res, previousDataSet));
        }
      }
     
      this.verticesInCreationOrder.add(ejv);
View Full Code Here

Examples of org.apache.flink.runtime.JobException

    // sanity checks
    if (slot == null) {
      throw new NullPointerException();
    }
    if (!slot.isAlive()) {
      throw new JobException("Traget slot for deployment is not alive.");
    }
   
    // make sure exactly one deployment call happens from the correct state
    // note: the transition from CREATED to DEPLOYING is for testing purposes only
    ExecutionState previous = this.state;
    if (previous == SCHEDULED || previous == CREATED) {
      if (!transitionState(previous, DEPLOYING)) {
        // race condition, someone else beat us to the deploying call.
        // this should actually not happen and indicates a race somewhere else
        throw new IllegalStateException("Cannot deploy task: Concurrent deployment call race.");
      }
    }
    else {
      // vertex may have been cancelled, or it was already scheduled
      throw new IllegalStateException("The vertex must be in CREATED or SCHEDULED state to be deployed. Found state " + previous);
    }
   
    try {
      // good, we are allowed to deploy
      if (!slot.setExecutedVertex(this)) {
        throw new JobException("Could not assign the ExecutionVertex to the slot " + slot);
      }
      this.assignedResource = slot;
     
      // race double check, did we fail/cancel and do we need to release the slot?
      if (this.state != DEPLOYING) {
View Full Code Here

Examples of org.apache.flink.runtime.JobException

    this.slotSharingGroup = jobVertex.getSlotSharingGroup();
    this.coLocationGroup = jobVertex.getCoLocationGroup();
   
    // setup the coLocation group
    if (coLocationGroup != null && slotSharingGroup == null) {
      throw new JobException("Vertex uses a co-location constraint without using slot sharing");
    }
   
    // create the intermediate results
    this.producedDataSets = new IntermediateResult[jobVertex.getNumberOfProducedIntermediateDataSets()];
    for (int i = 0; i < jobVertex.getProducedDataSets().size(); i++) {
      IntermediateDataSet set = jobVertex.getProducedDataSets().get(i);
      this.producedDataSets[i] = new IntermediateResult(set.getId(), this, numTaskVertices);
    }
   
    // create all task vertices
    for (int i = 0; i < numTaskVertices; i++) {
      ExecutionVertex vertex = new ExecutionVertex(this, i, this.producedDataSets, createTimestamp);
      this.taskVertices[i] = vertex;
    }
   
    // sanity check for the double referencing between intermediate result partitions and execution vertices
    for (IntermediateResult ir : this.producedDataSets) {
      if (ir.getNumberOfAssignedPartitions() != parallelism) {
        throw new RuntimeException("The intermediate result's partitions were not correctly assiged.");
      }
    }
   
    // set up the input splits, if the vertex has any
    try {
      @SuppressWarnings("unchecked")
      InputSplitSource<InputSplit> splitSource = (InputSplitSource<InputSplit>) jobVertex.getInputSplitSource();
      if (splitSource != null) {
        this.inputSplits = splitSource.createInputSplits(numTaskVertices);
        this.splitAssigner = splitSource.getInputSplitAssigner(this.inputSplits);
      } else {
        this.inputSplits = null;
        this.splitAssigner = null;
      }
    }
    catch (Throwable t) {
      throw new JobException("Creating the input splits caused an error: " + t.getMessage(), t);
    }
   
    this.finishedSubtasks = new boolean[parallelism];
  }
View Full Code Here

Examples of org.apache.flink.runtime.JobException

     
      // fetch the intermediate result via ID. if it does not exist, then it either has not been created, or the order
      // in which this method is called for the job vertices is not a topological order
      IntermediateResult ires = intermediateDataSets.get(edge.getSourceId());
      if (ires == null) {
        throw new JobException("Cannot connect this job graph to the previous graph. No previous intermediate result found for ID "
            + edge.getSourceId());
      }
     
      this.inputs.add(ires);
     
View Full Code Here

Examples of org.apache.flink.runtime.JobException

            job.getNumberOfExecutionRetries() : this.defaultExecutionRetries);
        executionGraph.setDelayBeforeRetrying(this.delayBetweenRetries);

        ExecutionGraph previous = this.currentJobs.putIfAbsent(job.getJobID(), executionGraph);
        if (previous != null) {
          throw new JobException("Concurrent submission of a job with the same jobId: " + job.getJobID());
        }
      }
      else {
        if (LOG.isInfoEnabled()) {
          LOG.info(String.format("Found existing execution graph for id %s, attaching this job.", job.getJobID()));
        }
      }

      // Register for updates on the job status
      executionGraph.registerJobStatusListener(this);
     
      // grab the class loader for user-defined code
      final ClassLoader userCodeLoader = libraryCacheManager.getClassLoader(job.getJobID());
      if (userCodeLoader == null) {
        throw new JobException("The user code class loader could not be initialized.");
      }

      // first, perform the master initialization of the nodes
      if (LOG.isDebugEnabled()) {
        LOG.debug(String.format("Running master initialization of job %s (%s)", job.getJobID(), job.getName()));
      }

      for (AbstractJobVertex vertex : job.getVertices()) {
        // check that the vertex has an executable class
        String executableClass = vertex.getInvokableClassName();
        if (executableClass == null || executableClass.length() == 0) {
          throw new JobException(String.format("The vertex %s (%s) has no invokable class.", vertex.getID(), vertex.getName()));
        }

        // master side initialization
        vertex.initializeOnMaster(userCodeLoader);
      }
View Full Code Here

Examples of org.exist.scheduler.JobException

        }

        public void execute(final BrokerPool brokerpool, final Map<String, ?> params) throws JobException {
            final SessionManager manager = (SessionManager)params.get("session-manager");
            if (manager == null) {
                throw new JobException(JobExceptionAction.JOB_ABORT, "parameter 'session-manager' is not set");
            }
            manager.timeoutCheck();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.