Interface SpallocAPI
- All Known Implementing Classes:
Spalloc
public interface SpallocAPI
The API of the core service that interacts with the database.
- Author:
- Donal Fellows
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDescribes the locations of boards in a machine.static final classA request for a specific board.static classDescribes what sort of request to create a job this is.static final classA request for a rectangle of boards.static final classA request for a rectangle of triads rooted at a particular triad.static final classA request for a number of boards.static interfaceVisitor forSpallocAPI.CreateDescriptor.static classSome requests have the locations of boards.static interfaceDescribes a particular job known to the allocator.static interfaceDescribes a list of jobs known to the allocator.static interfaceDescribes a particular machine known to the allocator.static interfaceA view of part of a machine that is allocated to a job.static interfaceA thing that may be waited upon. -
Method Summary
Modifier and TypeMethodDescriptioncreateJob(@NotNull String owner, @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) Create a job for a user that is only in one group.createJobForNMPIJob(@NotNull String owner, int nmpiJobId, @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) Create a job for interactive use in an NMPI Collab Session.createJobInCollabSession(@NotNull String owner, @NotNull String nmpiCollab, @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) Create a job for interactive use in an NMPI Collab Session.createJobInGroup(@NotNull String owner, @NotNull String group, @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) Create a job for a user in a specific local group.voidemergencyStop(String commandCode) Get a specific job.getJobInfo(Permit permit, int id) Get a specific job.getJobs(boolean deleted, int limit, int start) List the jobs.getMachine(@NotNull String name, boolean allowOutOfService) Get a specific machine.getMachineInfo(@NotNull String machine, boolean allowOutOfService, Permit permit) Get info about a specific machine.getMachines(boolean allowOutOfService) List the machines.List the active jobs.listMachines(boolean allowOutOfService) List the machines.voidPurge the cache of what boards are down.voidreportProblem(@IPAddress String address, HasChipLocation coreLocation, String description, Permit permit) Tells the service that there may be a problem with a board at a particular address.
-
Method Details
-
getMachines
List the machines.- Parameters:
allowOutOfService- Whether to include machines marked as out of service.- Returns:
- A mapping from names to machines (which are live objects).
-
listMachines
List the machines.- Parameters:
allowOutOfService- Whether to include machines marked as out of service.- Returns:
- A description of all the machines.
-
getMachine
Get a specific machine.- Parameters:
name- The name of the machine to get.allowOutOfService- Whether to include machines marked as out of service.- Returns:
- A machine, on which more operations can be done.
-
getMachineInfo
Optional<MachineDescription> getMachineInfo(@NotNull @NotNull String machine, boolean allowOutOfService, Permit permit) Get info about a specific machine.- Parameters:
machine- The name of the machine to get.allowOutOfService- Whether to include machines marked as out of service.permit- Encodes what the caller may do.- Returns:
- A machine description model.
-
getJobs
List the jobs.- Parameters:
deleted- Whether to include deleted jobs in the list.limit- Maximum number of jobs in the returned list. Used for paging.start- How many jobs to skip past. Used for paging.- Returns:
- A list of jobs.
-
listJobs
List the active jobs.- Parameters:
permit- Encodes what the caller may do.- Returns:
- A description of all the active jobs.
-
getJob
@PostFilter("#permit.admin or #permit.nmpiexec or #permit.name == filterObject.owner.orElse(null)") Optional<SpallocAPI.Job> getJob(Permit permit, int id) Get a specific job. Only owners or admins can see full job details or manipulate the job.- Parameters:
permit- Encodes what the caller may do.id- The identifier of the job.- Returns:
- A job object on which more operations can be done, or empty if the job isn't there or isn't available to you.
-
getJobInfo
@PostFilter("#permit.admin or #permit.nmpiexec or #permit.name == filterObject.owner.orElse(null)") Optional<JobDescription> getJobInfo(Permit permit, int id) Get a specific job. Only owners or admins can see full job details or manipulate the job.- Parameters:
permit- Encodes what the caller may do.id- The identifier of the job.- Returns:
- A job description, or empty if the job isn't there (or isn't available to you).
-
createJob
SpallocAPI.Job createJob(@NotNull @NotNull String owner, @Valid @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) throws IllegalArgumentException Create a job for a user that is only in one group. Note that jobs cannot be created on machines that are out of service, but marking a machine as out of service does not stop the jobs that are already running on it.- Parameters:
owner- Who is making this job.descriptor- What sort of allocation is desired?machineName- The name of the machine the user wants to allocate on, ornullif they want to select by tags.tags- The tags of the machine the user wants to allocate on, ornullif they want to select by name.keepaliveInterval- The maximum interval between keepalive requests or the job becomes eligible for automated deletion.originalRequest- The serialized original request, which will be stored in the database for later retrieval.- Returns:
- The job created.
- Throws:
IllegalArgumentException- if the job could not be created.
-
createJobInGroup
SpallocAPI.Job createJobInGroup(@NotNull @NotNull String owner, @NotNull @NotNull String group, @Valid @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) throws IllegalArgumentException Create a job for a user in a specific local group. Note that jobs cannot be created on machines that are out of service, but marking a machine as out of service does not stop the jobs that are already running on it.- Parameters:
owner- Who is making this job.group- What group is associated with this job for accounting purposes.descriptor- What sort of allocation is desired?machineName- The name of the machine the user wants to allocate on, ornullif they want to select by tags.tags- The tags of the machine the user wants to allocate on, ornullif they want to select by name.keepaliveInterval- The maximum interval between keepalive requests or the job becomes eligible for automated deletion.originalRequest- The serialized original request, which will be stored in the database for later retrieval.- Returns:
- The job created.
- Throws:
IllegalArgumentException- if the job could not be created.
-
createJobInCollabSession
SpallocAPI.Job createJobInCollabSession(@NotNull @NotNull String owner, @NotNull @NotNull String nmpiCollab, @Valid @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) throws IllegalArgumentException Create a job for interactive use in an NMPI Collab Session. Note that jobs cannot be created on machines that are out of service, but marking a machine as out of service does not stop the jobs that are already running on it.- Parameters:
owner- Who is making this job.nmpiCollab- The NMPI Collab to manage a session in, and from which the quota will be used.descriptor- What sort of allocation is desired?machineName- The name of the machine the user wants to allocate on, ornullif they want to select by tags.tags- The tags of the machine the user wants to allocate on, ornullif they want to select by name.keepaliveInterval- The maximum interval between keepalive requests or the job becomes eligible for automated deletion.originalRequest- The serialized original request, which will be stored in the database for later retrieval.- Returns:
- The job created.
- Throws:
IllegalArgumentException- if the job could not be created.
-
createJobForNMPIJob
@PreAuthorize("hasRole(\'NMPI_EXEC\')") SpallocAPI.Job createJobForNMPIJob(@NotNull @NotNull String owner, int nmpiJobId, @Valid @Valid SpallocAPI.CreateDescriptor descriptor, String machineName, List<String> tags, Duration keepaliveInterval, byte[] originalRequest) throws IllegalArgumentException Create a job for interactive use in an NMPI Collab Session. Note that jobs cannot be created on machines that are out of service, but marking a machine as out of service does not stop the jobs that are already running on it.- Parameters:
owner- Who is making this job.nmpiJobId- The NMPI Job to allocate the quota used to. The collab of the Job will be used for internal accounting purposes.descriptor- What sort of allocation is desired?machineName- The name of the machine the user wants to allocate on, ornullif they want to select by tags.tags- The tags of the machine the user wants to allocate on, ornullif they want to select by name.keepaliveInterval- The maximum interval between keepalive requests or the job becomes eligible for automated deletion.originalRequest- The serialized original request, which will be stored in the database for later retrieval.- Returns:
- The job created.
- Throws:
IllegalArgumentException- if the job could not be created.
-
purgeDownCache
void purgeDownCache()Purge the cache of what boards are down. -
reportProblem
void reportProblem(@IPAddress @IPAddress String address, HasChipLocation coreLocation, String description, Permit permit) Tells the service that there may be a problem with a board at a particular address.- Parameters:
address- The IP address of the board. Note that we haven't yet identified which machine has the board.coreLocation- Where on the board is the problem. If the problem is at the core level, it's aHasCoreLocation. If the problem is at the board level, this isnull.description- Optional problem description. May benull.permit- Who is making the request.
-
emergencyStop
-