Skip to content

Add concurrency support for more than one thread#681

Merged
j0k3r merged 30 commits into
serverless-heaven:masterfrom
vicary:feat/concurrency-5.4.0
Mar 4, 2021
Merged

Add concurrency support for more than one thread#681
j0k3r merged 30 commits into
serverless-heaven:masterfrom
vicary:feat/concurrency-5.4.0

Conversation

@vicary

@vicary vicary commented Jan 13, 2021

Copy link
Copy Markdown
Member

What did you implement:

Adding concurrency support for more than one thread.

Conditionally supersedes #680 if release/5.4.0 is more preferable than master.

How did you implement it:

Please see #517 (comment), basically I did two changes:

  1. Replacing serizliedCompile: Boolean with concurrency: Number
  2. Translates serializedCompile: true to concurrency: 1 for backward compatibility

How can we verify it:

Use the config below when packaging:

package:
  individually: true

custom:
  webpack:
    concurrency: 5

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: Yes
Is it a breaking change?: No

@vicary vicary mentioned this pull request Jan 14, 2021
7 tasks
@coyoteecd

Copy link
Copy Markdown
Contributor

@miguel-a-calles-mba @j0k3r can you have a look and merge this? I am using vicary's fork for half a year and would love to switch back to the official package.

@j0k3r

j0k3r commented Jan 26, 2021

Copy link
Copy Markdown
Member

@coyoteecd we are in the process of cleaning up stuff to release 5.4.0 and this will be part of it

@j0k3r j0k3r closed this Jan 29, 2021
@j0k3r j0k3r deleted the branch serverless-heaven:master January 29, 2021 14:25
@coyoteecd

Copy link
Copy Markdown
Contributor

@j0k3r I don't understand what's going on here. Was this PR closed accidentally? Because I don't see it merged anywhere, and #680 is closed without being merged as well.

@j0k3r j0k3r reopened this Jan 29, 2021
@j0k3r j0k3r changed the base branch from release/5.4.0 to master January 29, 2021 19:13
@j0k3r

j0k3r commented Jan 29, 2021

Copy link
Copy Markdown
Member

Sorry I made a mistake while merging release/5.4.0 into master and removed it. The removal automatically closed that PR. It should now be rebased against the master and fix conflicts.

@vicary

vicary commented Jan 31, 2021

Copy link
Copy Markdown
Member Author

Not sure if I'm doing it wrong, but I found myself learning the backstory every conflict or two in the process of rebasing. This takes a day or two, could only do this on weekends.

@vicary

vicary commented Mar 1, 2021

Copy link
Copy Markdown
Member Author

@j0k3r During my rebase I found that the current master has these patterns.

// tests/packageModules.test.js
        return BbPromise.each([ '1.18.1', '2.17.0', '10.15.3' ], version => {
          getVersionStub.returns(version);
          return expect(module.packageModules()).to.be.fulfilled.then(() => BbPromise.all([]));
        }).then(() =>
          BbPromise.each([ '1.17.0', '1.16.0-alpha', '1.15.3' ], version => {
            getVersionStub.returns(version);
            return expect(module.packageModules()).to.be.fulfilled.then(() => BbPromise.all([]));
          })
        );

It has a strong code-smell here .then(() => BbPromise.all([])); which should either not there, or some tests are missed during rebase.

Not meant to make things more complicated than it should, please feel free to ignore this if it's intended.

I'll be rebasing to master as-is, just a friendly heads-up.

j0k3r and others added 3 commits March 1, 2021 13:04
Mostly to fix security issue but also to keep them updated.

Also:
- fix an ESLint error: `8:16  error  Do not access Object.prototype method 'hasOwnProperty' from target object  no-prototype-builtins`
- run prettier (following update)
- update `format` script with `$(pwd)` to fix issue with higher version of ESLint (>5)
- prettier now run on every js files
* Add copyExistingArtifacts to packageModules

* Refactor packageModules

* Set service path

* Generate artifact name from service

* Output artifacts to .webpack before copying

* Set artifact name for service packaging

* Skip webpack:compile if --no-build is set

* Add webpack:package:copyExistingArtifacts hook

* Make packageModules & packExternalModules no-op if skipCompile is set

* Refactor packageModules

* Remove artifact location setting from packageModules

* Update cleanup to check this.keepOutputDirectory

* Fix path join on Windows

Co-authored-by: Miguel A. Calles MBA <44813512+miguel-a-calles-mba@users.noreply.github.com>
@vicary vicary force-pushed the feat/concurrency-5.4.0 branch from 150b1a8 to 9f6e3d2 Compare March 1, 2021 11:54
@vicary

vicary commented Mar 1, 2021

Copy link
Copy Markdown
Member Author

The rebase is finished, this should be ready for merging.

Comment thread lib/Configuration.js Outdated
@j0k3r

j0k3r commented Mar 3, 2021

Copy link
Copy Markdown
Member

Awesome job for the rebase @vicary 👏

@j0k3r j0k3r added this to the 5.4.0 milestone Mar 3, 2021
@j0k3r j0k3r changed the title feat/concurrency@5.4.0 Add concurrency support for more than one thread Mar 3, 2021

@j0k3r j0k3r left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, I think some tests should be updated as well about { concurrency: Infinity }. Don't you think?

Comment thread lib/validate.js Outdated
@vicary

vicary commented Mar 4, 2021

Copy link
Copy Markdown
Member Author

Also, I think some tests should be updated as well about { concurrency: Infinity }. Don't you think?

I agree that using Infinity may causes confusions. In fact compile.test.js is largely testing if the compiler has even run once, concurrency config there is mostly for cosmetic reasons.

To reduce ambiguity, how about we change the tests to use 1 instead?

@j0k3r j0k3r left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good job!

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.

6 participants