-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from SpiNNakerManchester/protocol-change
Protocol change
- Loading branch information
Showing
15 changed files
with
817 additions
and
842 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from spalloc.version import __version__ # noqa | ||
|
||
# Alias useful objects | ||
from spalloc.protocol_client import ProtocolClient # noqa | ||
from spalloc.protocol_client import ProtocolClient, ProtocolError # noqa | ||
from spalloc.protocol_client import ProtocolTimeoutError # noqa | ||
from spalloc.protocol_client import SpallocServerException # noqa | ||
from spalloc.job import Job, JobDestroyedError, StateChangeTimeoutError # noqa | ||
from spalloc.states import JobState # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import time | ||
|
||
|
||
def time_left(timestamp): | ||
"""Convert a timestamp into how long to wait for it.""" | ||
if timestamp is None: | ||
return None | ||
return max(0.0, timestamp - time.time()) | ||
|
||
|
||
def timed_out(timestamp): | ||
"""Check if a timestamp has been reached.""" | ||
if timestamp is None: | ||
return False | ||
return timestamp < time.time() | ||
|
||
|
||
def make_timeout(delay_seconds): | ||
"""Convert a delay (in seconds) into a timestamp.""" | ||
if delay_seconds is None: | ||
return None | ||
return time.time() + delay_seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.