Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

-added RM API support to backfill requests

-renamed SI related classes to Async
  • Loading branch information...
commit 7b5cbfd62073339b924c211dd3a3a09744b846e4 1 parent 3048a2c
Paulo Ricardo Motta Gomes pauloricardomg authored
Showing with 634 additions and 195 deletions.
  1. +24 −0 service-api/java/source/src/org/nimbustools/api/_repr/_AsyncCreateRequest.java
  2. +5 −7 service-api/java/source/src/org/nimbustools/api/_repr/{_SpotRequest.java → _RequestInfo.java}
  3. +4 −6 service-api/java/source/src/org/nimbustools/api/_repr/{_RequestSI.java → _SpotCreateRequest.java}
  4. +25 −0 service-api/java/source/src/org/nimbustools/api/_repr/_SpotRequestInfo.java
  5. +2 −2 service-api/java/source/src/org/nimbustools/api/_repr/si/_SIRequestState.java
  6. +77 −0 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultAsyncCreateRequest.java
  7. +11 −1 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultReprFactory.java
  8. +19 −48 .../java/source/src/org/nimbustools/api/defaults/repr/{DefaultSpotRequest.java → DefaultRequestInfo.java}
  9. +8 −18 ...a/source/src/org/nimbustools/api/defaults/repr/{DefaultRequestSI.java → DefaultSpotCreateRequest.java}
  10. +97 −0 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultSpotRequestInfo.java
  11. +56 −8 service-api/java/source/src/org/nimbustools/api/defaults/services/rm/DefaultManager.java
  12. +23 −0 service-api/java/source/src/org/nimbustools/api/repr/AsyncCreateRequest.java
  13. +9 −3 service-api/java/source/src/org/nimbustools/api/repr/ReprFactory.java
  14. +24 −0 service-api/java/source/src/org/nimbustools/api/repr/RequestInfo.java
  15. +1 −2  service-api/java/source/src/org/nimbustools/api/repr/{RequestSI.java → SpotCreateRequest.java}
  16. +2 −21 service-api/java/source/src/org/nimbustools/api/repr/{SpotRequest.java → SpotRequestInfo.java}
  17. +1 −1  service-api/java/source/src/org/nimbustools/api/repr/si/{SIRequestState.java → RequestState.java}
  18. +36 −8 service-api/java/source/src/org/nimbustools/api/services/rm/Manager.java
  19. +25 −5 service/service/java/source/etc/workspace-service/other/main.repr.xml
  20. +1 −1  service/service/java/source/etc/workspace-service/other/resource-locator-ACTIVE.xml
  21. +1 −1  service/service/java/source/etc/workspace-service/other/resource-locator-default.xml
  22. +3 −3 service/service/java/source/src/org/globus/workspace/creation/CreationManager.java
  23. +20 −10 service/service/java/source/src/org/globus/workspace/creation/defaults/CreationManagerImpl.java
  24. +110 −25 service/service/java/source/src/org/globus/workspace/manager/DelegatingManager.java
  25. +50 −25 service/service/java/source/src/org/globus/workspace/persistence/DataConvert.java
24 service-api/java/source/src/org/nimbustools/api/_repr/_AsyncCreateRequest.java
View
@@ -0,0 +1,24 @@
+/*
+ * Copyright 1999-2008 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.nimbustools.api._repr;
+
+import org.nimbustools.api.repr.AsyncCreateRequest;
+
+public interface _AsyncCreateRequest extends AsyncCreateRequest, _CreateRequest {
+
+ public void setInstanceType(String instanceType);
+}
12 ...e/src/org/nimbustools/api/_repr/_SpotRequest.java → ...e/src/org/nimbustools/api/_repr/_RequestInfo.java
View
@@ -19,17 +19,15 @@
import java.util.Calendar;
import org.nimbustools.api.repr.Caller;
-import org.nimbustools.api.repr.SpotRequest;
-import org.nimbustools.api.repr.si.SIRequestState;
+import org.nimbustools.api.repr.RequestInfo;
+import org.nimbustools.api.repr.si.RequestState;
import org.nimbustools.api.repr.vm.ResourceAllocation;
import org.nimbustools.api.repr.vm.VMFile;
-public interface _SpotRequest extends SpotRequest {
+public interface _RequestInfo extends RequestInfo {
- public void setRequestID(String requestId);
- public void setSpotPrice(Double spotPrice);
- public void setPersistent(boolean persistent);
- public void setState(SIRequestState state);
+ public void setRequestID(String requestId);
+ public void setState(RequestState state);
public void setCreationTime(Calendar date);
public void setVMIds(String[] ids);
public void setInstanceCount(Integer instanceCount);
10 ...rce/src/org/nimbustools/api/_repr/_RequestSI.java → ...org/nimbustools/api/_repr/_SpotCreateRequest.java
View
@@ -16,13 +16,11 @@
package org.nimbustools.api._repr;
-import org.nimbustools.api.repr.RequestSI;
+import org.nimbustools.api.repr.SpotCreateRequest;
-public interface _RequestSI extends RequestSI, _CreateRequest {
+public interface _SpotCreateRequest extends SpotCreateRequest, _AsyncCreateRequest {
- public void setInstanceType(String instanceType);
-
- public void setSpotPrice(Double spotPrice);
-
+ public void setSpotPrice(Double spotPrice);
public void setPersistent(boolean persistent);
+
}
25 service-api/java/source/src/org/nimbustools/api/_repr/_SpotRequestInfo.java
View
@@ -0,0 +1,25 @@
+/*
+ * Copyright 1999-2008 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.nimbustools.api._repr;
+
+import org.nimbustools.api.repr.SpotRequestInfo;
+
+public interface _SpotRequestInfo extends _RequestInfo, SpotRequestInfo {
+
+ public void setSpotPrice(Double spotPrice);
+ public void setPersistent(boolean persistent);
+}
4 service-api/java/source/src/org/nimbustools/api/_repr/si/_SIRequestState.java
View
@@ -16,9 +16,9 @@
package org.nimbustools.api._repr.si;
-import org.nimbustools.api.repr.si.SIRequestState;
+import org.nimbustools.api.repr.si.RequestState;
-public interface _SIRequestState extends SIRequestState {
+public interface _SIRequestState extends RequestState {
public void setState(String state);
public void setProblem(Throwable e);
77 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultAsyncCreateRequest.java
View
@@ -0,0 +1,77 @@
+/*
+ * Copyright 1999-2008 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.nimbustools.api.defaults.repr;
+
+import java.util.Arrays;
+
+import org.nimbustools.api._repr._AsyncCreateRequest;
+
+public class DefaultAsyncCreateRequest extends DefaultCreateRequest implements _AsyncCreateRequest {
+
+ // -------------------------------------------------------------------------
+ // INSTANCE VARIABLES
+ // -------------------------------------------------------------------------
+
+ protected String instanceType;
+ // -------------------------------------------------------------------------
+ // implements org.nimbustools.api.repr.AsyncCreateRequest
+ // -------------------------------------------------------------------------
+
+ public String getInstanceType() {
+ return this.instanceType;
+ }
+
+ // -------------------------------------------------------------------------
+ // implements org.nimbustools.api._repr._AsyncCreateRequest
+ // -------------------------------------------------------------------------
+
+ public void setInstanceType(String instanceType) {
+ this.instanceType = instanceType;
+ }
+
+ // -------------------------------------------------------------------------
+ // DEBUG STRING
+ // -------------------------------------------------------------------------
+
+ public String toString() {
+ final boolean userDataPresent = this.mdUserData != null;
+ final String prefix = "\n\n{{{ ";
+ return "\nDefaultCreateSpotRequest" +
+ prefix + "name='" + this.name + '\'' +
+ prefix + "vmFiles=" +
+ (this.vmFiles == null ? null : Arrays.asList(this.vmFiles)) +
+ prefix + "nics=" +
+ (this.nics == null ? null : Arrays.asList(this.nics)) +
+ prefix + "schedule=" + this.schedule +
+ prefix + "coscheduleID='" + this.coscheduleID + "'" +
+ prefix + "coscheduleDone=" + this.coscheduleDone +
+ prefix + "coscheduleMember=" + this.coscheduleMember +
+ prefix + "ra=" + this.ra +
+ prefix + "requiredVMM=" + this.requiredVMM +
+ prefix + "kernel=" + this.kernel +
+ prefix + "custRequests=" +
+ (this.custRequests == null ? null : Arrays.asList(this.custRequests)) +
+ prefix + "shutdownType='" + this.shutdownType + "'" +
+ prefix + "userDataPresent? " + userDataPresent +
+ prefix + "initialStateRequest='" + this.initialStateRequest + "'" +
+ prefix + "sshKeyName='" + this.sshKeyName + "'" +
+ prefix + "context=" + this.context + "'" +
+ prefix + "instanceType=" + this.instanceType + "\n";
+
+ }
+
+}
12 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultReprFactory.java
View
@@ -17,11 +17,16 @@
package org.nimbustools.api.defaults.repr;
import org.nimbustools.api._repr._Advertised;
+import org.nimbustools.api._repr._AsyncCreateRequest;
import org.nimbustools.api._repr._Caller;
import org.nimbustools.api._repr._CreateRequest;
import org.nimbustools.api._repr._CreateResult;
import org.nimbustools.api._repr._CustomizationRequest;
+import org.nimbustools.api._repr._RequestInfo;
import org.nimbustools.api._repr._ShutdownTasks;
+import org.nimbustools.api._repr._SpotCreateRequest;
+import org.nimbustools.api._repr._SpotPriceEntry;
+import org.nimbustools.api._repr._SpotRequestInfo;
import org.nimbustools.api._repr._Usage;
import org.nimbustools.api._repr.ctx._Context;
import org.nimbustools.api._repr.vm._Kernel;
@@ -58,7 +63,12 @@ public String report() {
public abstract _CustomizationRequest _newCustomizationRequest();
public abstract _ShutdownTasks _newShutdownTasks();
public abstract _Usage _newUsage();
-
+ public abstract _RequestInfo _newRequestInfo();
+ public abstract _SpotRequestInfo _newSpotRequestInfo();
+ public abstract _SpotPriceEntry _newSpotPriceEntry();
+ public abstract _AsyncCreateRequest _newBackfillRequest();
+ public abstract _SpotCreateRequest _newSpotCreateRequest();
+
// vm package
public abstract _Kernel _newKernel();
public abstract _NIC _newNIC();
67 ...ustools/api/defaults/repr/DefaultSpotRequest.java → ...ustools/api/defaults/repr/DefaultRequestInfo.java
View
@@ -19,31 +19,29 @@
import java.util.Arrays;
import java.util.Calendar;
-import org.nimbustools.api._repr._SpotRequest;
+import org.nimbustools.api._repr._RequestInfo;
import org.nimbustools.api.repr.Caller;
-import org.nimbustools.api.repr.si.SIRequestState;
+import org.nimbustools.api.repr.si.RequestState;
import org.nimbustools.api.repr.vm.ResourceAllocation;
import org.nimbustools.api.repr.vm.VMFile;
-public class DefaultSpotRequest implements _SpotRequest {
+public class DefaultRequestInfo implements _RequestInfo {
// -------------------------------------------------------------------------
// INSTANCE VARIABLES
// -------------------------------------------------------------------------
- private String requestId;
- private String groupid;
- private Calendar creationTime;
- private boolean persistent;
- private VMFile[] vmFiles;
- private ResourceAllocation resourceAllocation;
- private SIRequestState state;
- private Caller creator;
- private String mdUserData;
- private String sshKeyName;
- private Double spotPrice;
- private String[] vmIds;
- private Integer instanceCount;
+ protected String requestId;
+ protected String groupid;
+ protected Calendar creationTime;
+ protected VMFile[] vmFiles;
+ protected ResourceAllocation resourceAllocation;
+ protected RequestState state;
+ protected Caller creator;
+ protected String mdUserData;
+ protected String sshKeyName;
+ protected String[] vmIds;
+ protected Integer instanceCount;
// -------------------------------------------------------------------------
// implements org.nimbustools.api.repr.RequestSIResult
@@ -65,10 +63,6 @@ public Calendar getCreationTime() {
return creationTime;
}
- public boolean isPersistent() {
- return persistent;
- }
-
public VMFile[] getVMFiles() {
return vmFiles;
}
@@ -77,7 +71,7 @@ public ResourceAllocation getResourceAllocation() {
return resourceAllocation;
}
- public SIRequestState getState() {
+ public RequestState getState() {
return state;
}
@@ -105,11 +99,6 @@ public String getSshKeyName() {
return sshKeyName;
}
-
- public Double getSpotPrice() {
- return spotPrice;
- }
-
public String[] getVMIds() {
return this.vmIds;
}
@@ -122,10 +111,6 @@ public void setInstanceCount(Integer instanceCount) {
this.instanceCount = instanceCount;
}
- public void setPersistent(boolean persistent) {
- this.persistent = persistent;
- }
-
public void setVMFiles(VMFile[] vmFiles) {
this.vmFiles = vmFiles;
}
@@ -134,7 +119,7 @@ public void setResourceAllocation(ResourceAllocation resourceAllocation) {
this.resourceAllocation = resourceAllocation;
}
- public void setState(SIRequestState state) {
+ public void setState(RequestState state) {
this.state = state;
}
@@ -150,10 +135,6 @@ public void setSshKeyName(String sshKeyName) {
this.sshKeyName = sshKeyName;
}
- public void setSpotPrice(Double spotPrice) {
- this.spotPrice = spotPrice;
- }
-
public void setVMIds(String[] ids) {
this.vmIds = ids;
}
@@ -168,7 +149,6 @@ public int hashCode() {
result = prime * result + ((groupid == null) ? 0 : groupid.hashCode());
result = prime * result
+ ((mdUserData == null) ? 0 : mdUserData.hashCode());
- result = prime * result + (persistent ? 1231 : 1237);
result = prime * result
+ ((requestId == null) ? 0 : requestId.hashCode());
result = prime
@@ -176,8 +156,6 @@ public int hashCode() {
+ ((resourceAllocation == null) ? 0 : resourceAllocation
.hashCode());
result = prime * result
- + ((spotPrice == null) ? 0 : spotPrice.hashCode());
- result = prime * result
+ ((sshKeyName == null) ? 0 : sshKeyName.hashCode());
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + Arrays.hashCode(vmFiles);
@@ -192,7 +170,7 @@ public boolean equals(Object obj) {
return false;
if (getClass() != obj.getClass())
return false;
- DefaultSpotRequest other = (DefaultSpotRequest) obj;
+ DefaultRequestInfo other = (DefaultRequestInfo) obj;
if (creationTime == null) {
if (other.creationTime != null)
return false;
@@ -213,8 +191,6 @@ public boolean equals(Object obj) {
return false;
} else if (!mdUserData.equals(other.mdUserData))
return false;
- if (persistent != other.persistent)
- return false;
if (requestId == null) {
if (other.requestId != null)
return false;
@@ -225,11 +201,6 @@ public boolean equals(Object obj) {
return false;
} else if (!resourceAllocation.equals(other.resourceAllocation))
return false;
- if (spotPrice == null) {
- if (other.spotPrice != null)
- return false;
- } else if (!spotPrice.equals(other.spotPrice))
- return false;
if (sshKeyName == null) {
if (other.sshKeyName != null)
return false;
@@ -249,9 +220,9 @@ public boolean equals(Object obj) {
public String toString() {
return "DefaultSpotRequest [creationTime=" + creationTime
+ ", creator=" + creator + ", groupid=" + groupid
- + ", mdUserData=" + mdUserData + ", persistent=" + persistent
+ + ", mdUserData=" + mdUserData
+ ", requestId=" + requestId + ", resourceAllocation="
- + resourceAllocation + ", spotPrice=" + spotPrice
+ + resourceAllocation
+ ", sshKeyName=" + sshKeyName + ", state=" + state
+ ", vmFiles=" + Arrays.toString(vmFiles) + "]";
}
26 ...mbustools/api/defaults/repr/DefaultRequestSI.java → ...s/api/defaults/repr/DefaultSpotCreateRequest.java
View
@@ -18,20 +18,19 @@
import java.util.Arrays;
-import org.nimbustools.api._repr._RequestSI;
+import org.nimbustools.api._repr._SpotCreateRequest;
-public class DefaultRequestSI extends DefaultCreateRequest implements _RequestSI {
+public class DefaultSpotCreateRequest extends DefaultAsyncCreateRequest implements _SpotCreateRequest {
// -------------------------------------------------------------------------
// INSTANCE VARIABLES
// -------------------------------------------------------------------------
- private String instanceType;
- private Double spotPrice;
- private boolean persistent;
+ protected Double spotPrice;
+ protected boolean persistent;
// -------------------------------------------------------------------------
- // implements org.nimbustools.api.repr.RequestSI
+ // implements org.nimbustools.api.repr.SpotCreateRequest
// -------------------------------------------------------------------------
@@ -41,14 +40,10 @@ public Double getSpotPrice() {
public boolean isPersistent() {
return this.persistent;
- }
-
- public String getInstanceType() {
- return null;
}
// -------------------------------------------------------------------------
- // implements org.nimbustools.api._repr._RequestSI
+ // implements org.nimbustools.api._repr._SpotCreateRequest
// -------------------------------------------------------------------------
public void setSpotPrice(Double spotPrice) {
@@ -57,11 +52,7 @@ public void setSpotPrice(Double spotPrice) {
public void setPersistent(boolean persistent) {
this.persistent = persistent;
- }
-
- public void setInstanceType(String instanceType) {
- this.instanceType = instanceType;
- }
+ }
// -------------------------------------------------------------------------
// DEBUG STRING
@@ -92,8 +83,7 @@ public String toString() {
prefix + "context=" + this.context + "'" +
prefix + "instanceType=" + this.instanceType + "'" +
prefix + "persistent=" + this.persistent + "'" +
- prefix + "spotPrice='" + this.spotPrice + "\n";
-
+ prefix + "spotPrice='" + this.spotPrice + "\n";
}
}
97 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultSpotRequestInfo.java
View
@@ -0,0 +1,97 @@
+/*
+ * Copyright 1999-2008 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.nimbustools.api.defaults.repr;
+
+import java.util.Arrays;
+
+import org.nimbustools.api._repr._SpotRequestInfo;
+
+public class DefaultSpotRequestInfo extends DefaultRequestInfo implements _SpotRequestInfo {
+
+ // -------------------------------------------------------------------------
+ // INSTANCE VARIABLES
+ // -------------------------------------------------------------------------
+
+ private boolean persistent;
+ private Double spotPrice;
+
+ // -------------------------------------------------------------------------
+ // implements org.nimbustools.api.repr.RequestSIResult
+ // -------------------------------------------------------------------------
+
+ public boolean isPersistent() {
+ return persistent;
+ }
+
+ public Double getSpotPrice() {
+ return spotPrice;
+ }
+
+ // -------------------------------------------------------------------------
+ // implements org.nimbustools.api._repr._RequestSIResult
+ // -------------------------------------------------------------------------
+
+ public void setPersistent(boolean persistent) {
+ this.persistent = persistent;
+ }
+
+ public void setSpotPrice(Double spotPrice) {
+ this.spotPrice = spotPrice;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + (persistent ? 1231 : 1237);
+ result = prime * result
+ + ((spotPrice == null) ? 0 : spotPrice.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DefaultSpotRequestInfo other = (DefaultSpotRequestInfo) obj;
+ if (persistent != other.persistent)
+ return false;
+ if (spotPrice == null) {
+ if (other.spotPrice != null)
+ return false;
+ } else if (!spotPrice.equals(other.spotPrice))
+ return false;
+ return true;
+ }
+
+ public String toString() {
+ return "DefaultSpotRequestInfo [persistent=" + persistent
+ + ", spotPrice=" + spotPrice + ", creationTime=" + creationTime
+ + ", creator=" + creator + ", groupid=" + groupid
+ + ", instanceCount=" + instanceCount + ", mdUserData="
+ + mdUserData + ", requestId=" + requestId
+ + ", resourceAllocation=" + resourceAllocation
+ + ", sshKeyName=" + sshKeyName + ", state=" + state
+ + ", vmFiles=" + Arrays.toString(vmFiles) + ", vmIds="
+ + Arrays.toString(vmIds) + "]";
+ }
+
+
+}
+
64 service-api/java/source/src/org/nimbustools/api/defaults/services/rm/DefaultManager.java
View
@@ -18,13 +18,15 @@
import org.nimbustools.api.brain.Logging;
import org.nimbustools.api.repr.Advertised;
+import org.nimbustools.api.repr.AsyncCreateRequest;
import org.nimbustools.api.repr.Caller;
import org.nimbustools.api.repr.CreateRequest;
import org.nimbustools.api.repr.CreateResult;
import org.nimbustools.api.repr.ReprFactory;
-import org.nimbustools.api.repr.RequestSI;
+import org.nimbustools.api.repr.RequestInfo;
+import org.nimbustools.api.repr.SpotCreateRequest;
import org.nimbustools.api.repr.SpotPriceEntry;
-import org.nimbustools.api.repr.SpotRequest;
+import org.nimbustools.api.repr.SpotRequestInfo;
import org.nimbustools.api.repr.ShutdownTasks;
import org.nimbustools.api.repr.Usage;
import org.nimbustools.api.repr.vm.VM;
@@ -280,7 +282,7 @@ public void registerDestructionListener(String id, int type,
// SPOT INSTANCES OPERATIONS
// -------------------------------------------------------------------------
- public SpotRequest requestSpotInstances(RequestSI req, Caller caller) {
+ public SpotRequestInfo requestSpotInstances(SpotCreateRequest req, Caller caller) {
Logging.debug("Manager.requestSpotInstances() -- caller '" + caller + "', " +
"request:" + req);
@@ -296,7 +298,7 @@ public Double getSpotPrice() {
}
- public SpotRequest getSpotRequest(String id, Caller caller) throws DoesNotExistException,
+ public SpotRequestInfo getSpotRequest(String id, Caller caller) throws DoesNotExistException,
ManageException {
Logging.debug("Manager.getSpotRequest() -- caller '" + caller + "', " +
"id:" + id);
@@ -305,15 +307,15 @@ public SpotRequest getSpotRequest(String id, Caller caller) throws DoesNotExistE
}
- public SpotRequest[] getSpotRequestByCaller(Caller caller)
+ public SpotRequestInfo[] getSpotRequestsByCaller(Caller caller)
throws ManageException {
- Logging.debug("Manager.getSpotRequestByCaller() -- caller '" + caller + "'");
+ Logging.debug("Manager.getSpotRequestsByCaller() -- caller '" + caller + "'");
return null;
}
- public SpotRequest[] cancelSpotInstanceRequests(String[] ids, Caller caller) {
+ public SpotRequestInfo[] cancelSpotInstanceRequests(String[] ids, Caller caller) {
Logging.debug("Manager.cancelSpotInstanceRequests() -- caller '" + caller + "', " +
"ids:" + Arrays.toString(ids));
@@ -321,7 +323,7 @@ public SpotRequest getSpotRequest(String id, Caller caller) throws DoesNotExistE
}
- public SpotRequest[] getSpotRequests(String[] ids, Caller caller)
+ public SpotRequestInfo[] getSpotRequests(String[] ids, Caller caller)
throws DoesNotExistException, ManageException,
AuthorizationException {
Logging.debug("Manager.getSpotRequest() -- caller '" + caller + "', " +
@@ -342,4 +344,50 @@ public SpotRequest getSpotRequest(String id, Caller caller) throws DoesNotExistE
return null;
}
+ public RequestInfo addBackfillRequest(AsyncCreateRequest req, Caller caller)
+ throws AuthorizationException, CoSchedulingException,
+ CreationException, MetadataException,
+ ResourceRequestDeniedException, SchedulingException {
+ Logging.debug("Manager.addBackfillRequest() -- caller '" + caller + "', " +
+ "request:" + req);
+
+ return null;
+ }
+
+ public RequestInfo[] cancelBackfillRequests(String[] ids, Caller caller)
+ throws DoesNotExistException, AuthorizationException,
+ ManageException {
+ Logging.debug("Manager.cancelBackfillRequests() -- caller '" + caller + "', " +
+ "ids:" + Arrays.toString(ids));
+
+ return null;
+ }
+
+ public RequestInfo getBackfillRequest(String requestID, Caller caller)
+ throws DoesNotExistException, ManageException,
+ AuthorizationException {
+ Logging.debug("Manager.getBackfillRequest() -- caller '" + caller + "', " +
+ "id:" + requestID);
+
+ return null;
+ }
+
+ public RequestInfo[] getBackfillRequestsByCaller(Caller caller)
+ throws ManageException {
+ Logging.debug("Manager.getBackfillRequestsByCaller() -- caller '" + caller + "'");
+
+ return null;
+ }
+
+
+ public RequestInfo[] getBackfillRequests(String[] ids, Caller caller)
+ throws DoesNotExistException, ManageException,
+ AuthorizationException {
+
+ Logging.debug("Manager.getBackfillRequests() -- caller '" + caller + "', " +
+ "ids:" + Arrays.toString(ids));
+
+ return null;
+ }
+
}
23 service-api/java/source/src/org/nimbustools/api/repr/AsyncCreateRequest.java
View
@@ -0,0 +1,23 @@
+/*
+ * Copyright 1999-2008 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.nimbustools.api.repr;
+
+
+public interface AsyncCreateRequest extends CreateRequest{
+
+ public String getInstanceType();
+}
12 service-api/java/source/src/org/nimbustools/api/repr/ReprFactory.java
View
@@ -18,13 +18,16 @@
import org.nimbustools.api.NimbusModule;
import org.nimbustools.api._repr._Advertised;
+import org.nimbustools.api._repr._AsyncCreateRequest;
import org.nimbustools.api._repr._Caller;
import org.nimbustools.api._repr._CreateRequest;
import org.nimbustools.api._repr._CreateResult;
import org.nimbustools.api._repr._CustomizationRequest;
+import org.nimbustools.api._repr._RequestInfo;
import org.nimbustools.api._repr._ShutdownTasks;
+import org.nimbustools.api._repr._SpotCreateRequest;
import org.nimbustools.api._repr._SpotPriceEntry;
-import org.nimbustools.api._repr._SpotRequest;
+import org.nimbustools.api._repr._SpotRequestInfo;
import org.nimbustools.api._repr._Usage;
import org.nimbustools.api._repr.ctx._Context;
import org.nimbustools.api._repr.vm._Kernel;
@@ -50,9 +53,11 @@
public _CustomizationRequest _newCustomizationRequest();
public _ShutdownTasks _newShutdownTasks();
public _Usage _newUsage();
- public _SpotRequest _newSpotRequest();
+ public _RequestInfo _newRequestInfo();
+ public _SpotRequestInfo _newSpotRequestInfo();
public _SpotPriceEntry _newSpotPriceEntry();
-
+ public _AsyncCreateRequest _newBackfillRequest();
+ public _SpotCreateRequest _newSpotCreateRequest();
// vm package
public _Kernel _newKernel();
@@ -67,4 +72,5 @@
// ctx package
public _Context _newContext();
+
}
24 service-api/java/source/src/org/nimbustools/api/repr/RequestInfo.java
View
@@ -0,0 +1,24 @@
+package org.nimbustools.api.repr;
+
+import java.util.Calendar;
+
+import org.nimbustools.api.repr.si.RequestState;
+import org.nimbustools.api.repr.vm.ResourceAllocation;
+import org.nimbustools.api.repr.vm.VMFile;
+
+public interface RequestInfo {
+
+ public String getRequestID();
+ public Integer getInstanceCount();
+ public RequestState getState();
+ public Calendar getCreationTime();
+ public String[] getVMIds();
+
+ public VMFile[] getVMFiles();
+ public String getSshKeyName();
+ public Caller getCreator();
+ public String getMdUserData();
+ public ResourceAllocation getResourceAllocation();
+ public String getGroupID();
+
+}
3  ...ource/src/org/nimbustools/api/repr/RequestSI.java → ...c/org/nimbustools/api/repr/SpotCreateRequest.java
View
@@ -17,9 +17,8 @@
package org.nimbustools.api.repr;
-public interface RequestSI extends CreateRequest{
+public interface SpotCreateRequest extends AsyncCreateRequest{
- public String getInstanceType();
public Double getSpotPrice();
public boolean isPersistent();
}
23 ...rce/src/org/nimbustools/api/repr/SpotRequest.java → ...src/org/nimbustools/api/repr/SpotRequestInfo.java
View
@@ -16,28 +16,9 @@
package org.nimbustools.api.repr;
-import java.util.Calendar;
+public interface SpotRequestInfo extends RequestInfo {
-import org.nimbustools.api.repr.si.SIRequestState;
-import org.nimbustools.api.repr.vm.ResourceAllocation;
-import org.nimbustools.api.repr.vm.VMFile;
-
-
-public interface SpotRequest {
-
- public String getRequestID();
- public Integer getInstanceCount();
public Double getSpotPrice();
- public boolean isPersistent();
- public SIRequestState getState();
- public Calendar getCreationTime();
- public String[] getVMIds();
-
- public VMFile[] getVMFiles();
- public String getSshKeyName();
- public Caller getCreator();
- public String getMdUserData();
- public ResourceAllocation getResourceAllocation();
- public String getGroupID();
+ public boolean isPersistent();
}
2  ...c/org/nimbustools/api/repr/si/SIRequestState.java → ...src/org/nimbustools/api/repr/si/RequestState.java
View
@@ -17,7 +17,7 @@
package org.nimbustools.api.repr.si;
-public interface SIRequestState {
+public interface RequestState {
public static final String STATE_Open = "Open";
public static final String STATE_Active = "Active";
44 service-api/java/source/src/org/nimbustools/api/services/rm/Manager.java
View
@@ -20,13 +20,15 @@
import org.nimbustools.api.NimbusModule;
import org.nimbustools.api.repr.Advertised;
+import org.nimbustools.api.repr.AsyncCreateRequest;
import org.nimbustools.api.repr.Caller;
import org.nimbustools.api.repr.CreateRequest;
import org.nimbustools.api.repr.CreateResult;
-import org.nimbustools.api.repr.RequestSI;
-import org.nimbustools.api.repr.SpotPriceEntry;
-import org.nimbustools.api.repr.SpotRequest;
+import org.nimbustools.api.repr.RequestInfo;
import org.nimbustools.api.repr.ShutdownTasks;
+import org.nimbustools.api.repr.SpotCreateRequest;
+import org.nimbustools.api.repr.SpotPriceEntry;
+import org.nimbustools.api.repr.SpotRequestInfo;
import org.nimbustools.api.repr.Usage;
import org.nimbustools.api.repr.vm.VM;
@@ -180,7 +182,7 @@ public void registerDestructionListener(String id,
// SPOT INSTANCES OPERATIONS
// -------------------------------------------------------------------------
- public SpotRequest requestSpotInstances(RequestSI req, Caller caller)
+ public SpotRequestInfo requestSpotInstances(SpotCreateRequest req, Caller caller)
throws AuthorizationException,
CoSchedulingException,
CreationException,
@@ -188,16 +190,16 @@ public SpotRequest requestSpotInstances(RequestSI req, Caller caller)
ResourceRequestDeniedException,
SchedulingException;
- public SpotRequest getSpotRequest(String requestID, Caller caller)
+ public SpotRequestInfo getSpotRequest(String requestID, Caller caller)
throws DoesNotExistException, ManageException, AuthorizationException;
- public SpotRequest[] getSpotRequests(String[] ids, Caller caller)
+ public SpotRequestInfo[] getSpotRequests(String[] ids, Caller caller)
throws DoesNotExistException, ManageException, AuthorizationException;
- public SpotRequest[] getSpotRequestByCaller(Caller caller)
+ public SpotRequestInfo[] getSpotRequestsByCaller(Caller caller)
throws ManageException;
- public SpotRequest[] cancelSpotInstanceRequests(String[] ids,
+ public SpotRequestInfo[] cancelSpotInstanceRequests(String[] ids,
Caller caller)
throws DoesNotExistException, AuthorizationException, ManageException;
@@ -207,5 +209,31 @@ public SpotRequest getSpotRequest(String requestID, Caller caller)
throws ManageException;
public SpotPriceEntry[] getSpotPriceHistory(Calendar startDate, Calendar endDate)
+ throws ManageException;
+
+ // -------------------------------------------------------------------------
+ // BACKFILL OPERATIONS
+ // -------------------------------------------------------------------------
+
+ public RequestInfo addBackfillRequest(AsyncCreateRequest req, Caller caller)
+ throws AuthorizationException,
+ CoSchedulingException,
+ CreationException,
+ MetadataException,
+ ResourceRequestDeniedException,
+ SchedulingException;
+
+ public RequestInfo getBackfillRequest(String requestID, Caller caller)
+ throws DoesNotExistException, ManageException, AuthorizationException;
+
+ public RequestInfo[] getBackfillRequests(String[] ids, Caller caller)
+ throws DoesNotExistException, ManageException, AuthorizationException;
+
+ public RequestInfo[] getBackfillRequestsByCaller(Caller caller)
throws ManageException;
+
+ public RequestInfo[] cancelBackfillRequests(String[] ids,
+ Caller caller)
+ throws DoesNotExistException, AuthorizationException, ManageException;
+
}
30 service/service/java/source/etc/workspace-service/other/main.repr.xml
View
@@ -3,7 +3,7 @@
<!--
WARNING: It is unlikely you would need to edit anything here, most of these
objects are POJOs/beans.
-
+
New implementations of these representation objects are possible
using these mappings but it's recommended that you familiarize
yourself at the code level with how the default impls are used.
@@ -16,7 +16,7 @@
<bean id="nimbus-repr.ReprFactory"
class="org.nimbustools.api.defaults.repr.DefaultReprFactory">
-
+
<!-- repr package, writable: -->
<lookup-method name="_newAdvertised" bean="nimbus-repr.Advertised"/>
@@ -26,6 +26,11 @@
<lookup-method name="_newCustomizationRequest" bean="nimbus-repr.CustomizationRequest"/>
<lookup-method name="_newShutdownTasks" bean="nimbus-repr.ShutdownTasks"/>
<lookup-method name="_newUsage" bean="nimbus-repr.Usage"/>
+ <lookup-method name="_newRequestInfo" bean="nimbus-repr.RequestInfo" />
+ <lookup-method name="_newSpotRequestInfo" bean="nimbus-repr.SpotRequestInfo" />
+ <lookup-method name="_newSpotPriceEntry" bean="nimbus-repr.SpotPriceEntry" />
+ <lookup-method name="_newSpotCreateRequest" bean="nimbus-repr.SpotCreateRequest" />
+ <lookup-method name="_newBackfillRequest" bean="nimbus-repr.BackfillRequest" />
<!-- vm package, writable: -->
@@ -43,12 +48,12 @@
<lookup-method name="_newContext" bean="nimbus-repr.ctx.Context"/>
</bean>
-
+
<!-- repr package beans: -->
<bean id="nimbus-repr.Advertised" scope="prototype"
class="org.nimbustools.api.defaults.repr.DefaultAdvertised" />
-
+
<bean id="nimbus-repr.Caller" scope="prototype"
class="org.nimbustools.api.defaults.repr.DefaultCaller" />
@@ -67,6 +72,21 @@
<bean id="nimbus-repr.Usage" scope="prototype"
class="org.nimbustools.api.defaults.repr.DefaultUsage" />
+ <bean id="nimbus-repr.RequestInfo" scope="prototype"
+ class="org.nimbustools.api.defaults.repr.DefaultRequestInfo" />
+
+ <bean id="nimbus-repr.SpotRequestInfo" scope="prototype"
+ class="org.nimbustools.api.defaults.repr.DefaultSpotRequestInfo" />
+
+ <bean id="nimbus-repr.SpotPriceEntry" scope="prototype"
+ class="org.nimbustools.api.defaults.repr.DefaultSpotPriceEntry" />
+
+ <bean id="nimbus-repr.BackfillRequest" scope="prototype"
+ class="org.nimbustools.api.defaults.repr.DefaultAsyncCreateRequest" />
+
+ <bean id="nimbus-repr.SpotCreateRequest" scope="prototype"
+ class="org.nimbustools.api.defaults.repr.DefaultSpotCreateRequest" />
+
<!-- vm package beans: -->
<bean id="nimbus-repr.vm.Kernel" scope="prototype"
@@ -97,5 +117,5 @@
<bean id="nimbus-repr.ctx.Context" scope="prototype"
class="org.nimbustools.api.defaults.repr.ctx.DefaultContext" />
-
+
</beans>
2  service/service/java/source/etc/workspace-service/other/resource-locator-ACTIVE.xml
View
@@ -24,7 +24,7 @@
<!-- set after object creation time to avoid circular dep with home -->
<property name="home" ref="nimbus-rm.home.instance" />
- <property name="preempManager" ref="nimbus-rm.spotinstances.manager" />
+ <property name="preempManager" ref="nimbus-rm.async.manager" />
<property name="vmmpoolDirectoryResource"
value="$COMMON{conf.dir}/vmm-pools" />
<property name="selectionStrategy"
2  service/service/java/source/etc/workspace-service/other/resource-locator-default.xml
View
@@ -24,7 +24,7 @@
<!-- set after object creation time to avoid circular dep with home -->
<property name="home" ref="nimbus-rm.home.instance" />
- <property name="preempManager" ref="nimbus-rm.spotinstances.manager" />
+ <property name="preempManager" ref="nimbus-rm.async.manager" />
<property name="vmmpoolDirectoryResource"
value="$COMMON{conf.dir}/vmm-pools" />
<property name="selectionStrategy"
6 service/service/java/source/src/org/globus/workspace/creation/CreationManager.java
View
@@ -17,12 +17,12 @@
package org.globus.workspace.creation;
import org.globus.workspace.service.InstanceResource;
-import org.globus.workspace.spotinstances.SIRequest;
+import org.globus.workspace.spotinstances.AsyncRequest;
import org.nimbustools.api.repr.Advertised;
import org.nimbustools.api.repr.Caller;
import org.nimbustools.api.repr.CreateRequest;
-import org.nimbustools.api.repr.RequestSI;
+import org.nimbustools.api.repr.AsyncCreateRequest;
import org.nimbustools.api.services.rm.CoSchedulingException;
import org.nimbustools.api.services.rm.CreationException;
import org.nimbustools.api.services.rm.MetadataException;
@@ -38,7 +38,7 @@
ResourceRequestDeniedException,
SchedulingException;
- public SIRequest requestSpotInstances(RequestSI req, Caller caller)
+ public AsyncRequest addAsyncRequest(AsyncCreateRequest req, Caller caller)
throws CreationException,
MetadataException,
ResourceRequestDeniedException,
30 service/service/java/source/src/org/globus/workspace/creation/defaults/CreationManagerImpl.java
View
@@ -45,8 +45,8 @@
import org.globus.workspace.service.binding.vm.CustomizationNeed;
import org.globus.workspace.service.binding.vm.VirtualMachine;
import org.globus.workspace.service.binding.vm.VirtualMachineDeployment;
-import org.globus.workspace.spotinstances.SIRequest;
-import org.globus.workspace.spotinstances.SpotInstancesManager;
+import org.globus.workspace.spotinstances.AsyncRequest;
+import org.globus.workspace.spotinstances.AsyncRequestManager;
import org.globus.workspace.creation.InternalCreationManager;
import org.nimbustools.api._repr._Advertised;
@@ -55,7 +55,9 @@
import org.nimbustools.api.repr.CannotTranslateException;
import org.nimbustools.api.repr.CreateRequest;
import org.nimbustools.api.repr.ReprFactory;
-import org.nimbustools.api.repr.RequestSI;
+import org.nimbustools.api.repr.AsyncCreateRequest;
+import org.nimbustools.api.repr.SpotCreateRequest;
+import org.nimbustools.api.repr.SpotRequestInfo;
import org.nimbustools.api.repr.ctx.Context;
import org.nimbustools.api.repr.si.SIConstants;
import org.nimbustools.api.repr.vm.NIC;
@@ -118,7 +120,7 @@
protected AccountingEventAdapter accounting;
- protected SpotInstancesManager siManager;
+ protected AsyncRequestManager asyncManager;
// -------------------------------------------------------------------------
@@ -268,7 +270,7 @@ public Advertised getAdvertised() {
return adv;
}
- public SIRequest requestSpotInstances(RequestSI req, Caller caller)
+ public AsyncRequest addAsyncRequest(AsyncCreateRequest req, Caller caller)
throws CreationException,
MetadataException,
ResourceRequestDeniedException,
@@ -302,9 +304,17 @@ public SIRequest requestSpotInstances(RequestSI req, Caller caller)
final String groupID = this.getGroupID(creatorID, bound.length);
final String siID = generateRequestID();
- SIRequest siRequest = new SIRequest(siID, req.getSpotPrice(), req.isPersistent(), caller, groupID, bound, req.getContext(), req.getRequestedNics(), Calendar.getInstance());
- siManager.addRequest(siRequest);
+ AsyncRequest siRequest;
+
+ if(req instanceof SpotCreateRequest){
+ SpotCreateRequest spotReq = (SpotCreateRequest)req;
+ siRequest = new AsyncRequest(siID, spotReq.getSpotPrice(), spotReq.isPersistent(), caller, groupID, bound, req.getContext(), req.getRequestedNics(), Calendar.getInstance());
+ } else {
+ siRequest = new AsyncRequest(siID, caller, groupID, bound, req.getContext(), req.getRequestedNics(), Calendar.getInstance());
+ }
+
+ asyncManager.addRequest(siRequest);
return siRequest;
}
@@ -856,7 +866,7 @@ protected void schedulerCreatedNotification(int[] ids, boolean spotInstances) {
if(!spotInstances){
final StateChangeEvent simEvent = new StateChangeEvent(ids,
WorkspaceConstants.STATE_FIRST_LEGAL,
- this.siManager);
+ this.asyncManager);
this.timerManager.schedule(simEvent, 50);
}
@@ -1213,10 +1223,10 @@ protected String nodeReport(Reservation res) {
// -------------------------------------------------------------------------
// MODULE SET (avoids circular dependency problem)
// -------------------------------------------------------------------------
- public void setSiManager(SpotInstancesManager siManagerImpl) {
+ public void setSiManager(AsyncRequestManager siManagerImpl) {
if (siManagerImpl == null) {
throw new IllegalArgumentException("siManagerImpl may not be null");
}
- this.siManager = siManagerImpl;
+ this.asyncManager = siManagerImpl;
}
}
135 service/service/java/source/src/org/globus/workspace/manager/DelegatingManager.java
View
@@ -31,8 +31,8 @@
import org.globus.workspace.service.WorkspaceCoschedHome;
import org.globus.workspace.service.WorkspaceGroupHome;
import org.globus.workspace.service.WorkspaceHome;
-import org.globus.workspace.spotinstances.SIRequest;
-import org.globus.workspace.spotinstances.SpotInstancesHome;
+import org.globus.workspace.spotinstances.AsyncRequest;
+import org.globus.workspace.spotinstances.AsyncRequestHome;
import org.nimbustools.api._repr._Caller;
import org.nimbustools.api._repr._CreateResult;
import org.nimbustools.api.repr.Advertised;
@@ -41,10 +41,12 @@
import org.nimbustools.api.repr.CreateRequest;
import org.nimbustools.api.repr.CreateResult;
import org.nimbustools.api.repr.ReprFactory;
-import org.nimbustools.api.repr.RequestSI;
+import org.nimbustools.api.repr.AsyncCreateRequest;
+import org.nimbustools.api.repr.RequestInfo;
import org.nimbustools.api.repr.ShutdownTasks;
+import org.nimbustools.api.repr.SpotCreateRequest;
import org.nimbustools.api.repr.SpotPriceEntry;
-import org.nimbustools.api.repr.SpotRequest;
+import org.nimbustools.api.repr.SpotRequestInfo;
import org.nimbustools.api.repr.Usage;
import org.nimbustools.api.repr.vm.VM;
import org.nimbustools.api.services.rm.AuthorizationException;
@@ -90,7 +92,7 @@
protected final WorkspaceHome home;
protected final WorkspaceGroupHome ghome;
protected final WorkspaceCoschedHome cohome;
- protected final SpotInstancesHome siHome;
+ protected final AsyncRequestHome asyncHome;
protected final PathConfigs paths;
protected final ReprFactory repr;
protected final DataConvert dataConvert;
@@ -109,7 +111,7 @@ public DelegatingManager(PathConfigs pathConfigs,
ReprFactory reprFactory,
DataConvert dataConvertImpl,
Lager lagerImpl,
- SpotInstancesHome siManagerImpl) {
+ AsyncRequestHome siManagerImpl) {
if (pathConfigs == null) {
throw new IllegalArgumentException("pathConfigs may not be null");
@@ -149,7 +151,7 @@ public DelegatingManager(PathConfigs pathConfigs,
if (siManagerImpl == null) {
throw new IllegalArgumentException("siManagerImpl may not be null");
}
- this.siHome = siManagerImpl;
+ this.asyncHome = siManagerImpl;
}
@@ -763,14 +765,14 @@ protected VM getVM(InstanceResource resource)
// SPOT INSTANCES OPERATIONS
// -------------------------------------------------------------------------
- public SpotRequest requestSpotInstances(RequestSI req, Caller caller)
+ public SpotRequestInfo requestSpotInstances(SpotCreateRequest req, Caller caller)
throws AuthorizationException,
CreationException,
MetadataException,
ResourceRequestDeniedException,
SchedulingException {
- SIRequest siRequest = this.creation.requestSpotInstances(req, caller);
+ AsyncRequest siRequest = this.creation.addAsyncRequest(req, caller);
try {
return dataConvert.getSpotRequest(siRequest);
@@ -780,22 +782,22 @@ public SpotRequest requestSpotInstances(RequestSI req, Caller caller)
}
public Double getSpotPrice() {
- return siHome.getSpotPrice();
+ return asyncHome.getSpotPrice();
}
- public SpotRequest getSpotRequest(String requestID, Caller caller)
+ public SpotRequestInfo getSpotRequest(String requestID, Caller caller)
throws DoesNotExistException, ManageException, AuthorizationException {
return this.getSpotRequests(new String[]{requestID}, caller)[0];
}
- public SpotRequest[] getSpotRequests(String[] ids, Caller caller)
+ public SpotRequestInfo[] getSpotRequests(String[] ids, Caller caller)
throws DoesNotExistException, ManageException, AuthorizationException {
- SpotRequest[] result = new SpotRequest[ids.length];
+ SpotRequestInfo[] result = new SpotRequestInfo[ids.length];
for (int i = 0; i < ids.length; i++) {
- SIRequest siReq = siHome.getRequest(ids[i]);
+ AsyncRequest siReq = asyncHome.getRequest(ids[i]);
if(!caller.isSuperUser() && !siReq.getCaller().equals(caller)){
throw new AuthorizationException("Caller is not authorized to get information about this request");
@@ -808,31 +810,31 @@ public SpotRequest getSpotRequest(String requestID, Caller caller)
}
- public SpotRequest[] getSpotRequestByCaller(Caller caller)
+ public SpotRequestInfo[] getSpotRequestsByCaller(Caller caller)
throws ManageException {
- return this.getSpotRequests(siHome.getRequests(caller));
+ return this.getSpotRequests(asyncHome.getRequests(caller, true));
}
- public SpotRequest[] cancelSpotInstanceRequests(String[] ids, Caller caller)
+ public SpotRequestInfo[] cancelSpotInstanceRequests(String[] ids, Caller caller)
throws DoesNotExistException, AuthorizationException, ManageException {
- SpotRequest[] result = new SpotRequest[ids.length];
+ SpotRequestInfo[] result = new SpotRequestInfo[ids.length];
for (int i = 0; i < ids.length; i++) {
- SIRequest siReq = siHome.getRequest(ids[i]);
+ AsyncRequest siReq = asyncHome.getRequest(ids[i]);
if(!caller.isSuperUser() && !siReq.getCaller().equals(caller)){
throw new AuthorizationException("Caller is not authorized to get information about this request");
}
- result[i] = getSpotRequest(siHome.cancelRequest(ids[i]));
+ result[i] = getSpotRequest(asyncHome.cancelRequest(ids[i]));
}
return result;
}
- private SpotRequest getSpotRequest(SIRequest siReq) throws ManageException {
+ private SpotRequestInfo getSpotRequest(AsyncRequest siReq) throws ManageException {
try {
return dataConvert.getSpotRequest(siReq);
} catch (CannotTranslateException e) {
@@ -840,8 +842,16 @@ private SpotRequest getSpotRequest(SIRequest siReq) throws ManageException {
}
}
- private SpotRequest[] getSpotRequests(SIRequest[] requests) throws ManageException{
- SpotRequest[] result = new SpotRequest[requests.length];
+ private RequestInfo getRequestInfo(AsyncRequest backfillReq) throws ManageException {
+ try {
+ return dataConvert.getRequestInfo(backfillReq);
+ } catch (CannotTranslateException e) {
+ throw new ManageException(e.getMessage(), e);
+ }
+ }
+
+ private SpotRequestInfo[] getSpotRequests(AsyncRequest[] requests) throws ManageException{
+ SpotRequestInfo[] result = new SpotRequestInfo[requests.length];
for (int i = 0; i < requests.length; i++) {
result[i] = getSpotRequest(requests[i]);
@@ -849,6 +859,16 @@ private SpotRequest getSpotRequest(SIRequest siReq) throws ManageException {
return result;
}
+
+ private RequestInfo[] getRequestInfos(AsyncRequest[] requests) throws ManageException{
+ RequestInfo[] result = new RequestInfo[requests.length];
+
+ for (int i = 0; i < requests.length; i++) {
+ result[i] = getRequestInfo(requests[i]);
+ }
+
+ return result;
+ }
public SpotPriceEntry[] getSpotPriceHistory() throws ManageException {
@@ -858,9 +878,74 @@ private SpotRequest getSpotRequest(SIRequest siReq) throws ManageException {
public SpotPriceEntry[] getSpotPriceHistory(Calendar startDate,
Calendar endDate) throws ManageException {
- List<SpotPriceEntry> result = siHome.getSpotPriceHistory(startDate, endDate);
+ List<SpotPriceEntry> result = asyncHome.getSpotPriceHistory(startDate, endDate);
return result.toArray(new SpotPriceEntry[0]);
+ }
+
+ // -------------------------------------------------------------------------
+ // BACKFILL OPERATIONS
+ // -------------------------------------------------------------------------
+
+ 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);
+ }
+ }
+
+ public RequestInfo[] cancelBackfillRequests(String[] ids, Caller caller)
+ throws DoesNotExistException, AuthorizationException,
+ ManageException {
+ RequestInfo[] result = new RequestInfo[ids.length];
+
+ for (int i = 0; i < ids.length; i++) {
+ AsyncRequest backfillReq = asyncHome.getRequest(ids[i]);
+
+ if(!caller.isSuperUser() && !backfillReq.getCaller().equals(caller)){
+ throw new AuthorizationException("Caller is not authorized to get information about this request");
+ }
+
+ result[i] = getRequestInfo(asyncHome.cancelRequest(ids[i]));
+ }
+
+ return result;
+ }
+
+ public RequestInfo getBackfillRequest(String requestID, Caller caller)
+ throws DoesNotExistException, ManageException,
+ AuthorizationException {
+ return this.getBackfillRequests(new String[]{requestID}, caller)[0];
+ }
+
+ public RequestInfo[] getBackfillRequests(String[] ids, Caller caller)
+ throws DoesNotExistException, ManageException,
+ AuthorizationException {
+ RequestInfo[] result = new RequestInfo[ids.length];
+
+ for (int i = 0; i < ids.length; i++) {
+ AsyncRequest backfillReq = asyncHome.getRequest(ids[i]);
+
+ if(!caller.isSuperUser() && !backfillReq.getCaller().equals(caller)){
+ throw new AuthorizationException("Caller is not authorized to get information about this request");
+ }
+
+ result[i] = getRequestInfo(backfillReq);
+ }
+
+ return result;
+ }
+
+ public RequestInfo[] getBackfillRequestsByCaller(Caller caller)
+ throws ManageException {
+
+ return this.getRequestInfos(asyncHome.getRequests(caller, false));
}
-}
+}
75 service/service/java/source/src/org/globus/workspace/persistence/DataConvert.java
View
@@ -28,11 +28,12 @@
import org.globus.workspace.service.binding.vm.VirtualMachine;
import org.globus.workspace.service.binding.vm.VirtualMachineDeployment;
import org.globus.workspace.service.binding.vm.VirtualMachinePartition;
-import org.globus.workspace.spotinstances.SIRequest;
-import org.globus.workspace.spotinstances.SIRequestStatus;
+import org.globus.workspace.spotinstances.AsyncRequest;
+import org.globus.workspace.spotinstances.AsyncRequestStatus;
import org.globus.workspace.xen.XenUtil;
import org.nimbustools.api._repr._Caller;
-import org.nimbustools.api._repr._SpotRequest;
+import org.nimbustools.api._repr._RequestInfo;
+import org.nimbustools.api._repr._SpotRequestInfo;
import org.nimbustools.api._repr._Usage;
import org.nimbustools.api._repr.si._SIRequestState;
import org.nimbustools.api._repr.vm._NIC;
@@ -41,14 +42,15 @@
import org.nimbustools.api._repr.vm._State;
import org.nimbustools.api._repr.vm._VM;
import org.nimbustools.api._repr.vm._VMFile;
-import org.nimbustools.api.defaults.repr.DefaultSpotRequest;
+import org.nimbustools.api.defaults.repr.DefaultSpotRequestInfo;
import org.nimbustools.api.defaults.repr.si.DefaultSIRequestState;
import org.nimbustools.api.repr.Caller;
import org.nimbustools.api.repr.CannotTranslateException;
import org.nimbustools.api.repr.ReprFactory;
-import org.nimbustools.api.repr.SpotRequest;
+import org.nimbustools.api.repr.RequestInfo;
+import org.nimbustools.api.repr.SpotRequestInfo;
import org.nimbustools.api.repr.Usage;
-import org.nimbustools.api.repr.si.SIRequestState;
+import org.nimbustools.api.repr.si.RequestState;
import org.nimbustools.api.repr.vm.NIC;
import org.nimbustools.api.repr.vm.ResourceAllocation;
import org.nimbustools.api.repr.vm.Schedule;
@@ -231,7 +233,21 @@ public VM getVM(InstanceResource resource) throws CannotTranslateException {
return vm;
}
- public SpotRequest getSpotRequest(SIRequest siRequest) throws CannotTranslateException {
+ public RequestInfo getRequestInfo(AsyncRequest backfillRequest) throws CannotTranslateException {
+ VirtualMachine[] bindings = backfillRequest.getBindings();
+
+ if (bindings == null || bindings.length == 0) {
+ throw new CannotTranslateException("no resource?");
+ }
+
+ final _RequestInfo result = repr._newRequestInfo();
+
+ populate(backfillRequest, result);
+
+ return result;
+ }
+
+ public SpotRequestInfo getSpotRequest(AsyncRequest siRequest) throws CannotTranslateException {
VirtualMachine[] bindings = siRequest.getBindings();
@@ -239,26 +255,35 @@ public SpotRequest getSpotRequest(SIRequest siRequest) throws CannotTranslateExc
throw new CannotTranslateException("no resource?");
}
- final _SpotRequest result = new DefaultSpotRequest();
+ final _SpotRequestInfo result = repr._newSpotRequestInfo();
- result.setInstanceCount(siRequest.getRequestedInstances());
- result.setCreationTime(siRequest.getCreationTime());
- result.setCreator(siRequest.getCaller());
- result.setGroupID(siRequest.getGroupID());
- result.setMdUserData(bindings[0].getMdUserData());
+ populate(siRequest, result);
+
result.setPersistent(siRequest.isPersistent());
- result.setRequestID(siRequest.getId());
- result.setSpotPrice(siRequest.getMaxBid());
+ result.setSpotPrice(siRequest.getMaxBid());
+
+ return result;
+ }
+
+
+ private void populate(AsyncRequest asyncReq, final _RequestInfo result) throws CannotTranslateException {
+
+ VirtualMachine[] bindings = asyncReq.getBindings();
+
+ result.setInstanceCount(asyncReq.getRequestedInstances());
+ result.setCreationTime(asyncReq.getCreationTime());
+ result.setCreator(asyncReq.getCaller());
+ result.setGroupID(asyncReq.getGroupID());
+ result.setMdUserData(bindings[0].getMdUserData());
+ result.setRequestID(asyncReq.getId());
result.setVMFiles(this.getStorage(bindings[0]));
result.setResourceAllocation(this.getRA(bindings[0]));
- result.setVMIds(getVMIDs(siRequest.getVMIds()));
+ result.setVMIds(getVMIDs(asyncReq.getVMIds()));
_SIRequestState state = new DefaultSIRequestState();
- state.setState(this.getSIRequestState(siRequest.getStatus()));
+ state.setState(this.getSIRequestState(asyncReq.getStatus()));
result.setState(state);
-
- return result;
}
@@ -276,18 +301,18 @@ public SpotRequest getSpotRequest(SIRequest siRequest) throws CannotTranslateExc
// STATE RELATED
// -------------------------------------------------------------------------
- private String getSIRequestState(SIRequestStatus status) {
+ private String getSIRequestState(AsyncRequestStatus status) {
switch(status){
case ACTIVE:
- return SIRequestState.STATE_Active;
+ return RequestState.STATE_Active;
case CANCELLED:
- return SIRequestState.STATE_Cancelled;
+ return RequestState.STATE_Cancelled;
case CLOSED:
- return SIRequestState.STATE_Closed;
+ return RequestState.STATE_Closed;
case FAILED:
- return SIRequestState.STATE_Failed;
+ return RequestState.STATE_Failed;
case OPEN:
- return SIRequestState.STATE_Open;
+ return RequestState.STATE_Open;
}
return null;
Please sign in to comment.
Something went wrong with that request. Please try again.