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

feat: Use env variable to configure number of workers #1233

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

ukstv
Copy link
Contributor

@ukstv ukstv commented Jun 21, 2024

If env variable MULTIPROCESS_SIZE (as a decimal number) is set, it takes precedence over nodejs cpus().length of node:os.
That should fix a bug of "having" 32 processors on k8s regardless of the underlying number of CPUs.

@ukstv ukstv requested review from 3benbox and smrz2001 June 21, 2024 08:32
@@ -64,7 +64,10 @@ export class Multiprocess extends EventEmitter {
this.work()
return
}
let processes = options.workers || cpus().length // TODO workers = -1 or undef means no workers
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to understand why cpus() is returning incorrect results in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise this means having to constantly keep the env var updated when updating CAS resources in k8s.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And changed the code to use settings from what's inside the Docker.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!! Thanks 😊

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Please upload report for BASE (develop@54454dd). Learn more about missing BASE report.

Files Patch % Lines
src/ancillary/multiprocess.ts 0.00% 15 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #1233   +/-   ##
==========================================
  Coverage           ?   75.30%           
==========================================
  Files              ?       45           
  Lines              ?     1936           
  Branches           ?      320           
==========================================
  Hits               ?     1458           
  Misses             ?      478           
  Partials           ?        0           

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

Copy link
Contributor

@smrz2001 smrz2001 left a comment

Choose a reason for hiding this comment

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

🚀

@smrz2001 smrz2001 enabled auto-merge (squash) June 28, 2024 20:06
@smrz2001 smrz2001 merged commit f9678e6 into develop Jun 28, 2024
5 checks passed
@smrz2001 smrz2001 deleted the su/multiprocess-size branch June 28, 2024 20:17
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.

3 participants