Skip to content

Commit

Permalink
remove timout from job kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Nov 27, 2024
1 parent 8ae14ea commit 6b5107c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions spalloc_client/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def __init__(self, *args: int, hostname: Optional[str] = NO_STR,
pick_num(max_dead_links, config.max_dead_links),
"require_torus":
pick_bool(require_torus, config.require_torus),
"timeout": self._timeout,
}

# Sanity check arguments
Expand All @@ -368,7 +367,8 @@ def __init__(self, *args: int, hostname: Optional[str] = NO_STR,
self._keepalive = job_kwargs["keepalive"]

# Create the job (failing fast if can't communicate)
self.id = self._client.create_job(*job_args, **job_kwargs)
self.id = self._client.create_job(
self._timeout, *job_args, **job_kwargs)

logger.info("Created spalloc job %d", self.id)

Expand Down
4 changes: 2 additions & 2 deletions spalloc_client/protocol_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def version(self, timeout: Optional[float] = None) -> str:
""" Ask what version of spalloc is running. """
return cast(str, self.call("version", timeout))

def create_job(self, *args: int,
def create_job(self, timeout: Optional[float], *args: int,
**kwargs: Union[float, str, List[str], None]) -> int:
"""
Start a new job
Expand All @@ -389,7 +389,7 @@ def create_job(self, *args: int,
if "owner" not in kwargs:
raise SpallocServerException(
"owner must be specified for all jobs.")
return cast(int, self.call("create_job", None, *args, **kwargs))
return cast(int, self.call("create_job", timeout, *args, **kwargs))

def job_keepalive(self, job_id: int,
timeout: Optional[float] = None) -> JsonObject:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_protocol_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ def test_commands_as_methods(c, s, bg_accept):
bg_accept.join()

s.send({"return": "Woo"})
assert c.create_job(1, bar=2, owner="dummy") == "Woo"
no_timeout = None
assert c.create_job(no_timeout, 1, bar=2, owner="dummy") == "Woo"
assert s.recv() == {
"command": "create_job", "args": [1], "kwargs": {
"bar": 2, "owner": "dummy"}}
Expand Down

0 comments on commit 6b5107c

Please sign in to comment.