Interface JobManagerInterface

All Known Implementing Classes:
JobManager

@Path("job") public interface JobManagerInterface
JAX-RS interface to a Job for the purposes of management.
  • Field Details

  • 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 of nCores, nChips and nBoards 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 ID
      waitTime - 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 ID
      runTime - 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 ID
      machineName - 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 ID
      machineName - 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 ID
      machineName - 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 ID
      logToAppend - 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 ID
      path - 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 ID
      output - 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 IOException
      Get the setup script to be executed.
      Returns:
      a response containing the setup script
      Throws:
      IOException - if something goes wrong