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 Classes Modifier and Type Interface Description static interface
SpallocAPI.BoardLocation
Describes the locations of boards in a machine.static class
SpallocAPI.CreateBoard
A request for a specific board.static class
SpallocAPI.CreateDescriptor
Describes what sort of request to create a job this is.static class
SpallocAPI.CreateDimensions
A request for a rectangle of boards.static class
SpallocAPI.CreateDimensionsAt
A request for a rectangle of triads rooted at a particular triad.static class
SpallocAPI.CreateNumBoards
A request for a number of boards.static interface
SpallocAPI.CreateVisitor<T>
Visitor forSpallocAPI.CreateDescriptor
.static class
SpallocAPI.HasBoardCoords
Some requests have the locations of boards.static interface
SpallocAPI.Job
Describes a particular job known to the allocator.static interface
SpallocAPI.Jobs
Describes a list of jobs known to the allocator.static interface
SpallocAPI.Machine
Describes a particular machine known to the allocator.static interface
SpallocAPI.SubMachine
A view of part of a machine that is allocated to a job.static interface
SpallocAPI.Waitable
A thing that may be waited upon. -
Method Summary
Modifier and Type Method Description SpallocAPI.Job
createJob(@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.SpallocAPI.Job
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.SpallocAPI.Job
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.SpallocAPI.Job
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.Optional<SpallocAPI.Job>
getJob(Permit permit, int id)
Get a specific job.Optional<JobDescription>
getJobInfo(Permit permit, int id)
Get a specific job.SpallocAPI.Jobs
getJobs(boolean deleted, int limit, int start)
List the jobs.Optional<SpallocAPI.Machine>
getMachine(@NotNull String name, boolean allowOutOfService)
Get a specific machine.Optional<MachineDescription>
getMachineInfo(@NotNull String machine, boolean allowOutOfService, Permit permit)
Get info about a specific machine.Map<String,SpallocAPI.Machine>
getMachines(boolean allowOutOfService)
List the machines.List<JobListEntryRecord>
listJobs(Permit permit)
List the active jobs.List<MachineListEntryRecord>
listMachines(boolean allowOutOfService)
List the machines.void
purgeDownCache()
Purge the cache of what boards are down.void
reportProblem(@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 IllegalArgumentExceptionCreate 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, ornull
if they want to select by tags.tags
- The tags of the machine the user wants to allocate on, ornull
if 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 IllegalArgumentExceptionCreate 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, ornull
if they want to select by tags.tags
- The tags of the machine the user wants to allocate on, ornull
if 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 IllegalArgumentExceptionCreate 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, ornull
if they want to select by tags.tags
- The tags of the machine the user wants to allocate on, ornull
if 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 IllegalArgumentExceptionCreate 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, ornull
if they want to select by tags.tags
- The tags of the machine the user wants to allocate on, ornull
if 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.
-