Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.amoro.resource.ResourceType;
import org.apache.amoro.server.dashboard.response.OkResponse;
import org.apache.amoro.server.manager.AbstractOptimizerContainer;
import org.apache.amoro.server.resource.ContainerMetadata;
import org.apache.amoro.server.resource.Containers;
import org.apache.amoro.server.resource.OptimizerInstance;
import org.apache.amoro.server.resource.OptimizerManager;
Expand Down Expand Up @@ -98,13 +97,4 @@ public void createOptimizer(Context ctx) {
optimizerManager.createResource(resource);
ctx.json(OkResponse.of("success to create optimizer"));
}

/** check if optimizerGroup can be deleted url = /optimize/containers/get */
public void getContainers(Context ctx) {
ctx.json(
OkResponse.of(
Containers.getMetadataList().stream()
.map(ContainerMetadata::getName)
.collect(Collectors.toList())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,38 +184,6 @@ public void getOptimizerGroupInfo(Context ctx) {
ctx.json(OkResponse.of(optimizerResourceInfo));
}

/**
* release optimizer.
*
* @pathParam jobId
*/
public void releaseOptimizer(Context ctx) {
String resourceId = ctx.pathParam("jobId");
Preconditions.checkArgument(
!resourceId.isEmpty(), "resource id can not be empty, maybe it's a external optimizer");

List<OptimizerInstance> optimizerInstances =
optimizerManager.listOptimizers().stream()
.filter(e -> resourceId.equals(e.getResourceId()))
.collect(Collectors.toList());
Preconditions.checkState(
!optimizerInstances.isEmpty(),
String.format(
"The resource ID %s has not been indexed" + " to any optimizer.", resourceId));
Resource resource = optimizerManager.getResource(resourceId);
resource.getProperties().putAll(optimizerInstances.get(0).getProperties());
ResourceContainer rc = Containers.get(resource.getContainerName());
Preconditions.checkState(
rc instanceof AbstractOptimizerContainer,
"Cannot release optimizer on non-optimizer resource container %s.",
resource.getContainerName());
((AbstractOptimizerContainer) rc).releaseResource(resource);

optimizerManager.deleteResource(resourceId);
optimizerManager.deleteOptimizer(resource.getGroupName(), resourceId);
ctx.json(OkResponse.of("Success to release optimizer"));
}

/** scale out optimizers, url:/optimizerGroups/{optimizerGroup}/optimizers. */
public void scaleOutOptimizer(Context ctx) {
String optimizerGroup = ctx.pathParam("optimizerGroup");
Expand Down