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

implement multiprocessing #173

Closed
wants to merge 8 commits into from
Closed

implement multiprocessing #173

wants to merge 8 commits into from

Conversation

aogier
Copy link
Contributor

@aogier aogier commented Nov 22, 2022

ciao, this PR implements #172 by using multiprocessing.Processes. The choice is up to user via a Text parameter, and pool size is ATM locked to core numbers, but I'd want it to be configurable as well. Tests have been extended to basically run twice on either mp options, but I'll review that adding some cross mp/non-mp check.

Buut this is definitely ready for a first review so what do you think? Thank you, regards

@aogier
Copy link
Contributor Author

aogier commented Nov 22, 2022

@jsvine ping because this is still a draft :)

@aogier aogier marked this pull request as ready for review November 23, 2022 18:28
@aogier
Copy link
Contributor Author

aogier commented Dec 7, 2022

not completely sure if I correctly understand the lint errors, could it depends on a newer, stricter flake8 config file parsing?

@jsvine
Copy link
Owner

jsvine commented Dec 7, 2022

No worries, I'll investigate what's happening 👍

@jsvine
Copy link
Owner

jsvine commented Dec 7, 2022

@aogier Required a few tooling changes, but now linters are working and tests seem to be flagging a meaningful issue (as opposed just to infrastructure problems). Want to look into that?

I also had to put the call to os.sched_getaffinity in a try block because Python's scheduler interface is not supported on all platforms. Is there another way you'd prefer to set the default pool size?

@jsvine
Copy link
Owner

jsvine commented Dec 8, 2022

@aogier, whoops, I can fix the error being raised by python -m coverage html in the latest run.

@aogier
Copy link
Contributor Author

aogier commented Dec 8, 2022

ok @jsvine thx, let me know whatever should you need

DEFAULT_MP_POOL_SIZE = 4

# TODO: find something which cannot be present in input
END = "KTHXBYE"
Copy link
Owner

Choose a reason for hiding this comment

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

@aogier Could you tell me a bit more about your thinking here (and related uses below), esp. re. how it relates to multiprocessing?

Copy link
Owner

@jsvine jsvine Jan 22, 2023

Choose a reason for hiding this comment

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

Ah, thank you for the explanation. markovify currently uses these markers:

BEGIN = "___BEGIN__"
END = "___END__"

Is that the sort of thing you're aiming to do here, or is it slightly different?

@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #173 (6033293) into master (031d236) will decrease coverage by 2.52%.
The diff coverage is 82.35%.

❗ Current head 6033293 differs from pull request most recent head 48a35fa. Consider uploading reports for the commit 48a35fa to get more accurate results

@@             Coverage Diff             @@
##            master     #173      +/-   ##
===========================================
- Coverage   100.00%   97.47%   -2.53%     
===========================================
  Files            6        5       -1     
  Lines          313      357      +44     
===========================================
+ Hits           313      348      +35     
- Misses           0        9       +9     
Impacted Files Coverage Δ
markovify/text.py 95.13% <82.35%> (-4.87%) ⬇️
markovify/__init__.py

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@aogier
Copy link
Contributor Author

aogier commented Dec 8, 2022

I will check on coverage stuff asap, now ATM I'm more interested in a beer or two but I'll take a look later or tomorrow :P - I'm also curious on what windows is doing, we will see at timeout I guess, ciao!

@aogier aogier marked this pull request as draft December 11, 2022 21:12
@aogier aogier mentioned this pull request Dec 12, 2022
@aogier aogier marked this pull request as ready for review December 12, 2022 18:35
@aogier aogier requested a review from jsvine January 19, 2023 13:09
@jsvine
Copy link
Owner

jsvine commented Jan 22, 2023

Thanks for the ping, @aogier. Review request received :) I haven't had the time to review closely, but it's in my personal queue. In the meantime, if anyone in the community has feedback, that would also be welcome.

@aogier
Copy link
Contributor Author

aogier commented Mar 12, 2023

Thanks for the ping, @aogier. Review request received :) I haven't had the time to review closely, but it's in my personal queue. In the meantime, if anyone in the community has feedback, that would also be welcome.

yeah kid, it looks ur personal queue is non-existent, which is ok, just a bit rude not to forewarn this :) I'll fork asap, thx for your work

@jsvine
Copy link
Owner

jsvine commented Mar 13, 2023

Hi @aogier, although I'm not a fan of that message's tone, I recognize that it has taken me longer than I hoped to prioritize this PR. As is true for many open-source projects, markovify is an entirely volunteer/unpaid endeavor, work has been busy the past few months, and the package has been fairly stable for many years. That said, let's try to find a time to discuss your PR synchronously, which will help me to review it more quickly. You can find my email address in my profile.

@aogier
Copy link
Contributor Author

aogier commented Mar 13, 2023

no, I am not a fan of such a behaviour when I ask if I can do some work if I can get at least some feedback and yes go w/ it, but then it's a no. My time is free too, my effort is volunteering too, so my friend at least try not to bullshit me by telling me you have it in the todo when that is simply not true (which could be fine, although a little rude given I've spent some time because you told me you could then put some).
So stop kidding ourselves, if you're not comfortable with people contributing things that you didn't do that's perfectly fine, it means I'll propose the change, which is of value to me, in a fork to which I'll give the attention I like best. Greetings

@aogier aogier closed this Mar 13, 2023
@aogier aogier deleted the feature/172-multiprocess branch March 13, 2023 14:33
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