Package com.netflix.genie.common.exceptions

Examples of com.netflix.genie.common.exceptions.GeniePreconditionException


     * @return the jobInfo for this jobID
     * @throws GenieException For any other error.
     */
    public Job getJob(final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.GET,
                StringUtils.join(
View Full Code Here


     * @throws InterruptedException on timeout/thread errors
     */
    public Job waitForCompletion(final String id, final long blockTimeout, final long pollTime)
            throws GenieException, InterruptedException {
        if (StringUtils.isEmpty(id)) {
            throw new GeniePreconditionException("Missing required parameter: id.");
        }

        final long startTime = System.currentTimeMillis();

        while (true) {
View Full Code Here

     * @return the final job status for this job
     * @throws GenieException For any other error.
     */
    public Job killJob(final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        // this assumes that the service will forward the delete to the right
        // instance
        final HttpRequest request = BaseGenieClient.buildRequest(
View Full Code Here

     */
    public Set<String> addTagsToJob(
            final String id,
            final Set<String> tags) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }
        if (tags == null || tags.isEmpty()) {
            throw new GeniePreconditionException("Missing required parameter: tags");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.POST,
                StringUtils.join(
View Full Code Here

     * @return The set of tags for the given job.
     * @throws GenieException For any other error.
     */
    public Set<String> getTagsForJob(final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.GET,
                StringUtils.join(
View Full Code Here

     */
    public Set<String> updateTagsForJob(
            final String id,
            final Set<String> tags) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }
        if (tags == null) {
            throw new GeniePreconditionException("Missing required parameter: tags");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.PUT,
                StringUtils.join(
View Full Code Here

     * @throws GenieException For any other error.
     */
    public Set<String> removeAllTagsForJob(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.DELETE,
                StringUtils.join(
View Full Code Here

     * @throws GenieException For any other error.
     */
    public Set<String> removeTagForJob(
            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.DELETE,
                StringUtils.join(
View Full Code Here

    @Override
    public Job submitJob(final Job job) throws GenieException {
        LOG.debug("Called");

        if (job == null) {
            throw new GeniePreconditionException("No job entered to run");
        }

        if (StringUtils.isNotBlank(job.getId())
                && this.jobRepo.exists(job.getId())) {
            throw new GenieConflictException("Job with ID specified already exists.");
View Full Code Here

     */
    @Override
    @Transactional(rollbackFor = GenieException.class)
    public Job killJob(final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("No id entered unable to kill job.");
        }
        LOG.debug("called for id: " + id);
        final Job job = this.jobRepo.findOne(id);

        // do some basic error handling
        if (job == null) {
            throw new GenieNotFoundException("No job exists for id " + id + ". Unable to kill.");
        }

        // check if it is done already
        if (job.getStatus() == JobStatus.SUCCEEDED
                || job.getStatus() == JobStatus.KILLED
                || job.getStatus() == JobStatus.FAILED) {
            // job already exited, return status to user
            return job;
        } else if (job.getStatus() == JobStatus.INIT
                || job.getProcessHandle() == -1) {
            // can't kill a job if it is still initializing
            throw new GeniePreconditionException("Unable to kill job as it is still initializing");
        }

        // if we get here, job is still running - and can be killed
        // redirect to the right node if killURI points to a different node
        final String killURI = job.getKillURI();
        if (StringUtils.isBlank(killURI)) {
            throw new GeniePreconditionException("Failed to get killURI for jobID: " + id);
        }
        final String localURI = getEndPoint() + "/" + JOB_RESOURCE_PREFIX + "/" + id;

        if (!killURI.equals(localURI)) {
            LOG.debug("forwarding kill request to: " + killURI);
View Full Code Here

TOP

Related Classes of com.netflix.genie.common.exceptions.GeniePreconditionException

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.