Skip to content
Merged
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 @@ -395,11 +395,11 @@ public Optional<SingularityTaskIdsByStatus> getTaskIdsByStatusForRequest(
@GET
@Path("/active/slave/{agentId}")
@Operation(
summary = "Retrieve list of active tasks on a specific slave",
summary = "Retrieve list of active tasks on a specific agent",
responses = {
@ApiResponse(
responseCode = "404",
description = "A slave with the specified id was not found"
description = "An agent with the specified id was not found"
)
}
)
Expand All @@ -419,11 +419,11 @@ public List<SingularityTask> getTasksForAgentDeprecated(
@GET
@Path("/active/agent/{agentId}")
@Operation(
summary = "Retrieve list of active tasks on a specific slave",
summary = "Retrieve list of active tasks on a specific agent",
responses = {
@ApiResponse(
responseCode = "404",
description = "A slave with the specified id was not found"
description = "An agent with the specified id was not found"
)
}
)
Expand All @@ -440,7 +440,7 @@ public List<SingularityTask> getTasksForAgent(

checkNotFound(
maybeSlave.isPresent(),
"Couldn't find a slave in any state with id %s",
"Couldn't find a agent in any state with id %s",
agentId
);

Expand All @@ -458,11 +458,11 @@ public List<SingularityTask> getTasksForAgent(
@GET
@Path("/active/slave/{agentId}/ids")
@Operation(
summary = "Retrieve list of active tasks on a specific slave",
summary = "Retrieve list of active tasks on a specific agent",
responses = {
@ApiResponse(
responseCode = "404",
description = "A slave with the specified id was not found"
description = "An agent with the specified id was not found"
)
}
)
Expand Down Expand Up @@ -503,7 +503,7 @@ public List<SingularityTaskId> getTaskIdsForAgent(

checkNotFound(
maybeAgent.isPresent(),
"Couldn't find a slave in any state with id %s",
"Couldn't find a agent in any state with id %s",
agentId
);

Expand Down Expand Up @@ -684,7 +684,7 @@ public SingularityTask getActiveTask(
responses = {
@ApiResponse(
responseCode = "404",
description = "A task with this id, or slave and executor with matching statistics was not found"
description = "A task with this id, or agent and executor with matching statistics was not found"
)
}
)
Expand Down Expand Up @@ -715,7 +715,7 @@ public MesosTaskStatisticsObject getTaskStatistics(
}

throw notFound(
"Couldn't find executor %s for %s on slave %s",
"Couldn't find executor %s for %s on agent %s",
executorIdToMatch,
taskId,
task.getHostname()
Expand Down Expand Up @@ -1144,36 +1144,50 @@ public List<SingularityTaskShellCommandUpdate> getShellCommandHisotryUpdates(
@GET
@Path("/download/")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Operation(summary = "Proxy a file download from a Mesos Slave through Singularity")
@Operation(summary = "Proxy a file download from a Mesos Agent through Singularity")
public Response downloadFileOverProxy(
@Parameter(required = true, description = "Mesos slave hostname") @QueryParam(
@Parameter(required = true, description = "Mesos agent hostname") @QueryParam(
"slaveHostname"
) String slaveHostname,
@Parameter(required = true, description = "Mesos agent hostname") @QueryParam(
"agentHostname"
) String agentHostname,
@Parameter(
required = true,
description = "Full file path to file on Mesos slave to be downloaded"
description = "Full file path to file on Mesos agent to be downloaded"
) @QueryParam("path") String fileFullPath
) {
return getFile(slaveHostname, fileFullPath, true);
return getFile(
agentHostname != null ? agentHostname : slaveHostname,
fileFullPath,
true
);
}

@GET
@Path("/open/")
@Produces("*/*")
@Operation(summary = "Open a file from a Mesos Slave through Singularity")
public Response openFileOverProxy(
@Parameter(required = true, description = "Mesos slave hostname") @QueryParam(
@Parameter(required = true, description = "Mesos agent hostname") @QueryParam(
"slaveHostname"
) String slaveHostname,
@Parameter(required = true, description = "Mesos agent hostname") @QueryParam(
"agentHostname"
) String agentHostname,
@Parameter(
required = true,
description = "Full file path to file on Mesos slave to be downloaded"
description = "Full file path to file on Mesos agent to be downloaded"
) @QueryParam("path") String fileFullPath
) {
return getFile(slaveHostname, fileFullPath, false);
return getFile(
agentHostname != null ? agentHostname : slaveHostname,
fileFullPath,
false
);
}

private Response getFile(String slaveHostname, String fileFullPath, boolean download) {
private Response getFile(String agentHostname, String fileFullPath, boolean download) {
String httpPrefix = configuration.getAgentHttpsPort().isPresent() ? "https" : "http";
int httpPort = configuration.getAgentHttpsPort().isPresent()
? configuration.getAgentHttpsPort().get()
Expand All @@ -1182,7 +1196,7 @@ private Response getFile(String slaveHostname, String fileFullPath, boolean down
String url = String.format(
"%s://%s:%s/files/download",
httpPrefix,
slaveHostname,
agentHostname,
httpPort
);

Expand Down