Skip to content

Commit

Permalink
Upgrade reqless-core and make needed API updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tdg5 committed Aug 15, 2024
1 parent 045e4e3 commit beac833
Show file tree
Hide file tree
Showing 11 changed files with 600 additions and 520 deletions.
9 changes: 5 additions & 4 deletions reqless/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def __init__(self, client: AbstractClient):

def complete(self, offset: int = 0, count: int = 25) -> List[str]:
"""Return the paginated jids of complete jobs"""
response: List[str] = self.client("jobs.completed", offset, count)
response_json = self.client("jobs.completed", offset, count)
response: List[str] = json.loads(response_json)
return response

def tracked(self) -> Dict[str, List[Any]]:
Expand Down Expand Up @@ -114,12 +115,12 @@ def __init__(self, client: AbstractClient):

@property
def counts(self) -> Dict[str, Any]:
counts: Dict[str, Any] = json.loads(self.client("workers.list"))
counts: Dict[str, Any] = json.loads(self.client("workers.counts"))
return counts

def __getitem__(self, worker_name: str) -> Dict[str, Any]:
"""Which jobs does a particular worker have running"""
result: Dict[str, Any] = json.loads(self.client("worker.counts", worker_name))
result: Dict[str, Any] = json.loads(self.client("worker.jobs", worker_name))
result["jobs"] = result["jobs"] or []
result["stalled"] = result["stalled"] or []
return result
Expand All @@ -133,7 +134,7 @@ def __init__(self, client: AbstractClient):

@property
def counts(self) -> Dict:
counts: Dict = json.loads(self.client("queues.list"))
counts: Dict = json.loads(self.client("queues.counts"))
return counts

def __getitem__(self, queue_name: str) -> AbstractQueue:
Expand Down
2 changes: 1 addition & 1 deletion reqless/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, client: AbstractClient):

@property
def all(self) -> Dict[str, Any]:
response: Dict[str, Any] = json.loads(self._client("config.get"))
response: Dict[str, Any] = json.loads(self._client("config.getAll"))
return response

def __len__(self) -> int:
Expand Down
8 changes: 5 additions & 3 deletions reqless/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ def cancel(self) -> List[str]:

def tag(self, *tags: str) -> List[str]:
"""Tag a job with additional tags"""
response: List[str] = self.client("job.addTag", self.jid, *tags)
response_json: str = self.client("job.addTag", self.jid, *tags)
response: List[str] = json.loads(response_json)
return response

def untag(self, *tags: str) -> List[str]:
"""Remove tags from a job"""
response: List[str] = self.client("job.removeTag", self.jid, *tags)
response_json: str = self.client("job.removeTag", self.jid, *tags)
response: List[str] = json.loads(response_json)
return response


Expand Down Expand Up @@ -515,7 +517,7 @@ def move(self, queue: str) -> bool:

def cancel(self) -> List[str]:
"""Cancel all future recurring jobs"""
self.client("recurringJob.unrecur", self.jid)
self.client("recurringJob.cancel", self.jid)
return [self.jid]

def tag(self, *tags: str) -> List[str]:
Expand Down
Loading

0 comments on commit beac833

Please sign in to comment.