Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@indepndnt
Copy link
Contributor

I wrote up what I found in issue #2038, so I though I should create a PR with my suggested fixes.

@codecov
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.76%. Comparing base (34f83d6) to head (08d5bd3).
Report is 34 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2039      +/-   ##
==========================================
+ Coverage   93.61%   93.76%   +0.14%     
==========================================
  Files          28       29       +1     
  Lines        3758     3863     +105     
==========================================
+ Hits         3518     3622     +104     
- Misses        240      241       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

rq/job.py Outdated
return None

def get_status(self, refresh: bool = True) -> JobStatus:
def get_status(self, refresh: bool = True) -> Optional[JobStatus]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think get_status() should always returns something. If the job hash in Redis has no status, raise an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the note. I updated it to raise an exception if there's no status in Redis. I added a status=JobStatus.QUEUED to a few Job.create calls in other tests so that they wouldn't fail as a result. I don't think this changed the purpose or accuracy of those tests.

status = self.connection.hget(self.key, 'status')
self._status = as_text(status) if status else None
if not status:
raise InvalidJobOperation(f"Failed to retrieve status for job: {self.id}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mind updating the test to test this code path so it can pass Codecov's test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing!

@selwin selwin merged commit 180c9af into rq:master May 26, 2024
@selwin
Copy link
Collaborator

selwin commented May 26, 2024

Thanks!

Flix6x added a commit to FlexMeasures/flexmeasures that referenced this pull request Nov 8, 2024
Flix6x added a commit to FlexMeasures/flexmeasures that referenced this pull request Nov 8, 2024
* feat: test for Python 3.12

* feat: packages for Python 3.12

* fix: called_once_with should be assert_called_once_with

Signed-off-by: F.N. Claessen <[email protected]>

* fix: don't assert assert_method

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add Python 3.12 classifier in setup.py

Signed-off-by: F.N. Claessen <[email protected]>

* fix: getting the status of a not yet queued job now results in an InvalidJobOperation; see rq/rq#2039

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Flix6x added a commit to FlexMeasures/flexmeasures that referenced this pull request Nov 8, 2024
* feat: test for Python 3.12

* feat: packages for Python 3.12

* fix: called_once_with should be assert_called_once_with

Signed-off-by: F.N. Claessen <[email protected]>

* fix: don't assert assert_method

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add Python 3.12 classifier in setup.py

Signed-off-by: F.N. Claessen <[email protected]>

* fix: getting the status of a not yet queued job now results in an InvalidJobOperation; see rq/rq#2039

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>

(cherry picked from commit faf7f55)
Signed-off-by: F.N. Claessen <[email protected]>
Flix6x added a commit to FlexMeasures/flexmeasures that referenced this pull request Nov 17, 2024
Flix6x added a commit to FlexMeasures/flexmeasures that referenced this pull request Nov 17, 2024
… in MW (#1234)

* feat: `flexmeasures add sensor` no longer requires setting a capacity in MW

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: CLI changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* fix: getting the status of a not yet queued job now results in an InvalidJobOperation; see rq/rq#2039

Signed-off-by: F.N. Claessen <[email protected]>

* docs: explain abbreviation used in changelog

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix typo

Signed-off-by: F.N. Claessen <[email protected]>

* docs: format CLI option and correct nomenclature (a flag is a boolean option, which this isn't)

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Flix6x added a commit to FlexMeasures/flexmeasures that referenced this pull request Jan 17, 2025
… in MW (#1234)

* feat: `flexmeasures add sensor` no longer requires setting a capacity in MW

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: CLI changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* fix: getting the status of a not yet queued job now results in an InvalidJobOperation; see rq/rq#2039

Signed-off-by: F.N. Claessen <[email protected]>

* docs: explain abbreviation used in changelog

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix typo

Signed-off-by: F.N. Claessen <[email protected]>

* docs: format CLI option and correct nomenclature (a flag is a boolean option, which this isn't)

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
(cherry picked from commit 772f73e)
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.

2 participants