Package org.globus.workspace.scheduler

Examples of org.globus.workspace.scheduler.Reservation


            if (coschedid == null) {
                return this.scheduleImpl(req, preemptable);
            } else {
                this.scheduleCoschedImpl(req, coschedid);
                return new Reservation(ids, null);
            }
           
        } catch (WorkspaceDatabaseException e) {
            this.creationPending.notpending(ids);
            throw new SchedulingException(e.getMessage(), e);
View Full Code Here


                       ResourceRequestDeniedException {

        final String invalidResponse = "Implementation problem: slot " +
                "manager returned invalid response";

        final Reservation res = this.slotManager.reserveSpace(req, preemptable);

        if (res == null) {
            throw new ResourceRequestDeniedException(
                    invalidResponse + ": null response");
        }

        if (res.getResponseLength() == 0) {

            // Because reserveSpace will throw a request denied exception
            // if there was a problem asking for space, no node assignments
            // here we assume means best effort behavior is being used.
            // Check that assumption:

            if (!this.slotManager.isBestEffort()) {
                throw new ResourceRequestDeniedException(
                        invalidResponse + ": no address(es) were returned " +
                                "but not using a best-effort slot manager");
            }

            return res;
        }

        // otherwise, this will be a 'concrete' reservation

        if (res.getResponseLength() != req.getIds().length) {

            logger.fatal("node selection response is length " +
                         res.getResponseLength() +
                         " which does not match requested length " +
                         req.getIds().length + " -- attempting backout.");
           
            for (int i = 0; i < req.getIds().length; i++) {
                try {
                    this.slotManager.releaseSpace(req.getIds()[i]);
                } catch (ManageException e) {
                    if (logger.isDebugEnabled()) {
                        logger.error(e.getMessage(), e);
                    } else {
                        logger.error(e.getMessage());
                    }
                }
            }
            throw new ResourceRequestDeniedException(
                                "internal service error when reserving space");
        }

        final Calendar start = Calendar.getInstance();
        final Calendar stop = Calendar.getInstance();
        stop.add(Calendar.SECOND, req.getDuration());

        res.setStartTime(start);
        res.setStopTime(stop);

        for (int i = 0; i < req.getIds().length; i++) {
            this.db.scheduleTasks(req.getIds()[i], stop);
        }
View Full Code Here

                    "co-scheduling group " + Lager.ensembleid(coschedid) +
                    " has no pending requests stored for it but done is" +
                    " being called?");
        }

        final Reservation res =
                this.slotManager.reserveCoscheduledSpace(reqs, coschedid);

        final String invalidResponse = "Implementation problem: slot " +
                "manager returned invalid response";

        if (res == null) {
            throw new ResourceRequestDeniedException(
                    invalidResponse + ": null response");
        }

        if (res.getResponseLength() == 0) {
           
            // Because reserveCoscheduledSpace should throw a request denied
            // exception if there was a problem asking for space, no node
            // assignments here we assume means best effort behavior is being
            // used. Check that assumption:

            if (!this.slotManager.isBestEffort()) {
                this.fatalityBackoutReservation(res);
                throw new ResourceRequestDeniedException(
                        invalidResponse + ": no address(es) but not a best " +
                                "effort manager");
            }
        }

        // If reserveCoscheduledSpace generated an exception we let it
        // fly and leave the option open to call done again, but from here
        // on it is now done for good.
        try {
            this.db.deleteNodeRequestsAndBeDone(coschedid);
        } catch (Throwable t) {
            String msg = "Problem removing node requests from co-scheduling " +
                    "tracking.  This is severe, should never happen.  " +
                    "Attempting backout of slot reservations, this will " +
                    "probably fail as well.  Problem: \"" + t.getMessage();

            logger.fatal(msg, t);

            final String fullResponse = msg + "\", Backout result: " +
                                  this.fatalityBackoutReservation(res);
            throw new WorkspaceDatabaseException(fullResponse);
        }

        if (!this.slotManager.isBestEffort()) {
           
            // NOTE: coscheduling creates a situation where otherwise
            // not-best-effort slot managers make the DefaultSchedulerAdapter
            // *appear* to the service as a best effort scheduler.  That is OK
            // and expected (because of the add, add, ..."done now" ensemble
            // mechanism).  But this in no way means that the particular slot
            // manager *plugin implementation* as plugin to the
            // DefaultSchedulerAdapter should behave any differently than we
            // expect it to.

            if (!res.hasDurationList()) {
                throw new ResourceRequestDeniedException(
                        invalidResponse + ": no durations");
            }

            final int len = res.getResponseLength();
            for (int i = 0; i < len; i++) {
                final IdHostnameTuple idhost = res.getIdHostnamePair(i);
                final Calendar start = Calendar.getInstance();
                final Calendar stop = Calendar.getInstance();
                stop.add(Calendar.SECOND, res.getDurationByIndex(i));

                try {
                    this.slotReserved(idhost.id,
                                      start,
                                      stop,
View Full Code Here

            final String[] hostnames =
                    this.reserveSpace(vmids, req.getMemory(),
                                      req.getNeededAssociations(),
                                      req.getResourcePool(), preemptable);

            return new Reservation(vmids, hostnames);
        } finally {
            this.releaseWholeManagerLock();
        }
    }
View Full Code Here

            all_ids[i] = ((Number)idInts.get(i)).intValue();
            all_hostnames[i] = (String)allHostnames.get(i);
            all_durations[i] = ((Integer)allDurations.get(i)).intValue();
        }

        return new Reservation(all_ids, all_hostnames, all_durations);
    }
View Full Code Here

                          request.getCores(),
                          request.getDuration(),
                          request.getGroupid(),
                          request.getCreatorDN());

        return new Reservation(request.getIds());
    }
View Full Code Here

        // Assume that the creator's DN is the same for each node
        final String creatorDN = requests[0].getCreatorDN();

        this.reserveSpace(all_ids, highestMemory, highestCores, highestDuration, coschedid, creatorDN);
        return new Reservation(all_ids, null, all_durations);
    }
View Full Code Here

                                 chargeRatio);
        }


        final VirtualMachine oneVM = bindings[0];
        final Reservation res = this.scheduleImpl(oneVM,
                bindings.length,
                groupID,
                coschedID,
                caller.getIdentity());


        // From this point forward an error requires attempt to
        // remove from scheduler       
        if (res == null) {
            throw new SchedulingException("reservation is missing, illegal " +
                    "scheduling implementation");
        }

        try {
            this.bindNetwork.consume(bindings, nics);
        } catch (ResourceRequestDeniedException e) {
            this.backoutScheduling(oneVM, res, groupID);
            throw e;
        } catch (CreationException e) {
            this.backoutScheduling(oneVM, res, groupID);
            throw e;
        } catch (Throwable t) {
            this.backoutScheduling(oneVM, res, groupID);
            throw new CreationException("Unknown problem occurred: " +
                    "'" + ErrorUtil.excString(t) + "'", t);
        }

        // From this point forward an error requires backOutIPAllocations


        final int[] ids = res.getIds();

        try {

            if (bindings.length != ids.length) {
                throw new ProgrammingError(
View Full Code Here

TOP

Related Classes of org.globus.workspace.scheduler.Reservation

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.