use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class TaskResource method getTaskStatistics.
@GET
@Path("/task/{taskId}/statistics")
@Operation(summary = "Retrieve resource usage statistics about a specific active task", responses = { @ApiResponse(responseCode = "404", description = "A task with this id, or agent and executor with matching statistics was not found") })
public MesosTaskStatisticsObject getTaskStatistics(@Parameter(hidden = true) @Auth SingularityUser user, @Parameter(description = "Id of the task") @PathParam("taskId") String taskId) {
SingularityTask task = checkActiveTask(taskId, SingularityAuthorizationScope.READ, user);
String executorIdToMatch = null;
if (task.getMesosTask().hasExecutor()) {
executorIdToMatch = task.getMesosTask().getExecutor().getExecutorId().getValue();
} else {
executorIdToMatch = taskId;
}
for (MesosTaskMonitorObject taskMonitor : mesosClient.getSlaveResourceUsage(task.getHostname())) {
if (taskMonitor.getExecutorId().equals(executorIdToMatch)) {
return taskMonitor.getStatistics();
}
}
throw notFound("Couldn't find executor %s for %s on agent %s", executorIdToMatch, taskId, task.getHostname());
}
use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class PriorityResource method deleteActivePriorityFreeze.
@DELETE
@Path("/freeze")
@Operation(summary = "Stops the active priority freeze", responses = { @ApiResponse(responseCode = "202", description = "The active priority freeze was deleted"), @ApiResponse(responseCode = "400", description = "There was no active priority freeze to delete") })
public void deleteActivePriorityFreeze(@Parameter(hidden = true) @Auth SingularityUser user) {
authorizationHelper.checkAdminAuthorization(user);
final SingularityDeleteResult deleteResult = priorityManager.deleteActivePriorityFreeze();
checkBadRequest(deleteResult == SingularityDeleteResult.DELETED, "No active priority freeze to delete.");
priorityManager.clearPriorityKill();
}
use of io.swagger.v3.oas.annotations.Hidden in project Singularity by HubSpot.
the class PriorityResource method createPriorityFreeze.
@POST
@Path("/freeze")
@Operation(summary = "Stop scheduling tasks below a certain priority level", responses = { @ApiResponse(responseCode = "200", description = "The priority freeze request was accepted"), @ApiResponse(responseCode = "400", description = "There was a validation error with the priority freeze request") })
public SingularityPriorityFreezeParent createPriorityFreeze(@Parameter(hidden = true) @Auth SingularityUser user, @RequestBody(description = "the new priority freeze to create") SingularityPriorityFreeze priorityFreezeRequest) {
authorizationHelper.checkAdminAuthorization(user);
priorityFreezeRequest = singularityValidator.checkSingularityPriorityFreeze(priorityFreezeRequest);
final SingularityPriorityFreezeParent priorityFreezeRequestParent = new SingularityPriorityFreezeParent(priorityFreezeRequest, System.currentTimeMillis(), user.getEmail());
priorityManager.createPriorityFreeze(priorityFreezeRequestParent);
if (priorityFreezeRequest.isKillTasks()) {
priorityManager.setPriorityKill();
}
return priorityFreezeRequestParent;
}
use of io.swagger.v3.oas.annotations.Hidden in project cxf by apache.
the class OpenApiCustomizedResource method getOpenApi.
@GET
@Produces({ MediaType.APPLICATION_JSON, "application/yaml" })
@Operation(hidden = true)
public Response getOpenApi(@Context ServletConfig config, @Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type) throws Exception {
if (customizer != null) {
final OpenAPIConfiguration configuration = customizer.customize(getOpenApiConfiguration());
setOpenApiConfiguration(configuration);
// By default, the OpenApiContext instance is cached. It means that the configuration
// changes won't be taken into account (due to the deep copying rather than reference
// passing). In order to reflect any changes which customization may do, we have to
// update reader's configuration directly.
final String ctxId = ServletConfigContextUtils.getContextIdFromServletConfig(config);
final OpenApiContext ctx = OpenApiContextLocator.getInstance().getOpenApiContext(ctxId);
if (ctx instanceof GenericOpenApiContext<?>) {
((GenericOpenApiContext<?>) ctx).getOpenApiReader().setConfiguration(configuration);
customizer.customize(ctx.read());
}
}
return super.getOpenApi(headers, uriInfo, type);
}
use of io.swagger.v3.oas.annotations.Hidden in project cxf by apache.
the class OpenApiCustomizedResource method getOpenApi.
@GET
@Produces({ MediaType.APPLICATION_JSON, "application/yaml" })
@Operation(hidden = true)
public Response getOpenApi(@Context Application app, @Context ServletConfig config, @Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type) throws Exception {
if (customizer != null) {
final OpenAPIConfiguration configuration = customizer.customize(getOpenApiConfiguration());
setOpenApiConfiguration(configuration);
// By default, the OpenApiContext instance is cached. It means that the configuration
// changes won't be taken into account (due to the deep copying rather than reference
// passing). In order to reflect any changes which customization may do, we have to
// update reader's configuration directly.
OpenApiContext ctx = getOpenApiContext(config);
if (ctx == null) {
// If there is no context associated with the servlet config, let us
// try to fallback to default one.
ctx = getOpenApiContext(null);
}
if (ctx instanceof GenericOpenApiContext<?>) {
((GenericOpenApiContext<?>) ctx).getOpenApiReader().setConfiguration(configuration);
final OpenAPI oas = ctx.read();
customizer.customize(oas);
if (!Objects.equals(configuration.getOpenAPI().getInfo(), oas.getInfo())) {
configuration.getOpenAPI().setInfo(oas.getInfo());
}
if (!Objects.equals(configuration.getOpenAPI().getComponents(), oas.getComponents())) {
configuration.getOpenAPI().setComponents(oas.getComponents());
}
if (!Objects.equals(configuration.getOpenAPI().getExternalDocs(), oas.getExternalDocs())) {
configuration.getOpenAPI().setExternalDocs(oas.getExternalDocs());
}
if (!Objects.equals(configuration.getOpenAPI().getPaths(), oas.getPaths())) {
configuration.getOpenAPI().setPaths(oas.getPaths());
}
if (!Objects.equals(configuration.getOpenAPI().getTags(), oas.getTags())) {
configuration.getOpenAPI().setTags(oas.getTags());
}
if (!Objects.equals(configuration.getOpenAPI().getExtensions(), oas.getExtensions())) {
configuration.getOpenAPI().setExtensions(oas.getExtensions());
}
}
}
return super.getOpenApi(headers, config, app, uriInfo, type);
}
Aggregations