Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition postgres 142 #147

Merged
merged 25 commits into from
Feb 14, 2020
Merged

Composition postgres 142 #147

merged 25 commits into from
Feb 14, 2020

Conversation

ewjoachim
Copy link
Member

Closes #142

Includes breaking changes (but I kept a compat layer and added a deprecation warning)

Successful PR Checklist:

  • Tests
  • Documentation (optionally: run spell checking)
  • Had a good time contributing? (if not, feel free to give some feedback) < Not as bad as expected :D

@codecov-io
Copy link

codecov-io commented Feb 8, 2020

Codecov Report

Merging #147 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #147   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          20     21    +1     
  Lines         796    817   +21     
  Branches       79     81    +2     
=====================================
+ Hits          796    817   +21
Impacted Files Coverage Δ
procrastinate/builtin_tasks.py 100% <ø> (ø) ⬆️
procrastinate/tasks.py 100% <ø> (ø) ⬆️
procrastinate/__init__.py 100% <100%> (ø) ⬆️
procrastinate/connector.py 100% <100%> (ø)
procrastinate/migration.py 100% <100%> (ø) ⬆️
procrastinate/healthchecks.py 100% <100%> (ø) ⬆️
procrastinate/app.py 100% <100%> (ø) ⬆️
procrastinate/jobs.py 100% <100%> (ø) ⬆️
procrastinate/store.py 100% <100%> (ø) ⬆️
procrastinate/testing.py 100% <100%> (ø) ⬆️
... and 3 more

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 61396c7...2d3b455. Read the comment docs.

@@ -13,37 +11,22 @@ def get_channel_for_queues(queues: Optional[Iterable[str]] = None) -> Iterable[s
return ["procrastinate_queue#" + queue for queue in queues]


class BaseJobStore:
class JobStore:
json_dumps: Optional[Callable] = None
json_loads: Optional[Callable] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

To be removed.


@property
def job_store(self) -> store.JobStore:
return store.JobStore(connector=self.connector)
Copy link
Member Author

Choose a reason for hiding this comment

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

instantiate in constructor

@ewjoachim
Copy link
Member Author

@elemoine @k4nar Shall I fixup my fixups ?

@k4nar
Copy link
Contributor

k4nar commented Feb 14, 2020

You can squash them if you want.

@ewjoachim ewjoachim force-pushed the composition-postgres-142 branch from b49b216 to 5abaed4 Compare February 14, 2020 12:53
@ewjoachim ewjoachim force-pushed the composition-postgres-142 branch from 5abaed4 to 9683ef2 Compare February 14, 2020 12:54
@ewjoachim
Copy link
Member Author

LGTY ?

Procrastinate defines an `InMemoryJobStore` that will speed up your tests,
remove dependency to PostgreSQL and allow you to have tasks run in a
Procrastinate defines an `InMemoryConnector` that will speed up your tests,
remove dependency to PostgreSQL and allows you to have tasks run in a
Copy link
Contributor

Choose a reason for hiding this comment

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

s/allows/allow, because of will earlier in the sentence.

)

def stop(self):
if self._connection:
interrupt_wait(connection=self._connection)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you purposefully remove stop here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case there shouldn't be a stop method in the InMemoryConnector either, no?

@@ -51,13 +57,29 @@ def __init__(
A :py:func:`App.task` that has a custom "name" parameter, that is not
imported and whose module path is not in this list will
fail to run.
job_store:
**Deprecated**: Old name of ``connector``
Copy link
Contributor

Choose a reason for hiding this comment

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

Final dot for consistency with the other docstrings.

connection=await self.get_connection(), socket_timeout=self.socket_timeout
# This can be called from a signal handler, better not do async stuff
def interrupt_wait(self):
if not self._connection:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to have if not self._connection or self._connection.closed here.

Copy link
Contributor

@elemoine elemoine left a comment

Choose a reason for hiding this comment

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

A few comments/questions, but otherwise looks very good. Good to merge whenever you think it's ready! Thanks!

@ewjoachim ewjoachim merged commit acf002d into master Feb 14, 2020
@ewjoachim ewjoachim mentioned this pull request Feb 14, 2020
@ewjoachim ewjoachim deleted the composition-postgres-142 branch April 10, 2020 09:06
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.

Composition instead of inheritance for PostgresJobStore
4 participants