Skip to content

Add get_job_position and get_position feature#1271

Merged
selwin merged 1 commit intorq:masterfrom
aparcar:position
Jun 28, 2020
Merged

Add get_job_position and get_position feature#1271
selwin merged 1 commit intorq:masterfrom
aparcar:position

Conversation

@aparcar
Copy link
Contributor

@aparcar aparcar commented Jun 11, 2020

Fix #1197

Signed-off-by: Paul Spooren [email protected]

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #1271 into master will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1271      +/-   ##
==========================================
+ Coverage   93.72%   93.87%   +0.15%     
==========================================
  Files          22       22              
  Lines        2341     2352      +11     
==========================================
+ Hits         2194     2208      +14     
+ Misses        147      144       -3     
Impacted Files Coverage Δ
rq/job.py 97.59% <100.00%> (+0.03%) ⬆️
rq/queue.py 93.35% <100.00%> (+0.10%) ⬆️
rq/worker.py 91.01% <0.00%> (+0.49%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29222ea...6e0b3e1. Read the comment docs.

Comment on lines +164 to +166
job_id = job_or_id.id if isinstance(job_or_id, self.job_class) else job_or_id
if job_id in self.job_ids:
return self.job_ids.index(job_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://redis.io/commands/lpos has been added to Redis' docs. Should we first try to use lpos before falling back to this?

lpos is only available on Redis >= 6.0.6 so most servers won't have it, but the numbers should grow over time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this into redis-py first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a PR let's see how quick this goes upstream. @selwin how do you implement those version checks? Is there a global feature state which determines how functions behave? I'd prefer not to run a try/except each time :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to have checks for PY2/3. We've never had checks for Redis server version before.

I'm open to however you want to implement this, as long as the implementation is sound. I'm even ok with try/except because this is not a performance sensitive area of the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to merge it now and I'll do a two part PR later, adding Redis version awareness and to automatically use LPOS if both py-redis and Redis are the correct version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get queue position of job

2 participants