Examples of AsyncRequest


Examples of eu.scape_project.watch.domain.AsyncRequest

        final Client clientWithJacksonSerializer = Client.create(cc);
        clientWithJacksonSerializer.addFilter(new LoggingFilter());
        clientWithJacksonSerializer.addFilter(new HTTPBasicAuthFilter(watchUser, watchPassword));
        WebResource resource = clientWithJacksonSerializer.resource(watchEndpoint);

        final AsyncRequest areq = new AsyncRequest("monitor plan: " + plan.getPlanProperties().getName(), triggers);
        final AsyncRequest areq2 = resource.path(KBUtils.ASYNC_REQUEST + ".json/new").accept(MediaType.APPLICATION_JSON)
                .post(AsyncRequest.class, areq);
      } catch (Exception e) {
        throw new PlanningException("Failed to access endpoint.", e);
      }
      } else {
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

        nics = dataConvert.getNICs(nicsAsString);
        AsyncRequestStatus status = AsyncRequestStatus.valueOf(rs.getString("status"));

        //public AsyncRequest(String id, boolean spotinstances, Double spotPrice, boolean persistent, Caller caller, String groupID, VirtualMachine[] bindings, Context context, NIC[] requestedNics, String sshKeyName, Calendar creationTime) {
        //AsyncRequest testRequest = new AsyncRequest(testID, testSpotinstances, testMaxBid, false, null, testGroupID, null, null, null, null, null);
        AsyncRequest asyncRequest = new AsyncRequest(id, isSpotInstance, maxBid, isPersistent, caller, groupID, null, context, nics, sshKeyName, creationTime);

        asyncRequest.setStatus(status);
        return asyncRequest;
    }
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

        DataConvert dataConvert = new DataConvert(this.locator.getReprFactory());
        NIC[] testNICs = dataConvert.getNICs(testVM);
        logger.debug("Nics: " + testNICs[0]);

        //public AsyncRequest(String id, boolean spotinstances, Double spotPrice, boolean persistent, Caller caller, String groupID, VirtualMachine[] bindings, Context context, NIC[] requestedNics, String sshKeyName, Calendar creationTime) {
        AsyncRequest testRequest = new AsyncRequest(testID, testSpotinstances, testMaxBid, testIsPersistent, testCaller, testGroupID, testBindings, context, testNICs, testSshKeyName, testCreationTime);
        testRequest.addAllocatedVM(testAllocatedVM);
        asyncRequestMap.addOrReplace(testRequest);

        String secondID = "this-is-the-other-one";
        double secondMaxBid = 4.5;
        VirtualMachine[] secondBindings = new VirtualMachine[1];
        VirtualMachine secondVM = new VirtualMachine();
        secondVM.setID(52);
        secondBindings[0] = secondVM;

        AsyncRequest secondRequest = new AsyncRequest(secondID, testSpotinstances, secondMaxBid, testIsPersistent, testCaller, testGroupID, secondBindings, context, testNICs, testSshKeyName, testCreationTime);

        allRequests = asyncRequestMap.getAll();
        assert(allRequests != null);
        logger.debug("You have " + allRequests.size() + " requests.");
        assert(allRequests.size() == 1);

        // Note, the persistence layer just dumps the context, so we don't test for it

        AsyncRequest gotRequest = asyncRequestMap.getByID(testID);
        assertEquals(testID, gotRequest.getId());
        assertEquals(testMaxBid, gotRequest.getMaxBid());
        assertEquals(testSpotinstances, gotRequest.isSpotRequest());
        assertEquals(testGroupID, gotRequest.getGroupID());
        assertEquals(testIsPersistent, gotRequest.isPersistent());
        assertEquals(testCaller, gotRequest.getCaller());
        assertEquals(testSshKeyName, gotRequest.getSshKeyName());
        assertEquals(testCreationTime, gotRequest.getCreationTime());
        assertEquals(testVM.getID(), gotRequest.getBindings()[0].getID());
        assertEquals(testNICs[0].getIpAddress(), gotRequest.getRequestedNics()[0].getIpAddress());
        assertEquals(testAllocatedVM, gotRequest.getAllocatedVMs()[0]);
        assertEquals(AsyncRequestStatus.OPEN, gotRequest.getStatus());


        //Now Mutate the Map
        asyncRequestMap.addOrReplace(secondRequest);

        gotRequest.setStatus(AsyncRequestStatus.ACTIVE);
        asyncRequestMap.addOrReplace(gotRequest);

        AsyncRequest gotSecondRequest = asyncRequestMap.getByID(secondID);
        AsyncRequest updatedRequest = asyncRequestMap.getByID(testID);
        assertEquals(AsyncRequestStatus.ACTIVE, updatedRequest.getStatus());
        assertEquals(testAllocatedVM, updatedRequest.getAllocatedVMs()[0]);

        asyncRequestMap.addOrReplace(updatedRequest);
        AsyncRequest updatedRequest1 = asyncRequestMap.getByID(testID);
        assertEquals(testAllocatedVM, updatedRequest1.getAllocatedVMs()[0]);
        assertEquals(0, gotSecondRequest.getAllocatedVMs().length);
    }
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

        }

        VM vm = this.dataConvert.getVM(resource);
       
        if(VMConstants.LIFE_CYCLE_SPOT.equals(vm.getLifeCycle())){
            AsyncRequest request = asyncHome.getRequestFromVM(Integer.valueOf(vm.getID()));
            if(request != null){
                ((_VM)vm).setSpotInstanceRequestID(request.getId());
            }
        }
       
        return vm;
    }
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

                   CreationException,
                   MetadataException,
                   ResourceRequestDeniedException,
                   SchedulingException {

        AsyncRequest siRequest = this.creation.addAsyncRequest(req, caller);
       
        try {
            return dataConvert.getSpotRequest(siRequest);
        } catch (CannotTranslateException e) {
            throw new MetadataException("Could not translate request from internal representation to RM API representation.", e);
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

            throws DoesNotExistException, ManageException, AuthorizationException {
       
        SpotRequestInfo[] result = new SpotRequestInfo[ids.length];
       
        for (int i = 0; i < ids.length; i++) {
            AsyncRequest siReq = asyncHome.getRequest(ids[i]);
           
            authorizeCaller(caller, siReq);
           
            result[i] = getSpotRequest(siReq);
        }
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

    public SpotRequestInfo[] cancelSpotInstanceRequests(String[] ids, Caller caller)
            throws DoesNotExistException, AuthorizationException, ManageException {
        SpotRequestInfo[] result = new SpotRequestInfo[ids.length];
       
        for (int i = 0; i < ids.length; i++) {
            AsyncRequest siReq = asyncHome.getRequest(ids[i]);
           
            authorizeCaller(caller, siReq);
           
            result[i] = getSpotRequest(asyncHome.cancelRequest(ids[i]));
        }
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

   
    public RequestInfo addBackfillRequest(AsyncCreateRequest req, Caller caller)
            throws AuthorizationException, CoSchedulingException,
            CreationException, MetadataException,
            ResourceRequestDeniedException, SchedulingException {
        AsyncRequest backfillRequest = this.creation.addAsyncRequest(req, caller);
       
        try {
            return dataConvert.getRequestInfo(backfillRequest);
        } catch (CannotTranslateException e) {
            throw new MetadataException("Could not translate request from internal representation to RM API representation.", e);
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

    public RequestInfo[] cancelBackfillRequests(String[] ids, Caller caller)
            throws DoesNotExistException, AuthorizationException,
            ManageException {

        for (int i = 0; i < ids.length; i++) {
            AsyncRequest backfillReq = this.asyncHome.getRequest(ids[i]);
            authorizeCaller(caller, backfillReq);
        }

        AsyncRequest[] reqs = this.asyncHome.cancelRequests(ids);
View Full Code Here

Examples of org.globus.workspace.async.AsyncRequest

            throws DoesNotExistException, ManageException,
            AuthorizationException {
        RequestInfo[] result = new RequestInfo[ids.length];
       
        for (int i = 0; i < ids.length; i++) {
            AsyncRequest backfillReq = asyncHome.getRequest(ids[i]);
           
            authorizeCaller(caller, backfillReq);
           
            result[i] = getRequestInfo(backfillReq);
        }
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.