Interface JobManagerInterface
- All Known Implementing Classes:
JobManager
@Path("job")
public interface JobManagerInterface
JAX-RS interface to a
Job
for the purposes of management.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The media type for JSON.static final String
The media type for Binary data.static final String
The media type of ZIP files.static final String
The name of the file we like to serve up when giving people a remote process manager.static final String
The path to the interface.static final String
The name of the setup script.static final String
The media type for text. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addOutput
(String projectId, int id, String output, InputStream input) Add to the output files of a job.void
addProvenance
(int id, List<String> path, String value) Add to the provenance of a job.void
Add to the log of a job.checkMachineLease
(int id, int waitTime) Check if the job is still allocated to a machine.void
extendJobMachineLease
(int id, double runTime) Extend the lease of the job.getChipCoordinates
(int id, String machineName, int chipX, int chipY) Get a description of where a chip actually is.getJobMachine
(int id, int nCores, int nChips, int nBoards, double runTime) Get a machine for running a job.jakarta.ws.rs.core.Response
Get the implementation code of the Job Process Manager.getLargestJobMachine
(int id, double runTime) Get the largest machine that could run a job.getNextJob
(String executerId) Get the job manager to find out what its next job will be.jakarta.ws.rs.core.Response
Get the setup script to be executed.void
releaseMachine
(int id, String machineName) Drop the allocation of a machine to a job.void
setJobError
(String projectId, int id, String error, String logToAppend, String baseFilename, List<String> outputs, RemoteStackTrace stackTrace) Mark the job as finished with an error.void
setJobFinished
(String projectId, int id, String logToAppend, String baseFilename, List<String> outputs) Mark the job as successfully finished.void
setMachinePower
(int id, String machineName, boolean powerOn) Set the power status of a job's machine.
-
Field Details
-
PATH
The path to the interface.- See Also:
-
APPLICATION_ZIP
The media type of ZIP files.- See Also:
-
APPLICATION_JSON
The media type for JSON.- See Also:
-
APPLICATION_OCTET_STREAM
The media type for Binary data.- See Also:
-
TEXT_PLAIN
The media type for text.- See Also:
-
JOB_PROCESS_MANAGER
The name of the file we like to serve up when giving people a remote process manager.- See Also:
-
SETUP_SCRIPT
The name of the setup script.- See Also:
-
-
Method Details
-
getNextJob
@GET @Path("next") @Produces("application/json") Job getNextJob(@QueryParam("executerId") String executerId) Get the job manager to find out what its next job will be.- Parameters:
executerId
- The executor to talk about.- Returns:
- The job discovered.
-
getLargestJobMachine
@GET @Path("{id}/machine/max") @Produces("application/json") SpinnakerMachine getLargestJobMachine(@PathParam("id") int id, @QueryParam("runTime") @DefaultValue("-1") double runTime) Get the largest machine that could run a job.- Parameters:
id
- The job ID.runTime
- How much resource to allocate. Can be omitted, in which case it is set to -1.- Returns:
- The machine descriptor.
-
getJobMachine
@GET @Path("{id}/machine") @Produces("application/json") SpinnakerMachine getJobMachine(@PathParam("id") int id, @QueryParam("nCores") @DefaultValue("-1") int nCores, @QueryParam("nChips") @DefaultValue("-1") int nChips, @QueryParam("nBoards") @DefaultValue("-1") int nBoards, @QueryParam("runTime") @DefaultValue("-1") double runTime) Get a machine for running a job. Typically, only one ofnCores
,nChips
andnBoards
will be specified.- Parameters:
id
- The job ID.nCores
- The number of cores wanted. Can be omitted, in which case it is set to -1.nChips
- The number of chips wanted. Can be omitted, in which case it is set to -1.nBoards
- The number of boards wanted. Can be omitted, in which case it is set to -1.runTime
- How much resource to allocate. Can be omitted, in which case it is set to -1.- Returns:
- The machine descriptor.
-
checkMachineLease
@GET @Path("{id}/machine/checkLease") @Produces("application/json") JobMachineAllocated checkMachineLease(@PathParam("id") int id, @QueryParam("waitTime") @DefaultValue("10000") int waitTime) Check if the job is still allocated to a machine.- Parameters:
id
- The job IDwaitTime
- How long should the lease time be. Can be omitted, in which case it is set to 1000.- Returns:
- Whether the job is allocated.
-
extendJobMachineLease
@GET @Path("{id}/machine/extendLease") void extendJobMachineLease(@PathParam("id") int id, @QueryParam("runTime") @DefaultValue("-1") double runTime) Extend the lease of the job.- Parameters:
id
- The job IDrunTime
- How long has the job actually run. Can be omitted, in which case it is set to -1.
-
releaseMachine
@DELETE @Path("{id}/machine") void releaseMachine(@PathParam("id") int id, @QueryParam("machineName") String machineName) Drop the allocation of a machine to a job.- Parameters:
id
- The job IDmachineName
- The name of the machine to stop using.
-
setMachinePower
@PUT @Path("{id}/machine/power") void setMachinePower(@PathParam("id") int id, @QueryParam("machineName") String machineName, @QueryParam("on") boolean powerOn) Set the power status of a job's machine.- Parameters:
id
- The job IDmachineName
- The name of the machine to control the power of.powerOn
- True of the machine is to be switched on; false to switch it off.
-
getChipCoordinates
@GET @Path("{id}/machine/chipCoordinates") @Produces("application/json") ChipCoordinates getChipCoordinates(@PathParam("id") int id, @QueryParam("machineName") String machineName, @QueryParam("chipX") int chipX, @QueryParam("chipY") int chipY) Get a description of where a chip actually is.- Parameters:
id
- The job IDmachineName
- The name of the machine to control the power of.chipX
- The virtual X coordinate of the chip.chipY
- The virtual Y coordinate of the chip.- Returns:
- The coordinates of the chip
-
appendLog
@POST @Path("{id}/log") @Consumes("text/plain") void appendLog(@PathParam("id") int id, String logToAppend) Add to the log of a job.- Parameters:
id
- The job IDlogToAppend
- The string to append to the log.
-
addProvenance
@POST @Path("{id}/provenance") void addProvenance(@PathParam("id") int id, @QueryParam("name") List<String> path, @QueryParam("value") String value) Add to the provenance of a job.- Parameters:
id
- The job IDpath
- The path into the JSON provenance doc.value
- The value to set at that point.
-
addOutput
@POST @Path("{projectId}/{id}/addoutput") @Consumes("application/octet-stream") void addOutput(@PathParam("projectId") String projectId, @PathParam("id") int id, @QueryParam("outputFilename") String output, InputStream input) Add to the output files of a job.- Parameters:
projectId
- The ID of the project owning the job.id
- The job IDoutput
- The name of the file to write to.input
- The contents of the file, streamed.
-
setJobFinished
@POST @Path("{projectId}/{id}/finished") @Consumes("text/plain") void setJobFinished(@PathParam("projectId") String projectId, @PathParam("id") int id, String logToAppend, @QueryParam("baseFilename") String baseFilename, @QueryParam("outputFilename") List<String> outputs) Mark the job as successfully finished.- Parameters:
projectId
- The ID of the project owning the job.id
- The id of the job.logToAppend
- The job log data.baseFilename
- The base of filenames.outputs
- The list of output files.
-
setJobError
@POST @Path("{projectId}/{id}/error") @Consumes("application/json") void setJobError(@PathParam("projectId") String projectId, @PathParam("id") int id, @QueryParam("error") String error, @QueryParam("logToAppend") String logToAppend, @QueryParam("baseFilename") String baseFilename, @QueryParam("outputFilename") List<String> outputs, RemoteStackTrace stackTrace) Mark the job as finished with an error.- Parameters:
projectId
- The project owning the job.id
- The id of the job.error
- The error message.logToAppend
- The job log data.baseFilename
- The base of filenames.outputs
- The list of output files.stackTrace
- The stack trace of the exception that caused the error.
-
getJobProcessManager
@GET @Path("SpiNNaker-nmpiexec.jar") @Produces("application/octet-stream") jakarta.ws.rs.core.Response getJobProcessManager()Get the implementation code of the Job Process Manager.- Returns:
- a response containing the ZIP file.
-
getSetupScript
@GET @Path("setup.bash") @Produces("application/octet-stream") jakarta.ws.rs.core.Response getSetupScript() throws IOExceptionGet the setup script to be executed.- Returns:
- a response containing the setup script
- Throws:
IOException
- if something goes wrong
-