Interface SpallocJobAPI
- All Known Implementing Classes:
SpallocJob
public interface SpallocJobAPI
The interface supported by a spalloc job.
-
Method Summary
Modifier and Type Method Description default void
destroy()
Destroy the job and disconnect from the server.void
destroy(String reason)
Destroy the job and disconnect from the server.List<BoardCoordinates>
getBoards()
List<Connection>
getConnections()
String
getDestroyReason()
MachineDimensions
getDimensions()
String
getHostname()
int
getID()
String
getMachineName()
Boolean
getPower()
State
getState()
default TransceiverInterface
getTransceiver()
Construct a transceiver for talking to this job.default void
reset()
Reset (power-cycle) the boards allocated to the job.void
setPower(Boolean powerOn)
Turn the boards allocated to the job on or off.default State
waitForStateChange(State oldState)
Block until the job's state changes from the supplied state.State
waitForStateChange(State oldState, Integer timeout)
Block until the job's state changes from the supplied state.void
waitUntilReady(Integer timeout)
Block until the job is allocated and ready.BoardPhysicalCoordinates
whereIs(HasChipLocation chip)
Locates and returns the physical coordinates containing a given chip in a machine allocated to this job.
-
Method Details
-
destroy
Destroy the job and disconnect from the server.- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
destroy
Destroy the job and disconnect from the server.- Parameters:
reason
- Gives a human-readable explanation for the destruction of the job.- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
setPower
Turn the boards allocated to the job on or off.Does nothing if the job has not yet been allocated any boards.
The
waitUntilReady(Integer)
method may be used to wait for the boards to fully turn on or off.- Parameters:
powerOn
- true to power on the boards, false to power off. If the boards are already turned on, setting power to true will reset them. Ifnull
, this method does nothing.- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
reset
Reset (power-cycle) the boards allocated to the job.Does nothing if the job has not been allocated.
The
waitUntilReady(Integer)
method may be used to wait for the boards to fully turn on or off.- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
getID
int getID()- Returns:
- The ID of the job.
-
getState
- Returns:
- The current state of the job.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
getPower
- Returns:
- The current power state of the job.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
getDestroyReason
- Returns:
- The reason for destruction of the job, or
null
if there is no reason (perhaps because the job isn't destroyed). Note that you should usegetState()
to determine if the job is destroyed, not this method. - Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
getConnections
List<Connection> getConnections() throws IOException, SpallocServerException, IllegalStateException, InterruptedException- Returns:
- The list of connections, where each connection says what the hostname is to talk to a particular board's root chip.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.IllegalStateException
- If the spalloc job is not Ready.InterruptedException
- If interrupted while waiting.
-
getTransceiver
@MustBeClosed default TransceiverInterface getTransceiver() throws IOException, SpallocServerException, IllegalStateException, InterruptedException, SpinnmanExceptionConstruct a transceiver for talking to this job.- Returns:
- A transceiver (or
null
if the job is in a state where it can't be talked to at the moment). Uses direct connections. Will be able to boot the allocated boards and talk SCP to them. BMP access will be disabled. - Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.IllegalStateException
- If the spalloc job is not Ready.InterruptedException
- If interrupted while waiting.SpinnmanException
- If the transceiver creation itself fails.
-
getHostname
- Returns:
- The name of the host that is the root chip of the whole allocation.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
getDimensions
MachineDimensions getDimensions() throws IOException, SpallocServerException, IllegalStateException, InterruptedException- Returns:
- The dimensions of the machine in chips, e.g., for booting.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.IllegalStateException
- If the spalloc job is not Ready.InterruptedException
- If interrupted while waiting.
-
getMachineName
String getMachineName() throws IOException, SpallocServerException, IllegalStateException, InterruptedException- Returns:
- The name of the machine the job is allocated on.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.IllegalStateException
- If the spalloc job is not Ready.InterruptedException
- If interrupted while waiting.
-
getBoards
List<BoardCoordinates> getBoards() throws IOException, SpallocServerException, IllegalStateException, InterruptedException- Returns:
- All the boards allocated to the job.
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.IllegalStateException
- If the spalloc job is not Ready.InterruptedException
- If interrupted while waiting.
-
waitForStateChange
default State waitForStateChange(State oldState) throws SpallocServerException, InterruptedExceptionBlock until the job's state changes from the supplied state.- Parameters:
oldState
- The current state.- Returns:
- The new state.
- Throws:
SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
waitForStateChange
State waitForStateChange(State oldState, Integer timeout) throws SpallocServerException, InterruptedExceptionBlock until the job's state changes from the supplied state.- Parameters:
oldState
- The current state.timeout
- The number of seconds to wait for a change before timing out. If None, wait forever.- Returns:
- The new state, or old state if timed out.
- Throws:
SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-
waitUntilReady
void waitUntilReady(Integer timeout) throws JobDestroyedException, IOException, SpallocServerException, SpallocStateChangeTimeoutException, InterruptedExceptionBlock until the job is allocated and ready.- Parameters:
timeout
- The number of milliseconds to wait before timing out. If None, wait forever.- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.SpallocStateChangeTimeoutException
- If the timeout expired before the ready state was entered.JobDestroyedException
- If the job was destroyed before becoming ready.InterruptedException
- If interrupted while waiting.
-
whereIs
BoardPhysicalCoordinates whereIs(HasChipLocation chip) throws IOException, SpallocServerException, InterruptedExceptionLocates and returns the physical coordinates containing a given chip in a machine allocated to this job.- Parameters:
chip
- The coordinates of the chip- Returns:
- the physical coordinates of the board
- Throws:
IOException
- If communications fail.SpallocServerException
- If the spalloc server rejects the operation request.InterruptedException
- If interrupted while waiting.
-