Skip to content

Commit 6770232

Browse files
committed
Fix or remove TODOs
1 parent d81480c commit 6770232

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/backend/IContainerBackend.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ default Proxy resumeProxy(Authentication user, Proxy proxy, ProxySpec proxySpec)
9696
*/
9797
Map<String, URI> setupPortMappingExistingProxy(Proxy proxy, Container container, Map<Integer, Integer> portBindings) throws Exception;
9898

99-
// TODO move implementation to abstract class
10099
default Boolean supportsPause() {
101100
return false;
102101
}

src/main/java/eu/openanalytics/containerproxy/backend/dispatcher/proxysharing/ProxySharingDispatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ public void stopProxy(Proxy proxy, ProxyStopReason proxyStopReason) throws Conta
200200

201201
@Override
202202
public void pauseProxy(Proxy proxy) {
203-
throw new IllegalStateException("Not available"); // TODO
203+
throw new IllegalStateException("ProxySharingDispatcher does not support pauseProxy.");
204204
}
205205

206206
@Override
207207
public Proxy resumeProxy(Authentication user, Proxy proxy, ProxySpec proxySpec) throws ProxyFailedToStartException {
208-
throw new IllegalStateException("Not available"); // TODO
208+
throw new IllegalStateException("ProxySharingDispatcher does not support resumeProxy.");
209209
}
210210

211211
@Override
@@ -215,7 +215,7 @@ public boolean supportsPause() {
215215

216216
@Override
217217
public Proxy addRuntimeValuesBeforeSpel(Authentication user, ProxySpec spec, Proxy proxy) {
218-
return proxy; // TODO
218+
return proxy;
219219
}
220220

221221
@EventListener

src/main/java/eu/openanalytics/containerproxy/backend/dispatcher/proxysharing/ProxySharingScaler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public ProxySharingScaler(ISeatStore seatStore, ProxySpec proxySpec, IDelegatePr
125125
// remove httpHeaders from spec, since it's not used for DelegateProxies and may contain SpEL which cannot be resolved here
126126
this.proxySpec = proxySpec.toBuilder().httpHeaders(new SpelField.StringMap()).build();
127127
proxySpecHash = getProxySpecHash(proxySpec);
128+
129+
if (!specExtension.allowContainerReUse && specExtension.seatsPerContainer != 1) {
130+
throw new IllegalStateException(String.format("Spec %s is invalid: when allow-container-re-use is disabled, seatsPerContainer must be exactly 1", proxySpec.getId()));
131+
}
128132
}
129133

130134
public static void setPublicPathPrefix(String publicPathPrefix) {
@@ -227,7 +231,6 @@ private void processReleasedSeat(SeatReleasedEvent seatReleasedEvent) {
227231
markDelegateProxyForRemoval(delegateProxy.getProxy().getId());
228232
globalEventLoop.schedule(this::reconcile);
229233
} else if (!specExtension.allowContainerReUse) {
230-
// TODO allow only one seat if container is not allowed to be re-used
231234
// container cannot be re-used -> mark delegateProxy as ToRemove
232235
log(delegateProxy, "DelegateProxy cannot be re-used, marking for removal");
233236
removeSeat(delegateProxy, seatId);
@@ -335,7 +338,6 @@ private Runnable createDelegateProxyJob(DelegateProxy originalDelegateProxy) {
335338
proxyBuilder.specId(proxySpec.getId());
336339
long createdTimestamp = System.currentTimeMillis();
337340
proxyBuilder.createdTimestamp(createdTimestamp);
338-
// TODO add minimal set of runtimevalues
339341
proxyBuilder.addRuntimeValue(new RuntimeValue(DelegateProxyKey.inst, true), false);
340342
proxyBuilder.addRuntimeValue(new RuntimeValue(PublicPathKey.inst, getPublicPath(id)), false);
341343
proxyBuilder.addRuntimeValue(new RuntimeValue(InstanceIdKey.inst, identifierService.instanceId), false);
@@ -364,7 +366,6 @@ private Runnable createDelegateProxyJob(DelegateProxy originalDelegateProxy) {
364366
proxyBuilder.addContainer(container);
365367
}
366368
proxy = proxyBuilder.build();
367-
// TODO use startupLog ?
368369
log(delegateProxy, "Starting DelegateProxy");
369370
proxy = containerBackend.startProxy(null, proxy, resolvedSpec, new ProxyStartupLog.ProxyStartupLogBuilder());
370371
delegateProxy = originalDelegateProxy.toBuilder().proxy(proxy).build();

src/main/java/eu/openanalytics/containerproxy/backend/kubernetes/PodPatcher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public Pod patch(Pod pod, JsonPatch patch) {
6868
JsonStructure patchedPodAsJsonValue = patch.apply(podAsJsonValue);
6969
// 3. convert back to a pod
7070
return mapper.convertValue(patchedPodAsJsonValue, Pod.class);
71-
// TODO catch exceptions
7271
}
7372

7473
/**

src/main/java/eu/openanalytics/containerproxy/model/runtime/runtimevalues/DisplayNameKey.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ private DisplayNameKey() {
2929
"SHINYPROXY_DISPLAY_NAME",
3030
false,
3131
true,
32-
// TODO
3332
false,
3433
true,
3534
true,

0 commit comments

Comments
 (0)